Increase Brightness of Hue lights with Hue dimmer

Hi,

I am trying to set my hue dimmer switches to increase/decrease the brightness of the light in the room but the code I’ve implemented is throwing an error:

homeassistant.exceptions.TemplateError: UndefinedError: 'mappingproxy object' has no attribute 'brightness'

This is the code:

  - alias: "Increase Brightness of Office"
    trigger:
      - platform: mqtt
        topic: hue/office_switch/buttonevent
        payload: '2002'
    action:
      - service: light.turn_on
        entity_id: group.office_light
        data_template:
          brightness: '{{ states.group.office_light.attributes.brightness + 10 }}'

The light is already on when I hit the switch / get the error. Any suggestions much appreciated.

Groups don’t have an associated brightness (like you use in your template). Use a single light entity.

Also - Looks like you’re using light.turn_on with a group entity. Light.turn_on will want a light. You may be able to fix this by using homeassistant.turn_on - in many cases, it’s smart enough to figure out what you mean. But I don’t think you’ll be able to set a brightness for a group.

Actually you can, but it doesn’t report it back in the group’s status which can cause issues.