Setting HomeMatic dimmers to last dim value

Just to share my findings, so maybe someone else will find the solution faster…

I have a HomeMatic dimmer set up to return to the last dim value whenever it is switched on:

  • I hold and press the switch on the wall: The dimmer sets a brightness of, say, 50%.
  • I push the switch on the wall: The light turns off.
  • I push the switch on the wall again: The light returns to its last dim value, i.e., 50% (as opposed to 100%).

That seemed useful, since the light is really much too bright at its full brightness.

However, now I wanted to automate (toggle) the lights the same way as my switch on the wall does. Unfortunately, Home Assistant would always set the brightness to 100%, when turning the light on. (Which is the default behavior of HomeMatic devices, too. So, all good.) Fortunately, the HomeMatic integration allows to send low-level commands to the devices. So, here is what I set up to make the dimmer return to its last dim level:

      - if:
        - condition: device
          type: is_on
          device_id: [redacted]
          entity_id: light.wohnzimmer_sofalicht
          domain: light
        then:
        - type: turn_off
          device_id: [redacted]
          entity_id: light.wohnzimmer_sofalicht
          domain: light
        else:
        - service: homematicip_local.set_device_value
          data:
            device_id: [redacted]
            channel: 1
            parameter: OLD_LEVEL
            value: true

The key here is to use the set_device_value service for the datapoint OLD_LEVEL. I’m using this with the new homematicip_local integration. But I believe the built-in integration has a similar service.

I hope, this helps someone. And if you have a smarter solution to the challenge, let me know!

1 Like

Hello,

Thank you for this information. Can you tell me where exactly I need to set this up? I’m new to HA and have the exact same problem. Do I have to set this up as an automation or as a script?

Thank you very much for your help.

It’s a snippet you can use anywhere where the “script syntax” is allowed. So, e.g. in scripts and in automation actions. You’ll have to activate YAML mode. Make sure to insert the right device IDs. I think it’s the home assistant device IDs twice and then the HomeMatic id once.

You can also select the blocks in the UI, if course.

Thanks! I got it - via automation actions over the web ui.

Yep. And I checked: it’s always the HA device ID.