Node-red-websock - switch entity with IFTTT

Hi,
I have a myq garage door. The myq integration is regularly broken by changes to the web API, so I’ve replaced it with an IFTTT recipe. Thank you all myq devs who rapidly reverse engineer a fix, but I want it to work all the time.

With 3 IFTTT recipes (open -> web socket, close -> web socket, web socket -> open) and a node-red flow, I can create an HA switch which reflects the current door state and can close the door. The IFTTT myq service does not allow for opening the door and that’s OK with me.

  1. Maybe this helps folks who want to connect an IFTTT device into HA. This setup is working well for me.
  2. When a status update comes in, I set the switch to the correct state. The switch change then triggers an event, and I use a timestamp to filter out these activations from causing a new IFTTT request. Does @Kermit or anyone have a more direct way to handle this filtering?

Thanks,

[{"id":"48991bc0.155844","type":"tab","label":"IFTTT: myQ","disabled":false,"info":""},{"id":"fc912a7e.4037c","type":"server-events","z":"48991bc0.155844","name":"","server":"1777b72c.cb0709","event_type":"ifttt_webhook_received","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"x":150,"y":180,"wires":[["a9810914.962f88"]]},{"id":"a9810914.962f88","type":"switch","z":"48991bc0.155844","name":"","property":"payload.event.door","propertyType":"msg","rules":[{"t":"eq","v":"Garage Door","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":370,"y":180,"wires":[["a232022f.0b1478","d5d3c2a1.2d092"]]},{"id":"a232022f.0b1478","type":"switch","z":"48991bc0.155844","name":"","property":"payload.event.status","propertyType":"msg","rules":[{"t":"eq","v":"open","vt":"str"},{"t":"eq","v":"closed","vt":"str"}],"checkall":"true","repair":false,"outputs":2,"x":490,"y":180,"wires":[["52c82560.4094f4","d601b6a0.9f837"],["474c1cc1.c58984","f45f862a.32df6"]]},{"id":"474c1cc1.c58984","type":"api-call-service","z":"48991bc0.155844","name":"","server":"1777b72c.cb0709","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_off","entityId":"switch.garage_door","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":830,"y":260,"wires":[[]]},{"id":"52c82560.4094f4","type":"api-call-service","z":"48991bc0.155844","name":"","server":"1777b72c.cb0709","version":1,"debugenabled":false,"service_domain":"switch","service":"turn_on","entityId":"switch.garage_door","data":"","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":830,"y":180,"wires":[[]]},{"id":"773ef2cc.5995bc","type":"server-state-changed","z":"48991bc0.155844","name":"","server":"1777b72c.cb0709","version":1,"exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityidfilter":"switch.garage_door","entityidfiltertype":"exact","outputinitially":false,"state_type":"str","haltifstate":"","halt_if_type":"str","halt_if_compare":"is","outputs":1,"output_only_on_state_change":true,"x":160,"y":400,"wires":[["5af704ca.9d65cc"]]},{"id":"d601b6a0.9f837","type":"debug","z":"48991bc0.155844","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":790,"y":160,"wires":[]},{"id":"f45f862a.32df6","type":"debug","z":"48991bc0.155844","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":790,"y":240,"wires":[]},{"id":"d5d3c2a1.2d092","type":"change","z":"48991bc0.155844","name":"","rules":[{"t":"set","p":"received","pt":"flow","to":"$millis()","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":120,"wires":[[]]},{"id":"5af704ca.9d65cc","type":"switch","z":"48991bc0.155844","name":"filter webhooks","property":"received","propertyType":"flow","rules":[{"t":"lt","v":"$millis() - 1500","vt":"jsonata"}],"checkall":"true","repair":false,"outputs":1,"x":420,"y":400,"wires":[["26adbc62.3823a4"]]},{"id":"a2d1d53b.81332","type":"inject","z":"48991bc0.155844","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":110,"y":120,"wires":[["d5d3c2a1.2d092"]]},{"id":"f1bc1ef1.be26a8","type":"comment","z":"48991bc0.155844","name":"Open is not an option on IFTTT (and that's OK for security)","info":"","x":770,"y":360,"wires":[]},{"id":"26adbc62.3823a4","type":"switch","z":"48991bc0.155844","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"off","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":610,"y":400,"wires":[["8f9dae24.cf348"]]},{"id":"8f9dae24.cf348","type":"api-call-service","z":"48991bc0.155844","name":"","server":"1777b72c.cb0709","version":1,"debugenabled":false,"service_domain":"ifttt","service":"trigger","entityId":"","data":"{\"event\":\"close_garage_door\"}","dataType":"json","mergecontext":"","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":800,"y":400,"wires":[[]]},{"id":"515c3453.f97e7c","type":"inject","z":"48991bc0.155844","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":100,"y":40,"wires":[["3e74f12.292e98e"]]},{"id":"3e74f12.292e98e","type":"ha-entity","z":"48991bc0.155844","name":"","server":"1777b72c.cb0709","version":1,"debugenabled":false,"outputs":2,"entityType":"switch","config":[{"property":"name","value":"garage_door"},{"property":"device_class","value":""},{"property":"icon","value":"mdi:garage"},{"property":"unit_of_measurement","value":""}],"state":"payload","stateType":"msg","attributes":[],"resend":true,"outputLocation":"","outputLocationType":"none","inputOverride":"allow","x":270,"y":40,"wires":[[],[]]},{"id":"1777b72c.cb0709","type":"server","z":"","name":"Home Assistant","legacy":false,"addon":true,"rejectUnauthorizedCerts":true}]
1 Like