is there a solution for a relay with button that also works offline?



  • I have about 7 relays with pushbuttons that control my lights in the apartment.
    everything is ok as long as the gateway and or the raspberry is running with homeassistant.
    I have been in the dark a few times when it came to MySensors relays. (ZigBee also works without gateway)
    I have not found a solution yet. You could get the Arduino to switch the relay (on/off) simply by pressing a button, but as soon as a #include MySensors is entered in the scetch before setup, the module searches for a gateway before it can continue with the rest of the routines.

    does anyone have a solution for my problem? unfortunately I can't get any further.

    best regards
    branther



  • Hello to you

    MY_TRANSPORT_WAIT_READY_MS

    "MY_TRANSPORT_WAIT_READY_MS. Very useful. You can tell a node to try connecting to the gateway for X seconds, but if it fails, it should just carry on. I usually set this to 10000 so that it will try connecting to the network for ten seconds, and then just continue starting the node. The default is 0, meaning that if a node can't connect to the gateway it will never reach the loop() portion of your code!" API 2.0



  • thank you very much for the quick answer and the link.
    I will try it right away.



  • wow, great, that was exactly what I was looking for.
    Thanks for the link, I would not have found it in the forum, despite intensive search.
    The functions "MY_TRANSPORT_WAIT_READY_MS" and "if (isTransportReady())" in the loop() brought exactly the result I was looking for.
    I admit, I had some problems with the implementation but now everything works perfectly and I am the boss of my relays again.
    Now I will flash all relays one by one. Unfortunately I have my rest-proMini 168 arduinos installed. Thus no option for OTA.
    best thanks @JeeLet
    greetings
    branther



  • hmm, but there is still a small problem
    if the GW, Homeassistant or the nRF of the relay are off and you restart or reset the relay then it goes into the state of "isTransportReady() = false" and thus works in offline mode (as desired).
    As soon as the GW is active again the relay will be active online again.
    so far so good!

    but the other way around, if the relay is running in online state, so it is connected to the GW and the GW or Homeassistant go offline, it is not recognized by the relay. I have to do a reboot or reset first to get it working again in offline mode.

    My question now:
    Is there any function I can run in the loop() so that after 2sec. or so after manually switching it is detected that the GW is not giving any response and then here "isTransportReady()" is switched from true to false?
    i think with this a switch from online to offline would work automatically. or?
    thanks in advance
    branther



  • Your question raises many problems, but a simple solution may be possible 🙂

    In the creation of a home automation system there are two basic philosophies.

    • a centralized "intelligence" that contains the parameters and algorithms to give orders/actions to the Nodes
    • or a distributed "intelligence", each Node with its own algorithm receives the list of things to do.

    for your problem how to have a "degraded mode" in case of scratch.

    some reading ... links :

    the keyword, the thread: Sending data

    https://forum.mysensors.org/topic/7841/relay-actuator-send-periodic-status-as-heart-beat

    https://forum.mysensors.org/topic/6948/synchronising-light-switch/2



  • super, once again a few super links, thanks for that

    i will go for the easy way. this sketch by boots33 works perfectly.
    But before that i will try to understand and learn the steps.
    thanks again
    branther


Log in to reply
 

Suggested Topics

76
Online

11.1k
Users

11.1k
Topics

112.5k
Posts