Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106517

2021.04 breaking changes and catching "RUN ACTIONS"

$
0
0

I have a project that makes extensive use of blueprints, and several of those rely on the user pressing “RUN ACTIONS” as part of the first-time initialization workflow.

Previously, I could catch this in a blueprint with the template {{ trigger is not defined }} in a choose block and go on about my way. With the 2021.04 release this approach no longer works and instead errors out. What I’m trying to do now is to replace that logic but cannot seem to find the magic test that will reliably do so.

Here’s an example blueprint:

blueprint:
  name: "RUN ACTIONS test blueprint"
  domain: automation
trigger: []

action:
  - service: mqtt.publish
    data:
      topic: "debug"
      payload: "test1: {{ trigger | default('foo') }}"
  - service: mqtt.publish
    data:
      topic: "debug"
      payload: "test2: {{ trigger.platform | default('foo') }}"
  - service: mqtt.publish
    data:
      topic: "debug"
      payload: "test3: {% if trigger.platform == 'None' %}foo{% else %}bar{% endif %}"
  - service: mqtt.publish
    data:
      topic: "debug"
      payload: "test4: {% if trigger.platform == '' %}foo{% else %}bar{% endif %}"

The results published to MQTT look like this:

test1: {'platform': None}
test2: None
test3: bar
test4: bar

Further complicating things is that the change also suggests this behavior is going to change again with the 2021.10 release. As a result, I’m hoping to find a solution that will work today, and also hopefully not break in 6 months when the behavior changes once again.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106517

Trending Articles