Ok, gotcha. So you might be able to use a Template Light for this. Basically you create a new light entity (light.scaled_light
) that you would use directly, and it acts on the “real” light the way you define. Something like:
light:
- platform: template
lights:
scaled_light:
level_template: >
{% if is_state('light.real_light', 'on') %}
{{ ((state_attr('light.real_light', 'brightness')|float-255*0.6)/0.4)|round }}
{% else %}
0
{% endif %}
turn_on:
service: light.turn_on
entity_id: light.real_light
turn_off:
service: light.turn_off
entity_id: light.real_light
set_level:
service: light.turn_on
entity_id: light.real_light
data_template:
brightness: "{{ (brightness|float*0.4 + 255*0.6)|int }}"