Aqara cube and yeelight brightness

Tags: #<Tag:0x00007f77fc1c0b58>


I’m configuring my aqara cube trough zigbee2mqtt.
I have already configured some others automations, but I’m in stuck with this one.
I want to change the brightness of my yeelight lamp while rotating the cube.

In my automation I have this action:

entity_id: light.luce_soggiorno
service_template: |
    {%if trigger.to_state.state == 'rotate_right' %} 
      brightness: '{{states.light.luce_soggiorno.attributes.brightness + 10}}'
    {% else %} 
      brightness: '{{states.light.luce_soggiorno.attributes.brightness - 10}}'
    {% endif %}

When i rotate the cube I receive this error in the log:
2020-02-15 13:28:35 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.cubo_intensita_luci. Invalid data for call_service at pos 1: Service brightness: ‘109’ does not match format ..

Thanks for your support.