Is there a way to synchronize the state (on/off) and brightness of 3 dimmers?

Currently I have a (dumb) dimmer with 2 extra switches. Basically wired like this:

My idea is to replace the dimmer and 2 switches by smart dimmers (like Candeo or Samotech) and keep then in sync.

The wiring is not a challenge at all:

  • The main dimmer would be connected to the load.
  • The other 2 secondary dimmers would have only L and N connected, and no load at all.

Then I’d synchronize the 3 dimmers.

The first part (state) is simple:

  • When any of the dimmers state change (ON->OFF or OFF->ON)
  • Propagate the state to all the others

The brightness is a challenge, though. First because there is no way other way to set the brightness value besides the TURN_ON action (with a brightness value). Second because the brightness value is NULL when OFF.

I had an idea, but maybe it is a bit overkill.

1 - Create a Helper to keep the brightness value
2 - Secondary dimmers are kept always ON, so when one is switched OFF, an automation turns it back ON and also toggles the main dimmer state.
4 - When the main dimmer is switched ON, an automation immediately calls the TURN_ON action again, with the brightness value kept on the Helper.

I think it would work, but it is a bit of a hassle.

The only limitation would be: The main dimmer can’t be used to adjust the brightness down while OFF. So if turned ON, it could be very bright, which is not ideal for a bedroom.

Any ideas on how to make it better or easier?

EDIT: Apparently the Samotech DOES update the brightness internally when turning the knob while it is OFF.

I managed to make it work. But it is very intricate logic and is a bit slow, unfortunatelly.

The main dimmer is light.dimmer_loft_bedroom_l. The secondary is light.dimmer_loft_bedroom_r. I’m not sure this scales, though.

alias: Dimmers - Sync State
description: ""
triggers:
  - type: turned_off
    device_id: 30dd9160535d68b5e9d3a26502a13eab
    entity_id: 7ca0b763c5cf8d3a2bce380890054722
    domain: light
    trigger: device
conditions: []
actions:
  - variables:
      helper: "{{ states('input_number.loft_bedroom_lights_brightness_helper') | int }}"
  - action: light.turn_on
    target:
      entity_id: light.dimmer_loft_bedroom_r
    data:
      brightness: "{{ helper if helper < 255 else 254 }}"
  - type: toggle
    device_id: 90682d373e932b39863c9779ad1afb13
    entity_id: 87b484b2d1ef29e274c6acd219ce3a5b
    domain: light
mode: queued
max: 10
alias: Loft Bedroom Light - Sync Dimmer Brightness
description: ""
triggers:
  - trigger: state
    entity_id:
      - light.dimmer_loft_bedroom_l
      - light.dimmer_loft_bedroom_r
    attribute: brightness
    id: device_changed
  - trigger: state
    entity_id:
      - input_number.loft_bedroom_lights_brightness_helper
    id: helper_changed
conditions: []
actions:
  - variables:
      main_id: "light.dimmer_loft_bedroom_l"
      sec_id: "light.dimmer_loft_bedroom_r"
      helper_id: "input_number.loft_bedroom_lights_brightness_helper"
  - choose:
      - conditions:
          - condition: trigger
            id:
              - device_changed
        sequence:
          - variables:
              is_dev_main: "{{ trigger.entity_id == main_id }}"
              is_main_on: "{{ states(main_id) == 'on' }}"
              dev_from: "{{ trigger.from_state.attributes.brightness | int(-1) }}"
              dev_to: "{{ trigger.to_state.attributes.brightness | int(-1) }}"
              helper: "{{ states(helper_id) | int(-1) }}"
          - if:
              - condition: template
                value_template: "{{ dev_to != -1 }}"
            then:
              - if:
                  - condition: template
                    value_template: "{{ is_dev_main == true }}"
                then:
                  - if:
                      - condition: template
                        value_template: "{{ dev_from != -1 }}"
                    then:
                      - if:
                          - condition: template
                            value_template: "{{ helper != dev_to }}"
                        then:
                          - action: input_number.set_value
                            data:
                              value: "{{ dev_to }}"
                            target:
                              entity_id: >-
                                input_number.loft_bedroom_lights_brightness_helper
                else:
                  - if:
                      - condition: template
                        value_template: "{{ dev_from != -1 }}"
                    then:
                      - if:
                          - condition: template
                            value_template: "{{ is_main_on == false }}"
                        then:
                          - variables:
                              delta: "{{ dev_to - dev_from }}"
                          - if:
                              - condition: template
                                value_template: "{{ delta >= 0 }}"
                            then:
                              - variables:
                                  delta_adjusted: "{{ delta if delta >= 20 else 20 }}"
                              - action: input_number.set_value
                                data:
                                  value: "{{ delta_adjusted }}"
                                target:
                                  entity_id: >-
                                    input_number.loft_bedroom_lights_brightness_helper
                              - action: light.turn_on
                                target:
                                  entity_id: "{{ main_id }}"
                                data:
                                  brightness: "{{ delta_adjusted }}"
                              - action: light.turn_on
                                target:
                                  entity_id: "{{ sec_id }}"
                                data:
                                  brightness: "{{ delta_adjusted }}"
                        else:
                          - if:
                              - condition: template
                                value_template: "{{ helper != dev_to }}"
                            then:
                              - action: input_number.set_value
                                data:
                                  value: "{{ dev_to }}"
                                target:
                                  entity_id: >-
                                    input_number.loft_bedroom_lights_brightness_helper
      - conditions:
          - condition: trigger
            id:
              - helper_changed
        sequence:
          - variables:
              helper_from: "{{ trigger.from_state.state | int(-1) }}"
              helper_to: "{{ trigger.to_state.state | int(-1) }}"
              main: "{{ state_attr(main_id, 'brightness') | int(-1) }}"
              sec: "{{ state_attr(sec_id, 'brightness') | int(-1) }}"
              is_main_on: "{{ states(main_id) == 'on' }}"
          - if:
              - condition: template
                value_template: "{{ helper_to != sec }}"
            then:
              - action: light.turn_on
                target:
                  entity_id: light.dimmer_loft_bedroom_r
                data:
                  brightness: "{{ helper_to }}"
          - if:
              - condition: template
                value_template: "{{ is_main_on and main != helper_to }}"
            then:
              - action: light.turn_on
                target:
                  entity_id: "{{ main_id }}"
                data:
                  brightness: "{{ helper_to }}"
mode: queued
max: 10

There are some corner cases, like when main is OFF, but the previous value set is 255 (max). The secondary dimmer won’t generate any events when turning clockwise. So I force the value to 1 before maximum when turning off.

Would be happy to see a better solution. :slight_smile:

I think this does the job, besides being a much more elegant solution: