Script Error (brightness_pct)

I have a script that I can’t get to work. When executed, I get this error in the log:

expected float for dictionary value @ data[‘brightness_pct’]

The script is defined as follows:

script_br2_brightness:
  sequence: 
    - service: light.turn_on
      data:
        entity_id:  light.01200954ecfabc147b16 #BR2
        brightness_pct: '{{states.input_text.ifttt_number_ingredient.state}}'

I’ve tried casting the state value to int and to float but the error persists.

In the template editor '{{states.input_text.ifttt_number_ingredient.state}}' returns a proper value (e.g. ‘100’).

Can someone help?

Thanks.

Try this:

        brightness_pct: "{{ states('input_text.ifttt_number_ingredient') | float }}"

Change data: to data_template:.

2 Likes

Did the trick. Thank you.

1 Like