Script with field leads to "Message malformed" error

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!

Device actions do not support templating. Use the light.turn_on service instead.

1 Like

Thank you!

Just for me better understanding this issue: why do device actions not support templating?

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