Trigger Node to check State

I have a flow that checks the state of a dumb 433mhz controlled gate before trying to open it. If the state is “open” already then it fires an alexa message off to notify that. If it is closed it sets the state to “open”, opens the gate through Broadlink and also sends a notify to Alexa to say “opening gate”

All that works well - but I have a noob question. How do I fire off the flow? It isn’t a switch as I need to check the state first.

[{"id":"456b70ddd09a890a","type":"tab","label":"Open Gate Alexa with check","disabled":false,"info":"","env":[]},{"id":"f9f7605eea290dbd","type":"api-call-service","z":"456b70ddd09a890a","name":"Set Open State","server":"0dcaf950558b2d9f","version":5,"debugenabled":false,"domain":"input_text","service":"set_value","areaId":[],"deviceId":[],"entityId":["input_text.gate_status"],"data":"{\"value\":\"open\"}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":460,"y":340,"wires":[["c9e4aa404e7ad14d"]]},{"id":"1cdc19ce80f7de5d","type":"api-current-state","z":"456b70ddd09a890a","name":"Check if Open","server":"0dcaf950558b2d9f","version":3,"outputs":2,"halt_if":"open","halt_if_type":"str","halt_if_compare":"is","entity_id":"input_text.gate_status","state_type":"str","blockInputOverrides":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"entity"}],"for":"0","forType":"num","forUnits":"minutes","override_topic":false,"state_location":"payload","override_payload":"msg","entity_location":"data","override_data":"msg","x":160,"y":300,"wires":[["39deedb318e0da97"],["f9f7605eea290dbd"]]},{"id":"988a2d365014a0f6","type":"api-call-service","z":"456b70ddd09a890a","name":"Toggle Gate","server":"0dcaf950558b2d9f","version":5,"debugenabled":false,"domain":"script","service":"toggle_gate","areaId":[],"deviceId":[],"entityId":["remote.wi_fi_universal_remote_remote"],"data":"","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":710,"y":400,"wires":[[]]},{"id":"c9e4aa404e7ad14d","type":"api-call-service","z":"456b70ddd09a890a","name":"Opening Gate Alexa Notify","server":"0dcaf950558b2d9f","version":5,"debugenabled":true,"domain":"notify","service":"alexa_media_nick_s_echo_flex","areaId":[],"deviceId":[],"entityId":[],"data":"{\"data\":{\"type\":\"announce\"},\"message\":\"Opening Gate\",\"target\":[media_player.nick_s_echo_flex]}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"all","x":760,"y":340,"wires":[[]]},{"id":"39deedb318e0da97","type":"api-call-service","z":"456b70ddd09a890a","name":"Gate Already Open Alexa Notify","server":"0dcaf950558b2d9f","version":5,"debugenabled":true,"domain":"notify","service":"alexa_media_nick_s_echo_flex","areaId":[],"deviceId":[],"entityId":[],"data":"{\"data\":{\"type\":\"announce\"},\"message\":\"Gate Already Open\",\"target\":[media_player.nick_s_echo_flex]}","dataType":"jsonata","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"all","x":550,"y":180,"wires":[[]]},{"id":"0dcaf950558b2d9f","type":"server","name":"Home Assistant","version":2,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":"30"}]

You need a trigger.
What do you want as your trigger?

Thanks an Alexa voice command and also a Lovelace switch would be ideal

Just create a boolean helper that you turn on to trigger the flow, and turn off at the end of the flow.
This can be toggled from Lovelace, and I assume from Alexa.

1 Like

Perfect thanks!