New sensor ID-s when changing network

  • I've controlled my nodes from HA in the last some years (I was happier with domoticz, anyway). After some hardware difficulties, I had to replace the Arduino in the serial gateway. Now I have a new gateway hardware and plugged into a different USB which runs Home Assistant.
    The result: I have new devices and entity id-s. Great.
    Do I need to rewrite all of my scripts, automations, templates, etc...?
    Is there any solution to this problem?

  • I don't know if there's a way to do it from the Home Assistant side, but it's always possible to hard-code the ID of each individual 'sensor' when you're programming it. If you want them to never change, this is a way, and maybe the only way to do it. (I don't really know, but it's the only way that I know of.)

    According to this page:

    You set MY_NODE_ID to the ID you want and you should be good.

    #define MY_NODE_ID 12 // or whatever number you want...

  • Mod

    @ejlane I don't think setting node id helps if Home Assistant think there is a new gateway. A new gateway means a new MySensors network (parallel to the earlier network). Since people could have any number of MySensors gateways connected at the same time, a MySensors node is identified not only by its node id, but by its gateway (address/path) and its node id.

    In Domoticz, the correct way is to replace the old gateway with the new gateway, instead of adding the new gateway. I don't know if HA has a similar concept but it should.

  • @mfalkvidd Oh, that kind of issue didn't even occur to me. I was thinking that it was still showing up as the same mysensors network, but that now what used to be sensor 10 was now 3 or whatever.

    Yeah, my suggestion wouldn't help if Home Assistant sees this as a totally new connection/profile/whatever.

    And I use Home Assistant, and I've changed gateways, but I'm always tinkering, so I change things often, and it was no big deal for what I do to go from one to the other. I don't remember having any issues with this. (Could be I still did, but it was a minor enough problem, compared to other big issues, that I simply forgot about it.)

    But I don't have an easy way to test going from one to the other right now. I don't have a spare gateway to test on. 😞

  • Mod

    I think that HA would keep the entities and ids if it was aware that the new gateway was a replacement of the old gateway.

  • @ejlane
    As it is mentioned above, it seems to be a new network for HA, since it has a new gateway. I also use fixed IDs in the network. It's a great feature.

  • @mfalkvidd said in New sensor ID-s when changing network:


    A network ID provided by MySensors gateway would be a good solution to solve this problem. Unfortunately I do not expect any development activity in the project. It seems to be dead in the last few years. 😞

  • yes HA or (Hassio ) and not very friendly with MySensors.

    the "Persistence" function of the sensors and the rewriting of the sketches ( for the validation of the messages) and a constraint.

    No MyS is not dead, we are La!
    and for "Do I have to rewrite all my scripts, automations, models, etc..." ... it is perhaps the safest, cleanest...

    give us the result! Ask on the HA/Hassio forum for a solution?

    you are in mode #define MY_NODE_ID "static" for the nodes??

Log in to reply

Suggested Topics

  • 1
  • 17
  • 3
  • 3
  • 2