sendBatteryLevel: wrong nodeId?
-
Hi.
My battery powerd sensor node is connected to OpenHAB via mqtt/ethernet gateway. The switch works well in OpenHAB. But not the battery level.
For testing every time the switch changed a hardcoded value of "77" is send after the switch message.
Log MQTT-Gateway:
Started!
0;0;3;0;9;read: 26-26-0 s=4,c=1,t=16,pt=2,l=2:0
0;0;3;0;9;read: 26-26-0 s=255,c=3,t=0,pt=1,l=1:77
0;0;3;0;9;read: 26-26-0 s=4,c=1,t=16,pt=2,l=2:1
0;0;3;0;9;read: 26-26-0 s=255,c=3,t=0,pt=1,l=1:77
The PC-MQ-Client MQTT.fx also only shows the switch messages.
The nodeId is 4. Why is there "255" in line 2 and 4? Or is this OK?
-
bump
I also wonder what the S, T, PT & L values stand for..
i see them coming and going but never understood what they are here forhappy new year!
-
s=child-sensor-id,
c=message-type
t=sub-type
pt=payload-type (see MyMessage.h)
l=payload lengthYou will understand it better if you have a look at the code:
https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/MyMessage.h#L175
https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/MySensor.cpp#L273
https://github.com/mysensors/Arduino/blob/master/libraries/MySensors/MySensor.cpp#L220
-
@hek
Thanks for reply.
I know the meaning of "s". But I was wondering about the value "255". Is this OK? I think it should be "4" - the value of "CHILD_ID" in my sketch.
-
sensor id is not the same as node id.
sensor id = 255 is used for internal stuff like id request and battery level for node. You can assign 0-254 to your own attached sensors (to the arduino node).