Request Value from Node
-
take a look at this https://www.mysensors.org/build/pulse_power
@gohan Ii can see the request:
} else if (sendTime && !pcReceived) { // No pulse count value received. Try requesting it again request(CHILD_ID, V_VAR1); lastSend=now; }But I can't seem to understand where is being processed, in the receive function no validation is preformed to check if it's a request or a actuation. In this case I presume that It's irrelevant (because is a informative node only), but in the case of a nodes with actuators, I need to know if the message that is arriving is a actuator (set) or a request.
-
I am using the pulse power meter but I didn't use any dummy variable. Also the controller plays a role too.
-
@gohan you don't use a dummy variable (VAR_1)? So who do you know when the message arrives if it's a request?
I think that @Soloam is asking how can a gateway request a value from the node not how node can request a value from gateway. If so then You must hadle it in the receive funtion (https://www.mysensors.org/download/sensor_api_20#requesting-data). The request message has distinct command type (https://www.mysensors.org/download/serial_api_20). You can get the message command type with getCommand method - unfortunetly this is not documented ... why ?
-
I think that @Soloam is asking how can a gateway request a value from the node not how node can request a value from gateway. If so then You must hadle it in the receive funtion (https://www.mysensors.org/download/sensor_api_20#requesting-data). The request message has distinct command type (https://www.mysensors.org/download/serial_api_20). You can get the message command type with getCommand method - unfortunetly this is not documented ... why ?
@rozpruwacz You are rigth, I Want GW => Node Request or Node => Node Requests, and I've seen the command type in the notes, but who can I access that command value in the code?
1;1;2;0;2;0 - Requesting Node 1 Child 1 variable V_STATUS, Who do I know that the Command is 2 (request) ?
-
@rozpruwacz You are rigth, I Want GW => Node Request or Node => Node Requests, and I've seen the command type in the notes, but who can I access that command value in the code?
1;1;2;0;2;0 - Requesting Node 1 Child 1 variable V_STATUS, Who do I know that the Command is 2 (request) ?
@soloam looks like you should be able to use mGetCommand and check for C_SET / C_REQ.
-
@soloam looks like you should be able to use mGetCommand and check for C_SET / C_REQ.
@mfalkvidd thank you, that will do the job! I leave the ideia to a isReq()! :)
Thank you all
-
@rozpruwacz You are rigth, I Want GW => Node Request or Node => Node Requests, and I've seen the command type in the notes, but who can I access that command value in the code?
1;1;2;0;2;0 - Requesting Node 1 Child 1 variable V_STATUS, Who do I know that the Command is 2 (request) ?
@soloam said in Request Value from Node:
@rozpruwacz You are rigth, I Want GW => Node Request or Node => Node Requests, and I've seen the command type in the notes, but who can I access that command value in the code?
1;1;2;0;2;0 - Requesting Node 1 Child 1 variable V_STATUS, Who do I know that the Command is 2 (request) ?as I said You need to use getCommand method on the message object.
-
@soloam looks like you should be able to use mGetCommand and check for C_SET / C_REQ.
@mfalkvidd said in Request Value from Node:
@soloam looks like you should be able to use mGetCommand and check for C_SET / C_REQ.
Is this mGetCommand is official API ? because it does not look like. I wouldn't use undocumented methods, because they may disapear in new releases.
-
@mfalkvidd said in Request Value from Node:
@soloam looks like you should be able to use mGetCommand and check for C_SET / C_REQ.
Is this mGetCommand is official API ? because it does not look like. I wouldn't use undocumented methods, because they may disapear in new releases.
-
I didn't see that before, thanks :)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login