Could not get level_template to work

Hello,

i have the following configuration:

livingroom_g:
      friendly_name: Livingroom
      level_template: >-
        {% if states.sensor.gekko_light is defined and states.sensor.gekko_light.attributes['item0'] is defined %}
            {{ state_attr('sensor.gekko_light','item0').split(';')[1]|int }}
        {% else %}
            {{ state_attr('light.livingroom_g','brightness') }}
        {% endif %}  
      value_template: >-
        {% if states.sensor.gekko_light is defined and states.sensor.gekko_light.attributes['item0'] is defined %}
            {% if states.sensor.gekko_light.attributes['item0']['sumstate']['value'].split(';')[0]|float == 1 %}
                on
            {% else %}
                off
            {% endif %} 
        {% else %}
            {{ states('light.livingroom_g') }}
        {% endif %}   
      turn_on: 
        - service: rest_command.rest_gekko_light
          data:
            status: 1
            item: item0
        - service: homeassistant.update_entity
          entity_id: sensor.gekko_light
      turn_off: 
        - service: rest_command.rest_gekko_light
          data:
            status: 0
            item: item0
        - service: homeassistant.update_entity
          entity_id: sensor.gekko_light

But in HomeAssistant no Brightness attribute appears. Even when i put a number to level_template e.g. 128. There is no attribute.
What am i doing wrong ?

The value_template is working fine and the value which i am splitting is something like: “0;100.00;16764280;0;”

Any suggestions ?

Finaly Solved it.
u have to configure the set_level, too.
When u configure this. the britgthness appears.

1 Like

How did you configure the set_level for this light?