I recently bought a aqara cube. I want to use the cube to set a dimmer to a brighter level when I move it. I believe I need a template to do that, since I need to get the current brightness level and make it higher.
I created this automation for it:
- alias: cube dimmer woonkamer feller
trigger:
platform: event
event_type: xiaomi_aqara.cube_action
event_data:
entity_id: binary_sensor.cube_woonkamer
action_type: move
action:
- service: homeassistant.turn_on
entity_id: light.dimmerwoonkamer_level
data:
brightness: "{{ (state_attr('light.dimmerwoonkamer_level','brightness') + 25) }}"
Unfortunately, when I now trigger the automation, I get this error: voluptuous.error.MultipleInvalid: expected int for dictionary value @ data[‘brightness’]
Apparently the value is not seen as an int. When I cast it to a int like this:
brightness: "{{ (state_attr('light.dimmerwoonkamer_level','brightness') + 25) | int }}"
I still get the same error. I saw some suggestions around here that the quotes should be removed, but when I do that I get this error in the log:
ERROR (MainThread) [homeassistant.components.automation] while parsing a flow mapping
in “/home/nuc/.homeassistant/automations.yaml”, line 1811, column 22
expected ‘,’ or ‘}’, but got ‘’
I’ve also tried this approach:
brightness: {{ states.light.dimmerwoonkamer_level.attributes.brightness + 25 }}
But that gives me the error:
ERROR (Thread-11) [homeassistant.util.yaml] invalid key: “OrderedDict([(‘states.light.dimmerwoonkamer_level.attributes.brightness + 25’, None)])”
in “/home/nuc/.homeassistant/automations.yaml”, line 1811, column 0
When I put quotes around it, I’m back at this error again: voluptuous.error.MultipleInvalid: expected int for dictionary value @ data[‘brightness’]
All templates do work in the template editor, so I’m a bit puzzled at where I’m going wrong. Any ideas?