Ive been playing around with MySensors for a while now and I have become quite fond of having things which I can automate and control from my bed.
Since I am retro fitting conventional ceiling lamps and heaters, I have to bypass the wall switches and keep them in always ON mode (to provide mains power). The actual ON/OFF mechanism is controlled by the sensor nodes, which are placed near-by the bulb holder or end of the wire for other items. In this way, I have no physical switch with which I can control the actual bulb. I do prefer the good old and trusty wall switch and it’s a good to have when you have guests, whom do not have access to the controller.
Some of the “commercial” home automation products come with a separate remote control device which acts as a physical (but wireless) button which can be paired to the actual device.
I was wondering if there was a way that I can create a paring mechanism whereby I can join two senor nodes together (wireless), and not have the need to go through a GW. So basically, a sensor node which can be controlled by a controller software(HA/OpenHab) and multiple button nodes.
For example, consider the setup below:
- Controller - Some controller which can be accessed by phone (Web based) eg HomeAssistant, OpenHab.
- Serial GW - Connected to controller and manages the MySensors network.
- Control Node - Connected with the GW (as normal) and is always on. This node has sensors and actuators which we want to control eg Relays
- btnNode1 - This is a node with just a button. It is connected to Node1 (paired node), acting as a wireless button to control the main node.
- btnNode2 - Same as btnNode1, but placed in different part of room.
What I want to Do
- Setup a node which is connected to the the GW and has a node-id. This is the node we want to control. Call this Control Node
- Setup another node which will act as a Button Node and can connect to:
- The GW, to get node-id and for pairing session.
- The Control Node, to toggle the relay, switch, etc.
- When a button is pressed, the node wakes up.
- Send a toggle command to the Control node with the secret-key.
- When the button is pushed for more than 3 secs, the node goes switches into paring mode.
- Connects to the GW and obtains a node-id (if it is a brand new node)
- Obtains a secret-key/network key from the GW (Security mechanism, something like a two-factor thing)
- Puts itself into receive mode.
- When it receives a pairing request it responds back to the pairing node with its node-id and the secret-key/network id.
- On confirmation, it stores the network-id and pairing nodes’s node-id to EEPROM.
- When a button is pressed for 3 secs, the node changes its state to pairing mode
- Sends a network wide request to locate the Button Node
- When the button node
- When it receives a request for pairing, it stores the Control node's Id into EEPROM
Has anyone done anything like this? What options do I have in creating functionality for this using mySensors.
Any help and advice will be greatly appreciated.