Using a variable in scripts with brightness_pct

Because a Device Action’s brightness_pct option doesn’t support templates. That’s what the error message indicates; it only accepts a float value (i.e. a number).

Because you have been doing the software equivalent of hammering a square peg into a round hole. You need to use a round peg, like a service call. :slightly_smiling_face:

Use a service call, like this:

- service: light.turn_on
  target:
    entity_id: light.boob_light
  data:
    brightness_pct: '{{ states("var.light_pct") }}'

As long as the value of var.light_pct is a numeric string, Home Assistant’s native typing will convert it to a number so there’s no need to use an int filter in the template.