Trouble with a template

Hi,

I’m using HA to control a couple of Z-Wave devices: a Leviton light switch and a GE dimmer. HA is working on my Raspberry Pi, and I can use the Web GUI to control the devices. I have also installed LIRC and am able to turn on and off the dimmer using an infrared remote. What I have been unable to do, and what I would like to do, is change the brightness of the dimmer using a button on the IR remote.

I’ve been trying to follow the instructions in this Community posting: https://community.home-assistant.io/t/incremental-increase-of-light-brightness/8932. However, I can’t get the template to work.

Here’s the relevant part of the configuration.yaml:

- alias: Raise Dimmer Brightness
  trigger:
    platform: event
    event_type: ir_command_received
    event_data:
      button_name: KEY_RIGHT
  action:
    service: light.turn_on
    entity_id: light.ge_12724_3way_dimmer_switch_level_3_0
    data_template:
      brightness: '{{states.light.ge_12724_3way_dimmer_switch_level_3_0.attributes.brightness + 10}}'

When I press the right arrow button on the IR remote, this message comes up:

17-02-23 22:09:03 ERROR (MainThread) [homeassistant.core] Invalid service data for light.turn_on: expected int for dictionary value @ data['brightness']. Got '58.93939393939394'

The IR command is being received, there’s just something wrong with the syntax in the template. Can you help set me to rights?

Thank you.

try

 brightness: '{{states.light.ge_12724_3way_dimmer_switch_level_3_0.attributes.brightness | int + 10}}'

so, insert " | int" before “+ 10”

1 Like

Thank you very much, m0wlheld. Your answer solved the problem! I can now control brightness/dimness incrementally.

Cheers!