Hi,
when I try to save the following script, I get the error message
Message malformed: expected float for dictionary value @ data[‘brightness_pct’]
I want this script to have a field for the Brightness. How can I fix this error?
alias: Lichtleiste mit Playlist Smooth einschalten
fields:
helligkeit:
selector:
number:
min: 1
max: 100
required: true
name: Helligkeit
default: 50
sequence:
- type: turn_on
device_id: 9dca05d5eb8f27a9caf77acee5d89776
entity_id: 6f499214e49e9da0b1d21b08872c7faa
domain: light
brightness_pct: "{{ helligkeit }}"
- device_id: 9dca05d5eb8f27a9caf77acee5d89776
domain: select
entity_id: 2ce7477a07403f7d32ed1e7464867f39
type: select_option
option: Smooth
mode: single
icon: mdi:led-strip-variant
Thank you!
tom_l
April 1, 2024, 9:47am
2
Device actions do not support templating. Use the light.turn_on
service instead.
Background
When you start writing automations, a device trigger seems the obvious choice. Everybody knows what a device is and it comes at the top of the UI dropdown list.
[image]
It works… but it is certainly not a “great way to start” because it is storing up problems for the future. Far better to use entity, with state or numeric_state.
Device_id problems
The yaml will be longer and harder to follow, which may make maintenance difficult, especially a few months down the line when you h…
1 Like
Thank you!
Just for me better understanding this issue: why do device actions not support templating?
tom_l
April 1, 2024, 10:03am
4
Device triggers, conditions and actions are designed to be simple and easy to understand for beginners. Thus they do not support more advanced features.
1 Like