Mirroring Light Switches - One Works, One Doesnt?

Got one set of lights working but not the other and I can’t figure out why.

I have two different sets of lights in my kitchen, both sets have paddle switches. I also have two different sets of lights in my bedroom, and both of these switches only have one button to toggle on and off. All of these switches are dimmable.

The kitchen lights with the paddle switches work flawlessly, but the automation for the single button toggle switches in the bedroom only work from the Home Assistant UI - not from the switches on the walls. Why would these need a different different coding?

- id: mirror_kitchen_lights
  alias: Mirror Kitchen Lights
  trigger:
    - entity_id:
        - light.kitchen_fridge
        - light.kitchen_sink
      platform: state
  action:
    - delay: 2
    - data_template:
        brightness: "{{ state_attr(trigger.entity_id, 'brightness') | int }}"
      entity_id: light.group_kitchen_lights
      service: homeassistant.turn_on
  mode: single

################################################################################

- id: mirror_master_bedroom_lights
  alias: Mirror Master Bedroom Lights
  trigger:
    - entity_id:
        - light.master_bedroom_lights
        - light.master_hall_light
      platform: state
  action:
    - delay: 2
    - data_template:
        brightness: "{{ state_attr(trigger.entity_id, 'brightness') | int }}"
      entity_id: light.group_master_bedroom_lights
      service: homeassistant.turn_on
  mode: single

Why would the kitchen lights automation work great while the bedroom automation only works from the developer UI? The switches may be different, but the operation is virtually the same.

Where is the condition?
Shouldn’t the condition be [] if empty?

Not required if there are no conditions.

Is there any possibility that some wiring is loose in the bedroom? Is the bedroom a switch and the kitchen a light?

to understand, when you switch light.master_bedroom_lights on in HA the automation triggers?

Exactly. Works from HA, but not with with the physical switch on the wall. (Not a wiring issue. The lights themselves work just fine.)

Can you please provide information what kind of lights and switches are light.master_bedroom_lights and light.master_hall_light and how they are integrated in HA.

Right now i can only think of a problem with the attribute “brightness”, so maybe it’s not set when the action triggers e.g.

Check if:

  • the state of light.master_bedroom_lights and light.master_hall_light changes in HA when you press the physical button

  • the attribute “brightness” is set correctly in light.master_bedroom_lights and light.master_hall_light when you press the physical button

Thanks, Florian. I checked HA’s response to the physical buttons and HA adjusts to state and brightness correctly. I’m actually wondering if it’s related to configuration where I grouped the lights together.

This is my main config file:

################################################################################
#                                                                              #
#                               GROUPED ENTITIES                               #
#                                                                              #
################################################################################

light:
- platform: group
  name: Group Kitchen Lights
  entities:
    - light.kitchen_fridge
    - light.kitchen_sink

- platform: group
  name: Group Master Bedroom Lights
  entities:
    - light.master_bedroom_lights
    - light.master_hall_light

group:
  group_front_lights:
    name: Group Front Lights
    entities:
      - switch.front_light
      - switch.front_porch_light
      
  group_patio_lights:
    name: Group Patio Lights
    entities:
      - switch.master_patio_light
      - switch.patio_lights

As for the switches, the bedroom switches are both Kasa Dimmers, and the kitchen switches are both GE Dimmers. And now that I think about it, the reason they’re different kinds because the kitchen doesn’t have neutral wires, which the GE switches accommodate.

Could be a problem with the TP-Link API. TP-link bulb data on 'turn_on' not happenning? - #4 by jwbtx and TP-Link light can't set brightness via automation - #7 by solomos

Try something like this

- id: mirror_master_bedroom_lights
  alias: Mirror Master Bedroom Lights
  trigger:
    - entity_id:
        - light.master_bedroom_lights
        - light.master_hall_light
      platform: state
  action:
    - delay: 2
    - service: homeassistant.turn_on
      entity_id: light.group_master_bedroom_lights
    - delay: 2
    - data_template:
        brightness: "{{ state_attr(trigger.entity_id, 'brightness') | int }}"
      entity_id: light.group_master_bedroom_lights
      service: homeassistant.turn_on
  mode: single