Standalone lights controll / controller-independent node
dakipro last edited by dakipro
I built few sensors and installed domoticz on old laptop and life is good.
I will now MySensorify all the lights in the house, but I would like to be free to update/restart/replace laptop and controller if needed, without braking the lights functionality (because first time lights do not work as advertised, my wife will have me revert to regular switches).
This is where my "brilliant" plan of decentralizing light controller comes in. I am planning to build one "light controller" node that will receive messages from all the switches in the house, and send appropriate commands to all the lights.
Also controller will have communication with the lights to show their status, or to update them on some "smart" events.
So logic would be like:
- LightSwitch1 sends "clicked", or "double clicked" event to the "Lights control node"
- "Lights control node" then has some if/else logic where it will figure out which switch was clicked and then
- it will send appropriate command to some (or all the lights)
- Lights then send current status to the main Domoticz controller
Disadvantage is that when adding a new light or new switch I would have to reprogram the "Lights control node", which will not happen that often.
But the huge advantage is that this node is controller independent and will work fast and reliably. It will also improve response time as now I get almost 1s lag from domoticz before it turns lights on.
I am also planning to have a bit advanced "clicks" on the switches, such as "hold 2s -> turn on/off all the lights", "double click -> turn only floor lights on" etc.. This doesn't have to be in the "Lights control node" as it is not that mission-critical
What do you think about this design, did someone implemented something similar? Some tips about the design and the code?
How should I communicate messages between switches and lights controller and lights? Some code tips?
Thank you all for making this awesome library/project, I love it!
Edit: Changed the title from "Decentralized" to Standalone
High risks are involved when it comes to the WAF aspect. "One light controller node" doesn't sound very decentralized to me. There would still be some level of complexity and just move the single point of vulnerability. I like the interface to any type of controller to be as safe and simple, independent, separated and distributed as possible. The button/switch to light/actuator connection should be wired and override everything else.
A "lights control node" could be an intermediate level in such system. And particularly good if it offloads your controller as you say.
Luke Corkill last edited by
Sounds interesting and useful.
Does the MySensors protocol already support node to node communications? I have a similar decentralised desire to sound a buzzer when a motion detector is activated.
fets last edited by fets
@Luke-Corkill I think you can setDestination on MyMessage object before sending it :
Then send message
gw.send (msg) ;
dakipro last edited by dakipro
@m26872 I agree with you about the wired connection, unfortunately in the apartment I rent now we have one switch in the middle of the apartment that controls five light bulbs in two different rooms (don't ask why), so running the cables trough whole apartment is just not practical. Which is the main reason I am motivated to MySensorify it all, it takes too much walking around for the light switch and too much hitting the door and the cat in the night.
@fets Exactly, I found that method/setter in API and got inspired to go around/parallell of the controller.
The sketch logic would be then:
On Click: sends message to Lights Control Node with its SwitchNodeID and SwitchAction (NodeID is sent automatically if I read API right?)
-- Ligts Control Node
On Message Received:
- Do some if else based on the SwitchNodeId and SwitchAction and
- send "Toggle" message to desired light or group of lights. (Right now I am a bit concerned whether to send the toggle message or on/off, as controller can get lights out of sync by running some automatic script. Not sure how to handle this yet, probably by always running some lights in the group-only (living room lights, bedroom etc))
-- Light nodes
On Message Received (both from "Lights control node" and domoticz): do what it says in the message and report your status back to domoticz.
I just started with MySensors and arduino programming (I do some programming in php). I will have some time now during the hollidays to play around, but do you guys see any challenges in this code and design logic? Something that could be difficult/impossible due to some design or code limitations?
I guess switches and the Lights control node need to be presented to the gateway and the controller, which can then just ignore them.
Also, which message should I send from switches and Lights control node, S_LIGHTS or some custom variable?
Does anyone have some example of node-to-node communication and sending the messages between?
I think I saw something on the forum about weather station but I cannot find it now
Stuart Middleton last edited by
This post is deleted!