Request Value from Node
- 
					
					
					
					
 Hello all, is there a way in the response method to check if is a request? Similar to for example the isACK method, how can I know if the message arriving is a request os if is a message that should actuate the node? Thank you 
 
- 
					
					
					
					
 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. 
 
- 
					
					
					
					
 It is checking if it is a V_VAR1 message, the other messages use different variable types 
 
- 
					
					
					
					
 @gohan I see, it's the same solution that i'm using at the moment, it would be nice to have a flag in the requests replay, that would allow to make a cleaner code, without having to use dummy variables. Thank You @gohan 
 
- 
					
					
					
					
 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 ? 
 
- 
					
					
					
					
 @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. 
 
- 
					
					
					
					
 @mfalkvidd thank you, that will do the job! I leave the ideia to a isReq()!  Thank you all 
 
- 
					
					
					
					
 @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. 
 
- 
					
					
					
					
 @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. 
 
- 
					
					
					
					
 @rozpruwacz yes it is. 
 
- 
					
					
					
					
 I didn't see that before, thanks  
 
 
			
		 
					
				 
					
				