(Almost) Controller-Less MySensors switch/light network


  • Hardware Contributor

    Hi,

    I'm working on the code of my new nodes.
    My house is fitted with a great number of door-bell-like switches, and I'm using a home-automation solution which doesn't fit my needs.

    My current topology is like this :
    There is SWITCH boards, and LIGHT boards.
    The LIGHT boards doesn't have buttons inputs, they are only controller from messages.

    When a switch is pressed, it can either send a message to the controller, or to another light. The message type when sent to a light is a "toggle" one.

    Then, when the light changes, its new status is updated with a message back on network.

    This kind of topology is reasonable , since a light can be either controlled from the controller(aka server), or from a switch. The switch doesn't have to know the state of the light, it just have to send a "toggle" or "action" command to the light without parameter.

    Now, I'd like to replace those old boards with mysensors one.
    To do so, I can either let the switch report every push to the server, and let the server handle the changes, or program each switch(aka push buttons) to send a message to the light it has been associated.

    I see some pros and cons for each solution :
    Pros of "Server solution":

    • associating a switch to a light is simple (if Controller software supports it)
    • Switch/push button code for nodes is simpler. Just report "push" message, no need to keep a track of target light in EEPROM...

    Cons of "Server solution":

    • If server fails/doesn't answer the lights doesn't work anymore !
    • If the server gets busy doing some stuff, the lights can become laggy...

    Of course, the Controller is still needed to have a web view of the network, give some tablets entry-points over the house, do some advanced stuffs (heating scheduling VS hollidays, etc...), so I WILL keep it in my setup, but I'd like to avoid the need of it to drive the lights, etc...

    Which solution would you use ?
    How would you program the nodes so a switch node can send a message to a light node ?


  • Admin

    You could send the light-switch-message both to the controller and the other light node. I.e.

    msg.set(1);
    msg.setDestination(0);
    send(msg);
    msg.setDestination( <my other light node id> );
    send(msg);
    

  • Hero Member

    @napo7 It is interesting that you have posted on this subject as I was just giving thought to a similar situation today. Like you I am still trying to decide what will suit the best.

    I have the lighting of several outside areas in our yard under MySensors control as well as a water pump connected to a tank. While it is great to be able to schedule them via the controller or operate them via a tablet there are still times when you just need a local area switch to do the job.

    I think in the end i will use a combination of "controller operated" and "node to node" in my next project which will be a stand alone control point for the outside areas.


  • Hero Member

    When you are controlling internal lighting for a house I think it is important that the light can be operated even without the controller or gateway being available.

    The only way i know of doing that with Mysensors is to have a switch connected to the node controlling the light. Don't know whether your wiring topography will allow for that but it should be considered for at least some lights.


  • Hardware Contributor

    @hek said in (Almost) Controller-Less MySensors switch/light network:

    You could send the light-switch-message both to the controller and the other light node. I.e.

    msg.set(1);
    msg.setDestination(0);
    send(msg);
    msg.setDestination( <my other light node id> );
    send(msg);
    

    In facts, I think I don't need to inform the controller of the switch press if the switch has a destination ID set.

    @Boots33 said in (Almost) Controller-Less MySensors switch/light network:

    When you are controlling internal lighting for a house I think it is important that the light can be operated even without the controller or gateway being available.

    The only way i know of doing that with Mysensors is to have a switch connected to the node controlling the light. Don't know whether your wiring topography will allow for that but it should be considered for at least some lights.

    Yes, that's a very important point : avoid black-outs when the controllers goes down for any reason.
    That's why I was planning a solution where buttons directly drive lights, without having the need of a controller.
    But, my boards are made, and I didn't put any inputs on the lights board, to replace my "old boards" with new ones and make the transition from old to new boards easier. Moreover, I often have 2 switchs that can command the same light, and I sometime change switch/light assignment.

    I think I will tend to a solution where each switch will have a reserved EEPROM space :
    01 : Destination node ID
    02 : Destination child ID
    03 : Message type to send
    or something similar.

    Eventually, a switch could turn on/off many lights at the same time (2 or 3 in my case). So I'll have to set i.e. up to 3 destinations for each switch.

    @hek is it possible to do something like

    msg.setDestination([Destination ID]).setSensor(Destination Child ID]);
    

    to specify to which child this message is for ? (I have up to 8 lights on the same board)


  • Hero Member

    @napo7 You can use something like this for node to node communication.

    /* : Id of sending : message : Destination : Destination : Payload *
    * : sensor : Type : sensor Id : Node Id : */
    send(MyMessage(sendingSensorId, V_STATUS).setSensor(sensorId).setDestination(nodeId).set(true));

    But I think even node to node goes through the gateway so if it is down the switch will not work

    Edit: wow that didn't format how i wanted it 🙂


  • Hardware Contributor

    I'll make a POC this evening, two nodes without gateway, to see if node-to-node communication works without gateway.
    I think it should work.

    A questions remains to me : How to easily set EEPROM parameters from the controller.
    I plan to use V_VAR(1-5) messages, but I think I'll have to write some kind of tool to easily set it, since the controllers I know doesn't seems to allow sending custom messages.

    BTW, That's where I need a "V_ACTION" message type : setting a light from the controller needs V_STATUS, V_DIMMER, but from the switch side, I only need a "V_ACTION" message, to inform the light to take action regarding its current state...


  • Admin

    The messages are being sent in a star topology.

    Two leaf nodes cannot send directly to each other (their messages will be routed through their parents).

    0_1488806636104_network.png


  • Hardware Contributor

    So, when I send a message with anything but 0 as destination, it goes thru the gateway, and the gateway rewrites a new message with the same destination ?


  • Admin

    No, it might never reach the gateway. For instance if a repeater on the way routes knows the destination, it will route it.

    Only repeaters and gateway holds a routing table which is build dynamically from the traffic the "see". So they are the only ones that can send messages "downward" in the sensor network.

    There's more information available here:
    https://www.mysensors.org/about/network


  • Hardware Contributor

    Catch it !

    Thanks !


Log in to reply
 

Suggested Topics

  • 1
  • 10
  • 2
  • 6
  • 1
  • 1

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts