(sharing) Ikea Tradfri blinds (fyrtur and kadrilj) - deconz and multi-actions with the switch

Hi, just sharing here.
What I wanted to do:

  • I have 2 fyrtur on 2 windows above glass door side by side
  • One button only ; making both fyrtur move
  • Single press close = they both go to position 70 (only to cover the window on top of the door
  • Long press close = they both close completely
  • Short or long press “open” - they open completely

[{"id":"9721136876cde12b","type":"deconz-input","z":"234ef87d.c665b8","name":"Blinds","server":"84275c62.5cd71","device":"2c:11:65:ff:fe:14:0f:30-01-1000","device_name":"Blind inside switch : ZHASwitch","topic":"","state":"0","output":"always","outputAtStartup":false,"x":90,"y":3140,"wires":[["bcce902988b12e7f"],[]]},{"id":"085daf091cd64afe","type":"switch","z":"234ef87d.c665b8","name":"Ikea OpenClose","property":"payload.buttonevent","propertyType":"msg","rules":[{"t":"eq","v":"1002","vt":"num"},{"t":"eq","v":"1003","vt":"str"},{"t":"eq","v":"2002","vt":"str"},{"t":"eq","v":"2003","vt":"str"}],"checkall":"true","repair":false,"outputs":4,"x":500,"y":3120,"wires":[["e9db3539a12a0598"],["e9db3539a12a0598"],["4b567ebfab5b509f"],["0143a37ed0ea8e01"]],"outputLabels":["Single open","Long Open Release","Single Close","Long Close Release"]},{"id":"4b567ebfab5b509f","type":"api-call-service","z":"234ef87d.c665b8","name":"70% on short press","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"cover","service":"set_cover_position","areaId":[],"deviceId":[],"entityId":["cover.blindleft"],"data":"{\"position\":71}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":750,"y":3160,"wires":[["25dccf894dad04aa"]]},{"id":"0143a37ed0ea8e01","type":"api-call-service","z":"234ef87d.c665b8","name":"Close Full","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"cover","service":"close_cover","areaId":[],"deviceId":[],"entityId":["cover.blindleft"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":720,"y":3200,"wires":[["b1c0c5e89f627fdc"]]},{"id":"e9db3539a12a0598","type":"api-call-service","z":"234ef87d.c665b8","name":"Open Full","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"cover","service":"open_cover","areaId":[],"deviceId":[],"entityId":["cover.blindleft"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":720,"y":3080,"wires":[["6ab5c312f3020a54"]]},{"id":"6ab5c312f3020a54","type":"delay","z":"234ef87d.c665b8","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":930,"y":3080,"wires":[["e7e3210b5927f988"]]},{"id":"25dccf894dad04aa","type":"delay","z":"234ef87d.c665b8","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":930,"y":3160,"wires":[["336fe0c821cf8b19"]]},{"id":"b1c0c5e89f627fdc","type":"delay","z":"234ef87d.c665b8","name":"","pauseType":"delay","timeout":"100","timeoutUnits":"milliseconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":930,"y":3200,"wires":[["fb1cf92dcba104b3"]]},{"id":"336fe0c821cf8b19","type":"api-call-service","z":"234ef87d.c665b8","name":"70% on short","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"cover","service":"set_cover_position","areaId":[],"deviceId":[],"entityId":["cover.blindleft"],"data":"{\"position\":71}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1110,"y":3160,"wires":[[]]},{"id":"fb1cf92dcba104b3","type":"api-call-service","z":"234ef87d.c665b8","name":"Close Full","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"cover","service":"close_cover","areaId":[],"deviceId":[],"entityId":["cover.blindright"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":3200,"wires":[[]]},{"id":"e7e3210b5927f988","type":"api-call-service","z":"234ef87d.c665b8","name":"Open Full","server":"a0eea9da.0fe1d8","version":5,"debugenabled":false,"domain":"cover","service":"open_cover","areaId":[],"deviceId":[],"entityId":["cover.blindright"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":1100,"y":3080,"wires":[[]]},{"id":"bcce902988b12e7f","type":"debounce-leading-trailing","z":"234ef87d.c665b8","time":"1500","debouncetype":"trailing","name":"Hold in case Long Press","x":290,"y":3140,"wires":[["085daf091cd64afe"]]},{"id":"d25f67c803c61618","type":"comment","z":"234ef87d.c665b8","name":"2 Fyrtur blinds","info":"","x":90,"y":3060,"wires":[]},{"id":"ebaa145022c3a176","type":"comment","z":"234ef87d.c665b8","name":"Deconz and Debounce node- open to read","info":"Deconz\nI am listening to the deconz codes directly in node red instead of via home assistant.  This way I can interept \"rich\" code\n\nYou need to install the function \"deconz\"\n\nOn the hamburger menu on the top right, click \"palette\", then go to \"install\" tab, search for \n\nnode-red-contrib-deconz\nClick install and say yes etc.\n\nThen to configure - read the doc\nhttps://flows.nodered.org/node/node-red-contrib-deconz\n\nand that youtube video\nhttps://www.youtube.com/watch?v=i3TiZiuNofM\n\n\nDebounce:\nYou need to install the function \"debouce\"\n\nOn the hamburger menu on the top right, click \"palette\", then go to \"install\" tab, search for\n\nnode-red-contrib-debounce-leading-trailing\n\nClick install and say yes etc.\n\nWhy this?\n\nWhen you press, let's say, the open button, the switch sends message 1002.\n\nIf you long press, it still send a 1002 code, and only when you release the button, it sends a 1003 code.\n\nThe debounce will \"hold your horses\" for 1.5sec to check if there is a 1003 comming and only send that if it's the case.","x":180,"y":3200,"wires":[]},{"id":"674bc36c19aeccc2","type":"comment","z":"234ef87d.c665b8","name":"Micro Delay","info":"I had random issues when not delaying a bit the action call to the second blind.","x":930,"y":3240,"wires":[]},{"id":"84275c62.5cd71","type":"deconz-server","name":"deoconz","ip":"192.168.86.216","port":"40850","apikey":"8C2FF47893","ws_port":"8081","secure":false,"polling":"15"},{"id":"a0eea9da.0fe1d8","type":"server","name":"GOOD Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":false,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]

A couple of notes: I use the “listen to deconz event” node (in organge at the sart) rather than home assistant. This way I can intercept the codes the switch sends in different modes (long press for example) Check the note in the flow given above.

There’s a magic trick that help me solve some missing config in home assistant. Apparently some don’t have the problem but I coudn’t see the % open for example. This (very geeky but simple) writeup does the trick