Hi,
thanks, the move works fine. I've tried with 'change' earlier, but that didn't had succes.
I've read the info on that page several times, but like I said, I'm missing something. Im used to program a plc with all kinds of variables. But there we don't talk about a payload. You have a variable type and it's value. Now you have the payload, that has his own variables and then the values.? I don't always understand how to 'talk' to it. Would it be possible to do the same with a change? Just look in the 'whole' payload and then change the texts?
So, 50% of the jobs is done.
I send to the homekit node (to open the door) LockTargetState : 1 and with the move and a delay I confirm by sending LockCurrentState : 1
But now it should also inmedialtely close the lock again, and confirm this. So now I need to send a LockTargetState : 0 if a LockCurrentState : 1 is passed.
I have written a funcition for that, but it is not doing what I want. It's doing notting actually.
So summary:
I send LockTargetState : 1 and the next steps should happen automatically:
==> 500ms LockCurrentState : 1 ==> 500ms ==> LockTargetState : 0 ==> 500ms ==> LockCurrentState : 0
The move is the part under the homekit function, the 'function' the part above the homekit function.
My code:
[{"id":"a8e59e67.fe4f3","type":"inject","z":"8a160ea4.9b8d5","name":"Openen","topic":"","payload":"{\"LockTargetState\":0}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":179.00017547607422,"y":207.0002088546753,"wires":[["9f7f567d.122ea8"]]},{"id":"9f7f567d.122ea8","type":"homekit-service","z":"8a160ea4.9b8d5","accessory":"385e4065.8d274","name":"","serviceName":"LockMechanism","x":668.1666793823242,"y":209.3333396911621,"wires":[["5f161fa4.2bf1f","e172923c.c2f4","81321b85.40edc8"]]},{"id":"5f161fa4.2bf1f","type":"change","z":"8a160ea4.9b8d5","name":"Bevestiging Actie","rules":[{"t":"move","p":"payload.LockTargetState","pt":"msg","to":"payload.LockCurrentState","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":593.1668548583984,"y":318.33346366882324,"wires":[["357c3a4f.c43626"]]},{"id":"357c3a4f.c43626","type":"delay","z":"8a160ea4.9b8d5","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":787.0000305175781,"y":315.00000762939453,"wires":[["9f7f567d.122ea8"]]},{"id":"e172923c.c2f4","type":"function","z":"8a160ea4.9b8d5","name":"V","func":"var x = msg.payload.CurrentState;\nvar y = {\"LockTargetState\" :1};\n\nif (x== \"1\") {\n msg = y;\n}\nreturn msg\n \n","outputs":1,"noerr":0,"x":608,"y":114,"wires":[["a22b4603.d60548"]]},{"id":"a22b4603.d60548","type":"delay","z":"8a160ea4.9b8d5","name":"","pauseType":"delay","timeout":"500","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":812,"y":113,"wires":[["9f7f567d.122ea8"]]},{"id":"81321b85.40edc8","type":"debug","z":"8a160ea4.9b8d5","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1033.0000305175781,"y":209.0000057220459,"wires":[]},{"id":"385e4065.8d274","type":"homekit-accessory","z":"","accessoryName":"Zijdeur","pinCode":"111-11-111","port":"","manufacturer":"Default Manufacturer","model":"Default Model","serialNo":"Default Serial Number","accessoryType":"12"}]