Post

How to trigger a Node-RED flow from the Home Assistant UI

I see a lot of people who use Node-RED as their automation engine looking for a way to trigger a flow from the Home Assistant UI. Here’s how I do it.

First I created an empty script.

1
2
3
script:
  good_morning:
    sequence:


And a button in Lovelace.

1
2
3
4
5
6
7
8
9
- type: entity-button
  entity: script.good_morning
  name: "Good Morning"
  icon: mdi:coffee
  tap_action:
    action: call-service
    service: script.turn_on
    service_data:
      entity_id: script.good_morning


Then in Node-RED.


flow


The events: all node checks only events of type call_service.


events


The switch node checks which script was called.


switch


The call-service node turns on my bedroom ceiling lights in a 30 seconds transition.


call-service


When I press the button (below) in the UI or say “Hey Google, good morning” 1 the flow is triggered and the lights turn on.


button


I prefer this approach because I do not like the idea of using input_boolean for this. It would be like using a light switch to activate a doorbell.

  1. The script was exposed to Google Assistant using Home Assistant Cloud↩︎

This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.