#Button to controll one two way switch and regular switch?

15 messages · Page 1 of 1 (latest)

junior flame
#

Hi,

I have two smart relays controlling lights.

One is in the Hallyway controlled by a two way switch
One is in the living room controlled by a regular switch

I have a wireless button that i want to put close to my entrance door so i can do the following.

One press -> toggle both the ligths in the living room and hallway
Long Press -> turn off all lights

I managed to do that but i get some issues.

If i manually turn on one of the lights from one of the switch, now toggling with the wireless btn flips the state of both lights.

Idk if it is clear enough.

Thanks for you help 🙏

toxic iris
#

If one is on, and the other is off, what should the "toggle" do?

junior flame
#

Yes you are right. But this is not exactly the behaviour that i want

toxic iris
#

What do you want?

junior flame
#

i guess i need the wireless btn to remember its state -> on or off so it can controll both lights based on that

toxic iris
#

Switch toggles an input_boolean

Use the state of the boolean to decide the state of the lights

junior flame
#

do i need multiple automations for that?

#

so i have this so far

toxic iris
#

You could do it in one ugly one

#

Separate ones would be a lot simpler

junior flame
#
alias: Toggle main switch
description: ""
trigger:
  - device_id: ed291845a49c0030b1c8303a8b1a5c15
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: button
condition: []
action:
  - action: input_boolean.toggle
    metadata: {}
    data: {}
mode: single
#

but how do i reference the toggle into my automation

#

ok i got it working

alias: Toggle main switch
description: ""
trigger:
  - device_id: ed291845a49c0030b1c8303a8b1a5c15
    domain: zha
    platform: device
    type: remote_button_short_press
    subtype: button
condition: []
action:
  - action: input_boolean.toggle
    metadata: {}
    data: {}
    target:
      entity_id: input_boolean.main_switch_toggle
  - if:
      - condition: state
        entity_id: input_boolean.main_switch_toggle
        state: "on"
    then:
      - type: turn_on
        device_id: 86418123b1b5a71926909c715095abf0
        entity_id: 293f79a24fc1498cf5dfc17031dc1874
        domain: switch
      - type: turn_on
        device_id: 973ba4b1e2ec225eb1b52293797166ad
        entity_id: e9eec8f08def773423c7762c42f29e8b
        domain: switch
    else:
      - type: turn_off
        device_id: 86418123b1b5a71926909c715095abf0
        entity_id: 293f79a24fc1498cf5dfc17031dc1874
        domain: switch
      - type: turn_off
        device_id: 973ba4b1e2ec225eb1b52293797166ad
        entity_id: e9eec8f08def773423c7762c42f29e8b
        domain: switch
mode: single```
#

and so i also had to change my turn off everything automation to update the boolean

alias: Turn off everything
description: ""
trigger:
  - device_id: ed291845a49c0030b1c8303a8b1a5c15
    domain: zha
    platform: device
    type: remote_button_long_press
    subtype: button
  - device_id: 77a6ec0dbc1c65f64fd10ea55f53a2d6
    domain: zha
    platform: device
    type: remote_button_long_press
    subtype: button
condition: []
action:
  - parallel:
      - type: turn_off
        device_id: 0cffe0a7b637440f208f87260759cbea
        entity_id: b2334d57ce9d4846aaa3acc2fe5592b4
        domain: switch
      - type: turn_off
        device_id: 973ba4b1e2ec225eb1b52293797166ad
        entity_id: e9eec8f08def773423c7762c42f29e8b
        domain: switch
      - type: turn_off
        device_id: 86418123b1b5a71926909c715095abf0
        entity_id: 293f79a24fc1498cf5dfc17031dc1874
        domain: switch
      - action: input_boolean.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: input_boolean.main_switch_toggle
mode: single