Get version response



  • I run a mysensor gateway on an ESP8266 with some sensors directly connected to the gateway.
    On the receiving end I have domoticz and sometimes it happens that the connection goes down and so I'm not sure of the state of the inputs of the mysensor node.

    When the ESP reconnects to domoticz, domoticz also requests the version...
    how to use this request to resend the current state of the inputs?

    ip:192.168.2.200,mask:255.255.255.0,gw:192.168.2.254
    .
    starting server

    Send sketch info
    Present temperature sensor
    Present heartbeat signal
    Setup completed
    0;0;3;0;9;Init complete, id=0, parent=0, distance=0
    0;0;3;0;9;Client 0 connected
    0;0;3;0;9;Client 0: 0;0;3;0;2;
    0;0;3;0;9;Client 0: 0;0;3;0;2;Get Version
    0;0;3;0;9;Client 0: 0;0;3;0;18;PING
    0;0;3;0;9;Client 0: 0;0;3;0;18;PING
    0;0;3;0;9;Client 0: 0;0;3;0;18;PING

    in my sketch I like to catch the message Get Version to resend the input signals, since sending this right after starting the server is no use because domoticz is not yet listening....

    like:
    void receive(const MyMessage &message) {
    if (message.???==Get Version){
    debouncer.update();
    value = debouncer.read();
    send(msgOpen.set(value==HIGH ? 1 : 0));
    ....and so on
    }
    }

    anyone any idea how to do this?


  • Mod

    Looks like you're on the right track.

    I would move the sending code to a separate function though, so the same function can be called from loop() and receive(). Duplicated code usually causes problems.



  • nobody knows how to catch the get version message?


Log in to reply
 

Suggested Topics

23
Online

11.2k
Users

11.1k
Topics

112.5k
Posts