When we bought our house back in 2009 I started looking at the available domotica options on the market.
And the one thing they all had in common at the time was their non-interoperability (and being extraordinarily expensive, as in 1000 euro for a module with four relays).
So I decided to design my own system, so as not to be restricted in what I could connect and control, now and in the future.
I picked CAT6 as my carrier cable as it's cheap, has eight wires, and plenty of connector and patching options.
The electrician put in 2km(!) of it throughout the house.
I went with a star layout because it offers the most options in how to wire and control it all.
164 CAT6 cables (142 for the domotica, 22 for network) are terminated at four 48 port patch panels in a second hand (old telco) 19" rack in my home office.
From there they are patched through to eight 24 port patch panels, each of which houses four domotica modules which are connected to six ports each.
The first port on each module is used for the rs485 bus which the modules use to communicate with the master (originally a foxboard, then a nanos g20, and now a raspberry pi 3), the other five can be hooked up to a number of combinations of sensors and actors.
The bus cables are patched to two extra 24 port patch panels which are wired up to a 2u panel with 32 leds and a five and twelve volt power supply.
The raspberry pi has a custom rs485 hat (built using an arduino mega for its UARTs) and a UPS hat.
Throughout the house there are 31 sensor combinations which measure light, temperature and detect movement.
In the hallways, stair cases, basement and toilet the lights are controlled by movement.
The modules I designed around the arduino mini 04.
These communicate over rs485 with the master using a token based protocol.
They get input from the 31 sensor combinations, 28 two button wall switches and 8 thermostats.
And they give output to 29 lights, 3 dimmers, 17 switchable power sockets, 8 thermostats, 6 blinds, 2 doors (with smart lock electrolocks), and the garagedoor.
I also still need to connect an electrovalve to fill the bath tub along with an ultra sonic range finder to detect whether the bath tub is full, and add a few sensors for the utilities and washer/dryer.
The existing radiators I connected to the domotica system by using cheap HoneyWell HR20 thermostats, which I hooked up through their serial debug ports.
In the kitchen I installed a second hand 23" touch screen, with another raspberry pi behind it, on which I can display the domotica UI, my recipes website, and control the music in the rooms.
During the remodeling I had speakers put in all rooms (10 in total), for which I built five stereo amplifier modules, connected to an old media server with two sound cards.
The sound server shares its case with my VM server.
The amplifier modules are switched on by solid state relays, which are switched by the parallel port on the sound server.
This gives us the ability to have separate music streams in each room. (Or the same streams in any combination of rooms.) As well as intercom capability. (Mainly used for the doorbell.)
The doors are equipped with smart locks from Invited. I put remote controls for these in the ceiling as well, so I can open/lock the doors through the domotica.
There happened to be just enough space in the bottom of the garage door button box to add one of those 2$ double optocoupled relay boards. (Well, after removing some plastic to make room for the IC, and relocating the headers to the bottom of the board.)
At some point we installed solar panels, and will soon be forced to replace our analog electricity counter (which simply goes backwards when we're exporting electricity), with a digital one which will count import/export separately, and only give you a fraction of the import price for your export.
To investigate whether a battery solution would make financial sense when this happens, I wanted to have a clear view of our production, import, and export.
So I put a raspberry pi with a rpi camera in front of the analog counters.
I added a (+5) lens of an old pair of my wife's glasses in front of the camera, reducing the focus distance from about 1m to about 15cm.
I configured it to take a picture every 15 minutes (the same granularity our solar inverter logs its production with).
It then cuts out the individual digits, brightens, thresholds and inverts them.
These are then run through a custom tensorflow model for analysis.
My first attempt with tesseract failed due to the special font and the rotating digits often causing parts of two digits to be visible.
OpenCV didn't work out either, causing lots of both positive and negative mismatches.
But my tensorflow model gives me 99.5% accuracy!
This data is then stored in postgres.
Combined with the solar production data which I pull in daily, this allows me to generate some informative charts.