Get status of connection



  • Hi,

    is it possible to determine the status of a sensor connect?

    I would like to use an ESP8266 module as a gateway/sensor. In order to save air traffic and battery
    I would put the sensor to sleep for most of the time. But I cannot put it to sleep if it hasn't sent its values
    yet, worse: gateway or sensor node may not even have connected yet to my controller.

    So, can I somehow get these informations from MySensors by code? I know of course that informations
    about this are sent to the terminal when debugging mode is used. But I've got no idea how to get this
    data... some variable somewhere I can check? How would You do something like that?

    Thanks,
    Christoph


  • Mod

    why would you run an esp8266 gateway on battery? You also can't put it to sleep if you need other nodes to send data to it and if you do you will of course loose the sent data from nodes.



  • @gohan Hi. I'm actually using it as a sensor node, not as a gateway. I need the WiFi function anyway to connect the sensor to another network device (KEBA Wallbox 🙂 ) and in order not to make things too
    complicated I decided to connect this sensor to Domoticz as a gateway. I could also hook up an NRF module and use that but that would add complexity 😉

    Thing is, connecting a gateway to Domoticz can take a few minutes and sometimes it doesn't work at all.
    So in order to make sure I got the gateway reconnected properly after a nap I have to find out if and
    when reconnection happened. Is there any variable in the MySensors world that lets me find that out?

    Christoph


  • Mod

    @hyla you could fetch the current time from the controller. If you get a response, the controller was working. See requestTime and receiveTime at https://www.mysensors.org/download/sensor_api_20#requesting-data

    Note: the MySensors sleep function does not work on esp8266.


  • Mod

    I think there is a way to see how many connections are open on the gateway, because you can set maximum clients value. In any case domoticz will poll the gateway every few seconds if you are concerned.



  • @hyla You can use function: isTransportReady(). Confirmed working.


  • Hero Member

    I think isTransportReady() will only test your connection to the gateway not all the way back to the controller.

    Requesting the time as @mfalkvidd has said is a good way to check the controller.



  • Sorry you are right. If you need to check "complete path" fetching time from controller is probably good way to do it.


Log in to reply
 

Suggested Topics

  • 1
  • 1
  • 3
  • 3
  • 6
  • 10

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts