I'm developing a home lighting controller system based on a raspberry pi as the controller. I'm also trying to keep it fairly simple, reliable and easy to backup. At the moment I plan on having button panels for switches in the rooms, plus motion sensors.
I have made good progress on the hardware side of things. I have made an IO board with 2x banks of parallel outputs, 1x bank of parallel inputs made with shift registers, then a bank of I2C IO expanders giving me 128 parallel inputs with interrupt pins.
I have made some basic python scripts and experimented with node red to check that the hardware works, and I'm able to communicate with the I2C devices and also read/write the shift registers. So far so good.
But the software side is getting rather overwhelming. I'm thinking of using Openhab to handle the lighting side of things, but before I go down any particular road I think I need some advice from everyone.
How are triggers passed to something like Openhab? Here would be a typical sequence of events that I'm trying to achieve:
-Press physical button in a room
-I2C expander registers state change on IO pin, triggers interrupt pin connected to RPi IO pin
-RPi reads IO pin change, then send I2C read message to associated chip(s)
-RPi is able to compare IO pins to previous state to determine if a button has been pressed
Alternatively:
-Scan through input shift registers at some low rate (~5Hz for example)
-Detect state changes (attached devices may be motion sensors for example)
Then each digital input whether on the I2C expanders or shift registers would have some associated trigger/value, eg room_01_ON, room_01_brightness_INCREASE, room_02_MOTION_SENSOR etc etc
Right about now I'm somewhere in phase 2 of the underpants gnome meme. I'm not sure what software to use to process the IO stuff, perhaps node red with scripts that pass values onto openhab? Also, I have seen people recommending organising openhab and everything else like node red into Docker containers, rather than using the OpenHABian pre-made RPi image. Any input or experiences?
Once all the processing is done on the RPi side, the output sequence would involve writing digital outputs to the shift registers. The outputs are grouped into banks of 18 parallel outputs with a total of 288 outputs. The groups of 18 digital outputs connect to separate lighting drivers to set brightness and colour temp, on/off. So to change one light you would need to shift in 288 bits each time. Not all the outputs may be controlling lights either, for example I plan on using a relay board to switch mains power on/off to the various AC/DC converters for each LED driver board.
I'm hoping to keep things simple to start with, but also leaving the option for expansion, for example I'm also looking into MQTT if additional remote control needs to be piped into the system later on, but first things first is seeing whether I can simple turn a light on with a button.