Answering request command

  • I'd like to build sensor which answers for "request command" with value for particular sensor. I can catch these message in
    void receive(const MyMessage &message) function but questions are:

    1. Should I answer for these message in any "special way" or just send a message with sensor value to questioning node using bool send(MyMessage &msg, bool ack) function?
    2. Is it save to use send function inside receive function or should I set flag "message to answer" and serve it "in usual way" in loop()?
    3. Could someone please clarify a bit meaning of ack parameter? Sometimes I've problems with radio connectivity and I have to find the way to inform controller (Domoticz) that "set command" send to relay was accepted and executed by sensor. Does ack solve my problems?

  • Hero Member

    @bilbolodz Have a look here for some info on request

  • @Boots33 Thanks but actually these post doesn't contain answer for any from my questions.

  • Hero Member

    @bilbolodz Sorry should have looked a bit closer

    1 it may depend on what you are doing but i have just used a simple node to node message to return in the past

    2 yes you can send a message from inside the receive function. if that is what you are asking

    3 Not totally sure what you are asking here. You can set the ack flag in domoticz for each sensor so domoticz will ask for an ack so it will know if the node has received the message.

  • @Boots33
    About 3:
    I will tell a little more. I've sensor with relays and hardware signing. For some reasons sometimes "set message" from Domoticz (via Mysensors RPI GPIO GW) doesn't reach sensor or get "signing fail" status (probably RF issues). In that case relay stays in "previous state" but Domoticz claims that's in "new state".

    How to force Domoticz to NOT change displayed "state of switch" (at dashboard) when sensors fails to change state of relay?

    I've set "ack for relays" at Setup->Hardware->MySensors GW (Setup)->Node->Child. Should I also enable ack in sketch during presentation for sensor (void present(uint8_t childSensorId, uint8_t sensorType, const char *description, bool ack);)?

  • Hero Member

    @bilbolodz Yes that is the flag i use. with that set if i try and change a switch and it cannot connect to the node domoticz throws up an error and the switch does not change. But not for you apparently. I haven't enabled anything extra in the presentation.

  • Hero Member

    @Boots33 I am not using signing though

  • Hero Member

    can you connect the serial monitor to the node and see if the ack request is getting through

  • @Boots33 I will play with these more at home.

  • @Boots33 What's you value for "Ack timeout"? I've 1200 (second????) so it looks for huge value! 1200 it's default.

  • @Boots33 One more question:

    In case of function:

    void present(uint8_t childSensorId, uint8_t sensorType, const char *description, bool ack);

    in documentation ( I've found explanation:

    "ack - Set this to true if you want destination node to send ack back to this node. Default is not to request any ack"

    Does it mean "ask Domoticz to confirm that received my presentation message"?

  • @bilbolodz It's 1200ms so not very long

  • @Boots33 Sensor is physically offline (no power). I've tried to "turn on" relay. On Domoticz WWW I can see that it's "on". On Mysensors GW logs I can see:

    Turn ON:
    mysgw: Client 1: 1;6;1;0;2;1
    mysgw: !TSF:MSG:SEND,0-0-1-1,s=6,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=NACK:
    mysgw: !TSF:MSG:SIGN FAIL

    Turn OFF:
    mysgw: Client 1: 1;6;1;0;2;0
    mysgw: !TSF:MSG:SEND,0-0-1-1,s=6,c=3,t=16,pt=0,l=0,sg=1,ft=0,st=NACK:
    mysgw: !TSF:MSG:SIGN FAIL

  • @Boots33 I've probably found a bug in Domoticz (beta version). In Setup page I can see that Ack in ON and timeout is 1200ms but it's NOT working (values added from default during device presentation). When I turn off and the on ACK (and save) or change timeout for any other value (and save) "ack detection" start to work (I've got an error without sensor present). Thank you for your help.

  • Hero Member

    @bilbolodz said in Answering request command:

    "ack - Set this to true if you want destination node to send ack back to this node. Default is not to request any ack"

    Does it mean "ask Domoticz to confirm that received my presentation message"?

    I have not used an ack in presentation but yes i think you are correct. Not sure if the ack would be from domoticz or just from the gateway though.

    Great that you also found the problem for the ack flag in domoticz

Log in to reply





Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.