Hi,
I'm really struggling with understanding the 'msg.payload" with objects.
I'm really looking for this since a while, but I really miss a basic link.
I'm just going to tell what I trie to do:
I'm playing with the homkit node to 'simulate' a locking mechanism.
The input of this node to open the lock needs this:
[{"id":"7ef6ccf3.9e93d4","type":"inject","z":"8a160ea4.9b8d5","name":"Op Slot","topic":"","payload":"{\"LockTargetState\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":253.16671752929688,"y":407.3333854675293,"wires":[["43573fc6.8f4c7"]]}]
The homekit nodes just passes this message.
What I now need to do is to confirm that the lock is actually open.
Therefore I now need this message at the input of the node:
[{"id":"1607c7b0.d4dfb8","type":"inject","z":"8a160ea4.9b8d5","name":"Is Gesloten","topic":"","payload":"{\"LockCurrentState\":1}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":159.0000228881836,"y":716.0000171661377,"wires":[[]]}]
As you can see, I only need to change the text 'LockTargetState' to 'LockCurrentState'.
I wanted to do this 'automatically' with the change function, but thats only for changing the value.
I've tried with a Function. I can analyse the 'input' but I have NO idea how to get a LockCurrentState object at the output.
It's quite simpele but i really don't see it.
Thanks for helping