Variables are ack'ed with messageType M_SET_VARIABLE
I recently started using MySensors and stumbled upon what seems to be a problem when ack'ing a variable sent by the gateway to a sensor.
This variable is sent using M_SET_VARIABLE and is ack'ed in the sensor's sendVariableAck() method by sending a message of type M_SET_VARIABLE.
Setting of the messageType is located in: Sensor::begin(uint8_t _radioId, rf24_pa_dbm_e paLevel, uint8_t channel, rf24_datarate_e dataRate)
ack.header.messageType = M_SET_VARIABLE;
This should be changed into:
ack.header.messageType = M_ACK_VARIABLE;
Or am I missing something?
Hmm. I'm refactoring this as we speak (among other things). In the future message acking will be possible to do between sensors and when sending data to the controller which is missing in the current version.
But the idea is to ask for a ACK and get SET back.
@hek Hmmm... Strange concept to send the ACK first.
I'd expect a gateway which pushes an updated state of e.g. an actuator to an end-node to send a SET and get an ACK back from the end-node.
Yes, that is how it works.
You send a message and ask for an ack back. The receiving node will send set-message back to the sender.
In getStatus the call is passed on to the get method, which sends a REQ and expects an ACK:
return get(GATEWAY_ADDRESS, childId, M_REQ_VARIABLE, M_ACK_VARIABLE, variableType);
That's the other way around, right?
Yes, when sending an request you expect and M_ACK answer back from gateway. (This has changed to a SET back in the version I'm working on now).