Hello everyone,
I have created a dropdown, and an automation that calls a script and passes the to_state.state.
The automation works, the script is always called.
The dropdown has several options as (‘Urlaub’ , ‘zu Hause’ , ‘im Büro’)
The script should decide via a choose block from the to_state.state which action to call. But only my default action is triggert.
How can I execute actions in the script depending on the to_state.state of the dropdown?
automation code:
- id: '10000000000005'
alias: Heizungssteuerung
description: ''
trigger:
- platform: state
entity_id:
- input_select.dropd
condition: []
action:
- service: script.set_temperature_all_devices
data:
state: '{{trigger.to_state.state}}'
mode: single'
Script code:
set_temperature_all_devices:
description: set_temperature_all_devices
sequence:
- choose:
- conditions:
- condition: template
value_template: '{{ state == Urlaub }}'
sequence:
- service: mqtt.publish
data:
topic: Testing
payload: '{{ state }}'
default:
- service: persistent_notification.create
data:
title: Testing
message: 'Test: ''{{ state }}''