Hi
I’m struggling with the following automation / actionable notification, any help is appreciated!
The error is
Message malformed: template value should be a string for dictionary value @ data['action'][1]['then'][8]['data']
I don’t know what is causing this?
the code:
alias: test
description: ""
trigger:
- platform: numeric_state
entity_id:
- sensor.xiaomi_humidity
for:
hours: 0
minutes: 15
seconds: 0
above: 55
id: "1"
action:
- variables:
action_wtw_low: {{ "WTW_LOW" ~ context.id }}
action_wtw_high: {{ "WTW_HIGH" ~ context.id }}
action_do_nothing: {{ "DO_NOTHING" ~ context.id }}
- if:
- condition: trigger
id:
- "1"
then:
- service: notify.family
data:
title: WTW level.
message: make a choice.
data:
actions:
- action: {{action_wtw_low}}
title: WTW low
- action: {{action_wtw_high}}
title: WTW high
- action: {{action_do_nothing}}
title: Do nothing
- delay:
hours: 0
minutes: 0
seconds: 30
milliseconds: 0
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: {{action_wtw_low}}
- platform: event
event_type: mobile_app_notification_action
event_data:
action: {{action_wtw_high}}
- platform: event
event_type: mobile_app_notification_action
event_data:
action: {{action_do_nothing}}
timeout: "00:01:00"
- choose:
- conditions:
- condition: template
value_template: {{ wait.trigger.event.data.action in [ action_wtw_low ] }}
sequence:
- service: fan.set_preset_mode
data:
preset_mode: low
target:
entity_id: fan.wtw_ventilation
- choose:
- conditions:
- condition: template
value_template: {{ wait.trigger.event.data.action in [ action_wtw_high ] }}
sequence:
- service: fan.set_preset_mode
data:
preset_mode: high
target:
entity_id: fan.wtw_ventilation
- service: notify.familiy
data:
message: |
{% if wait.trigger.event.data.action == action_wtw_low %}
WTW to low
{% elif wait.trigger.event.data.action == action_wtw_high %}
WTW to high
{% else %}
Nothing is happened.
title: Wtw
mode: single
I think it’s because of the template line
but when I try to use something like this, the error is the same unfortunately
value_template: '{{ wait.trigger.event.data.action == action_wtw_low }}'
Also when I remove the quotes.