Incremental changes to light brightness

I have a question, I think it’s probably simple but I haven’t been able to figure it out. I want to increment the ‘brightness_pct’ of an entity in a script:

sequence:
  - type: turn_on
    device_id: 88415ac2b26a6be2c1258a5f57de5f14
    entity_id: light.smartbulb
    domain: light
    brightness_pct: {{ (state_attr('light.smartbulb', 'brightness') / 255) * 100 + 1}}
    
mode: single
icon: mdi:weather-sunset-up

But I get an error: Message malformed: expected float for dictionary value @ data['brightness_pct']

I’ve confirmed that {{ (state_attr('light.smartbulb', 'brightness') / 255) * 100 + 1}} return a float value using the Developers-> Template interface.

I’m a total noob, it’s possible that I’m going about this the wrong way entirely.
Can anyone point me in the right direction?

You can’t use templates with device actions. Use the light.turn_on service instead.

Quote your single line templates.

Also you should limit the value to 0-255.

1 Like

Thank you.