I cannot add new nodes, After I get support in Home Assistant,



  • Hello,
    I used to use 5 nodes without any problems before(2xtemp.and 3xpir sensors). A few days ago Home assistant has an update, MYSENSORS integration has arrived. I continued using it without any problem.
    I wanted to add a relay (name: relay 6) today, I uploaded the code to arduino pro mini, it was connected to the network. It did not appear in the home assistant (HA).
    i rebooted HA , it is gone again. then I looked for a solution on the internet but could not find it. Self-relay appeared on the screen.

    Then I sent new code to the Arduino, motion sensor, same node id (node id:6)
    Motion sensor connecting to network, updating json file, but not updating in HA.
    I tried to add another sensor, the result is the same, the node is not updated in HA. There are always "relay 6" on the screen.

    What can I do about this, I want to add relay and led dim to mysensors.

    Summary 🙂 I cannot add a new node to HA after the update has arrived(old nodes work fine).



  • 1.PNG 2.PNG 3.PNG



  • If I understand you right, this happened:

    -> You created a new node with ID 6 as a relay and connected it. Home Assistant didn't list the new node.

    Most likely, because you didn't send an initial value. If a sensor / child has not sent a value at least once, HA won't display it, because there is nothing that it could display. (No value, or null, isn't the same as a value of 0 / zero. The latter could be interpreted as "off", but not the former.)

    Since the MySensors integration is now configurable via the UI, every node must be registered in Home Assistant's entity registry. That means, that every MySensors node and its children get a persistent unique_id, which doesn't change after uploading a different sketch.

    -> The relay appeared in the UI after some time.

    You did something to trigger the relay or updated the sketch to send the relay state at least once when you were researching the problem. Now that HA has a value to associate with the entity, it is able to display something in the UI.

    -> You uploaded a different sketch for a motion sensor to the Arduino, but kept using the same node and child ID.

    Home Assistant recognized that this is the exact same device as before, because the unique_id didn't change and as far as Home Assistant is concerned, you are not supposed to change this ID.

    The data stored in the entity registry has precedence over other data sources like the mysensors.json file, so HA will continue to treat every sensor with the same child ID on node ID 6 connected to the same gateway as a relay and name it "Relay 6" by default.

    Some possible workarounds are:

    • Rename the "Relay 6" in the Home Assistant UI.
    • Delete the entity of the relay sensor from the UI using the "DELETE" button in the lower left corner of the modal window. Then power up the Arduino with the new motion sensor sketch.
    • Shut down Home Assistant and delete the registry entry of the relay sensor manually from the core.entity_registry JSON file (located in config/.storage/). Be sure to backup the file before doing so!
    • Choose a different node / child ID for the motion sensor and "disable" the relay entity in the UI.

    I think, since MySensors nodes are now uniquely registered in Home Assistant, it should be "best practice" to statically (manually) assign node IDs and be mindful about it. Like, use different node IDs for different node types to avoid conflicts with the registry. If you ever used ID 5 for a temperature and humidity sensor and you stopped using it, avoid reusing the same node ID for anything else than another temperature and humidity sensor node.

    Personally, I use ID ranges for nodes with the same function. Like, all node IDs from 30 to 49 are reserved for door and windor contact sensors.



  • @BearWithBeard
    Thank you for the explanatory answer.

    I added a new node(ralay id:50), again home assistant(HA) was not added. How can I send a new value from the Relay? nrf1.PNG
    I tried sending data with myscontroller. the relay opens and closes. is that the right thing?

    nrf3.PNG

    It was finally added to HA. But It seems to be disconnected from the network every time a command comes from HA.
    do you think this is normal?
    nrf4.PNG



  • I added a new node(ralay id:50), again home assistant(HA) was not added. How can I send a new value from the Relay?

    You need to send a message at least once for it to appear in Home Assistant. Use something like this:

    bool initialMessageSent = false;
    void loop() {
      if (!initialMessageSent) {
        send(msgRelay.set(currentRelayState));
        initialMessageSent = true;
      }
    }
    

    After you manually injected a message via MYSController, Home Assistant started to list the new entity in the UI. So yes, that's exactly what Home Assistant required. If you take care of that within the sketch as shown above, you don't need to do it manually.

    But It seems to be disconnected from the network every time a command comes from HA.
    do you think this is normal?

    No, I wouldn't consider that normal. What do you mean by "disconnected"? Does the node stop working completely after receiving a message from HA? Doesn't it respond to consecutive commands?

    Does the debug output (using #define MY_DEBUG in the relay node sketch) hint at something? Sharing your sketch may help us find the issue.


Log in to reply
 

Suggested Topics

0
Online

11.2k
Users

11.1k
Topics

112.5k
Posts