This should be quite easy, but I don't see what's going wrong.
I receive an object. In this object you have the element 'Label' and 'CurrState'.
When labels has the value Sensor and Currstate is True, I just want to pass a '1' to trigger the next action.
I thought I could 'acces' the element label like Payload.Label, but that does not seems to be the case.
Here are some sreenshots;
-
What my object looks like:
-
My actual function, just looking if sensor is in it. If it is I would expect a 1 at the output...
This needs to be expand by also verifying the CurrState
-
What my function gives as output....
[{"id":"ae21c3f.f339a4","type":"zwave-in","z":"154afdd3.672442","name":"MyStick","controller":"49a56b32.da7d44","x":157,"y":117,"wires":[["443ab2c6.2e546c","6951552d.f93a1c"]]},{"id":"6951552d.f93a1c","type":"debug","z":"154afdd3.672442","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":562,"y":115,"wires":},{"id":"443ab2c6.2e546c","type":"function","z":"154afdd3.672442","name":"test","func":"var x = payload.label;\n\nif (x== "Sensor") {\n var msg_o = {payload : 1}\n} else {\n var msg_o = {payload : 0}\n}\nreturn msg_o;\n\n\n","outputs":1,"noerr":0,"x":361,"y":170,"wires":[["64a6f96c.218658"]]},{"id":"64a6f96c.218658","type":"debug","z":"154afdd3.672442","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"Sensor","x":554,"y":178,"wires":},{"id":"49a56b32.da7d44","type":"zwave-controller","z":"","port":"/dev/ttyACM0","driverattempts":"3","pollinterval":"10000","allowunreadyupdates":false,"networkkey":"","logging":true}] Blockquote
Thx for having a look