Updated December 2019.
Here I describe the home-automation solutions I use in my house — a forever-in-progress project. It has always been a dream of mine to build a user-friendly, open-source product (hardware + software) for home automation, even though I have never released anything because I am still using my own house as a case study and development sandbox :P.
Reading Francesco Tucci’s project La domotica fai da me made me want to share mine, which is very similar in its basic motivation.
Disclaimer: I do NOT do this for a living. I built it over the years ONLY for my house, ONLY as a hobby — even though shipping a user-friendly open-source home-automation product has always been a dream.
As Francesco puts it,
“I am not dependent on services that might fail or shut down”
my home-automation system was born from refusing to rely on third-party commercial projects. My house should still work thirty years from now when I am a doddering old man. And maybe I should not be forced to use separate Android apps, and should freely write interoperability scripts.
It is not always possible: home automation / IoT is full of cloud-only solutions. I often use those temporarily to understand my needs, then migrate them over time to open solutions.
Voice recognition at home I do with Alexa units, because a reliable non-cloud solution still does not exist.
Memole, the control hub
A main Raspberry Pi, called Memole, the house assistant — almost a family member.
Memole runs the whole house. DHCP & DNS for the private network (with upstream ad and malware blocking via Pi-hole), UI (tablets at home) and chatbot (Telegram), manages the house and commands all other hubs.
- It has a single config.json file with all house-specific options: target temperatures, widgets to show in the UI, MAC-address→plugin map, etc.
- It fills a single data.json file with all collected data.
- It collects data via nmap on network devices, to keep a list of devices on the local network. UI screenshot
- In config.json there is the full MAC-address→plugin map; for example:
"C8-FF-77-D8-FE-C5": { "name": "Dyson Camera", "type": "dyson-pure-cool", "category": "Domotics", "dyson_name": "Camera", },After Memole checks which devices are online, if a device maps to a plugin (in the example “dyson-pure-cool”) it launches the script that talks to it to collect data
(in the example: temperature, humidity, etc.). - It runs a web server (nginx) with an all-AJAX jQuery interface that reads data.json and builds the UI.
Of course I use it from my phone.
At home I have tablets in kiosk mode showing the interface.
I access it remotely via port-forwarding through my own VPS on Amazon EC2.
For example, a widget in config.json like"riscald_primo": { "x": 55, "y": 16, "width": 18, "height": 10, "title": "Riscaldamento Primo", "text": "[field=devices.B8-27-EB-7A-26-B9.caldaiaRelayPrimo,format=bool] [field=devices.B8-27-EB-7A-26-B9.temperature_detected_primo]\u00b0 [fontawesome]f18e[\/fontawesome] [field=config.temperature_target_primo]\u00b0" },
I also use a Telegram bot for interaction. For example, if I pull the sauna alarm cord, the alert arrives from the Memole bot. It answers commands such as “turn on study”, “turn off all lights”, “tell me current power usage”, “turn on electric fireplace”, etc.- Memole also queries the other Raspberry Pis around the house, generally used as sensors (temperature, humidity, etc.) or as wired interfaces to other systems (for example I have a Pi in the boiler room that translates Memole commands into Modbus serial commands for the heat pump).
- Most physical buttons (wall switches) are buttons Memole hears, and then it commands related devices.
For example, in the attic I have traditional buttons that, when pressed, turn on Philips Hue LED strips. A double-click changes colour presets.
Konnex
I have an Instabus/EIB/Konnex system — an open standard that allows electrical components to interoperate.
In practice, when I built the house I had a conduit installed that carries an EIB data bus.
In a normal electrical system every switch is wired physically to a light; instead, in EVERY switch in my house I have a module that only sends a telegram “it was pressed”, and a controller that reacts according to configuration — typically “turn on light X”.
That lets me control everything via API (for example open the garage or the electric gate from my UI).
It also allows scenarios, like “If I press the button near the exit, turn off all lights and close all hopper windows”.
I use ETS 5.5 for configuration and debugging, and a Gira Ethernet interface for control from my scripts.
Electrical self-sufficiency
I have several semi-working solutions for monitoring electrical power use.
What I use today is the TeslaWall2 API (here an example JSON output), which lets me read in real time the house consumption, how much the PV produces, how much is covered by the storage battery, and how much I buy from Enel.
I have an 18 kW photovoltaic system, a 13.5 kW storage battery (I am considering adding two more), all in a three-phase setup with a voltage stabiliser.
In summer I reach over 90% self-sufficiency; in winter with heating the percentage is much lower.
Heating
This was one of the first goals of my system, because by choice I have NO thermostat in the house, and if heating works badly my wife rightly loses it.
Currently I have three Raspberry Pis sensing temperature and humidity per floor.
The hub Pi queries them and, based on an algorithm in a script, decides whether to tell a fourth Raspberry Pi connected via Modbus to the boiler to activate the relays.
In practice I have a software thermostat.
I try to use a gas boiler ONLY as backup; at steady state the underfloor heating is powered by a heat pump, a Daikin Hybrid Cube for hot water, eight split units and three more outdoor units for the splits. Via Modbus I get real-time boiler status and temperatures (water inlet, leaving, outside, tank, etc.).
To increase self-sufficiency I apply rules such as raising temperature while the PV is producing, avoiding night-time grid power when reasonable.
Alexa – Amazon Echo
As a voice interface for covering most areas of the house, I am forced to use Echo units (I have quite a few — about 8 from memory). I know: questionable for privacy, and cloud-based.
But I do NOT use any third-party home-automation skills. I wrote my own skill (Lambda on AWS) so Alexa acts as a gateway, translating voice commands and passing them to Memole.
So one day I only need to find an equivalent that does recognition and text-to-speech. Today, with a Raspberry Pi and non-cloud solutions, free-text recognition (without training on specific words) is terrible.
Pool
I use a Blue Connect (cloud-based) as a management aid, because managing pH, salinity, etc. is quite complicated, but the rest (filter-pump scheduling, heating, and so on) is also handled directly by Memole.
LAN
I have 15 LAN drops and several Wi-Fi routers. The house is large; that is the only way to get decent coverage from every point.
I am testing Ubiquiti with mesh points to solve coverage with a single SSID.
I use a Vigor 2760 as the primary router for ADSL, QoS, etc., mainly because my ISP gave me a weird IPv6 configuration that I can only make work with that. When I requested IPv6 years ago, according to my ISP I was the first to ask…
Alarm system
No. Well, there is an alarm — a TecnoAlarm — but by choice it is fully manual and separate from my DIY gadgets.
Other IoT hub hooks
Memole talks to several hubs from other home-automation solutions (some cloud-based). Again: Memole is the primary interface; the following hubs are used as ‘helpers’ by Memole, never directly.
Currently as gateways I have:
- A Fibaro Z-Wave hub with which I control a few switched outlets and manage Fibaro motion sensors
- A Philips Hue hub for several RGB lights.
- A Fingbox, though I am trying to phase it out
So when I need to connect an IoT device, I can choose Konnex, Z-Wave (via Fibaro), Zigbee, or at least pick a device I can control directly from Memole over LAN (via API), or if it has at least a serial interface (Modbus for example), I put a Raspberry Pi next to it that Memole will control.
Other connected devices
- A LaMetric Time as UI for outputting some values
- 4 Dyson Pure Cool units for sensing and cleaning indoor air quality.
- A BTicino video door phone (which I hate; sooner or later I will build my own).
- A Jacuzzi MI sauna. I list it here because I built the Alexa hook myself so I can command Memole from inside the sauna, plus ambient music and chromotherapy.
- A Grohe Sensia Arena shower toilet — basically a Japanese-style toilet. Not connected to Memole yet; there is no need, but I mention it because it is still a tech device in the house.
Other tech devices at home, not IoT-related
- Several home-theater systems in the various areas (cinema with projector in the basement, living room, bedrooms, gym) — I will not list the hardware. Generally Android.
- I am a big fan of VR tech. I have 2 distinct areas, many headsets, and especially a gaming station I try to keep at the technological cutting edge.
- An original JAMMA arcade cabinet restored with a collection of pre-1990s arcade games. MAME, C64, Amiga, Game Boy and laser-disc emulation via Daphne. It mounts an original CRT, a custom VGA board to reproduce the exact 15 kHz feel and native resolution (Bubble Bobble, for example, runs at 256×224, 256 colours), credits by inserting coins.
- A turtle pond (with pump and waterfall) controlled by Memole.
The end
Alright, I will stop for now; if the topic resonates I may add more explanation.
Ciao!
