data_template: was deprecated many releases ago in favor of data:. In addition, that’s not the right way to use templates in a data: block, and there are a few other issues. Try this:
alias: CUISINE set state
sequence:
- service: light.turn_on
entity_id: light.bulbes_cuisine_zha_group_0x0005
data:
brightness: >-
{% if state_attr("light.bulbes_cuisine_zha_group_0x0005", "brightness")|float > 128 %}
254
{% else %}
129
{% endif %}
mode: single
The key points are:
Don’t quote a number if you’re trying to compare the magnitude. You’re basically turning it into a string.
Attributes can retain native types, but it’s usually best to convert it to the type you want with a filter (like |float)
Using states(“xxxx.xxx”) and state_attr(“xxx.xx”, “yyy”) is better than using dot notation because it handles unknown/unavailable values better (see warning here)
The data: block allows you to use templates for items within that block.
Templates return a value (can be a native type, like an integer, string, list, etc.), but not a mapping like “xxx: yyy” as you had.