Switch next to bedroom door and two more at the side of the bed

Dear colleagues,

I have replaced the switch next to the door of my bedroom along with the two switches that are next to my bed. I can turn the ceiling light on and off using the very same switch, but not with differents one. So I went to HA automation and created 6 rules:

  1. If door is switched on, turn on the other 2 switches
  2. If door is switched off, turn off the other 2 switches
  3. If my side switch is switched on, turn on the other 2 switches
  4. If my side switch is switched off, turn off the other 2 switches
  5. If her side switch is switched on, turn on the other 2 switches
  6. If her side switch is switched off, turn off the other 2 switches

However, this sometimes works properly and sometime starts looping.

Any help with this?

Thanks in advance.
(noob) Álvaro

ot sure if it is helpfull, but i have something similar:


alias: Master Bedroom - Sync Lights
description: ""
trigger:
  - platform: state
    entity_id:
      - switch.shelly1_masterbedroom
    from: "off"
    to: "on"
  - platform: device
    type: turned_off
    entity_id: light.masterbedroomleft
    domain: light
condition:
  - condition: time
    after: "21:00:00"
    before: "03:00:00"
action:
  - choose:
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == 'on' }}"
        sequence:
          - service: light.turn_on
            data: {}
            target:
              entity_id:
                - light.masterbedroomright
                - light.masterbedroomleft
      - conditions:
          - condition: template
            value_template: "{{ trigger.to_state.state == 'off' }}"
        sequence:
          - service: switch.turn_off
            target:
              entity_id:
                - switch.shelly1_masterbedroom_input
            data: {}
          - service: light.turn_off
            data: {}
            target:
              entity_id:
                - light.masterbedroomright
                - light.masterbedroomleft
    default: []
mode: single

all of this only applies between 21:00 - 03:00:

  • when main light turned on, turn on mine and hers as well.
  • when my light is switched off, turn off all lights
  • when my light is turned on, only turn on my light
  • Since the logic didn’t get the wife’s approval, when her light is turned on, only turn on her light, when her light is turned off, only turn off her light (so basically just just dumb on/off; however, it is still automated:”Please turn off the lights dear!”:thinking:)

Outside 21:00-03:00 all switches work independently (like dumb switches)

I know it is not exactly the same, but maybe useful for inspiration

Can you post what you’ve got? It’s not clear if you’re currently specifying from “from:” and “to:” for example.

Sorry, but I am very very new and I didn’t explain myself very well. I have 3 switches controlling a single ceiling light. Before using the HA automation screen (not coding yet) if I pushed the door switch the celing light started working. However, I had to use the very same switch to make it stop working. It happened the same in every single switch (one next to my side of the bed and one next to my wife’s side of the bed). I used the automation UI to create automations and please find below the YAML code behind the automation generated via web UI.

alias: iSuitePuerta on otros on
description: ""
trigger:
  - platform: device
    type: turned_on
    device_id: XXXXX1
    entity_id: light.interruptor_puerta_light_5
    domain: light
condition: []
action:
  - type: turn_on
    device_id: XXXXX2
    entity_id: light.tz3000_hhiodade_ts0011_light_4
    domain: light
  - type: turn_on
    device_id: XXXX3
    entity_id: light.interruptor_pao_light_5
    domain: light
mode: single

I created six codes like this one that activates when the door switch goes from off to on (above), one when door goes from off to on, and the same logic for both bed switches (on->off and off->on).