I have a zigbee 3 gang with a left over switch I’ve linked to a WiFi bulb. Base automation on & off via app or physical touch works fine. My issue starts where conditions for how the lamp should turn on aren’t working.
When turned on by the switch, it completely disregards any of the 4 actions laid out. Using I f-then conditions for a singular action work fine but I’ll not be able to stack the other 3 action choices if I do this.
Just had a thought as I typed this; should I keep the switch link confined to on-off & apply conditions to the bulb itself in a separate automation?
alias: Switch link (Main Hall Lamp)
description: ""
trigger:
- platform: state
entity_id:
- switch.main_hall_outside_lights_back_and_side_l2
from: "on"
to: "off"
id: MainL2OnToOff
- platform: state
entity_id:
- switch.main_hall_outside_lights_back_and_side_l2
from: "off"
to: "on"
id: MainL2OffToOn
- platform: state
entity_id:
- light.main_hall_lamp
from: "on"
to: "off"
id: MainHallLampOff
- platform: state
entity_id:
- light.main_hall_lamp
from: "off"
to: "on"
id: MainHallLampOn
condition: []
action:
- parallel:
- choose:
- conditions:
- condition: trigger
id:
- MainL2OnToOff
sequence:
- service: light.turn_off
data: {}
target:
entity_id: light.main_hall_lamp
- conditions:
- condition: trigger
id:
- MainL2OffToOn
sequence:
- choose:
- conditions:
- condition: sun
before: sunset
after: sunrise
sequence:
- service: light.turn_on
data:
brightness_pct: 90
kelvin: 6500
target:
entity_id: light.main_hall_lamp
- conditions:
- condition: numeric_state
entity_id: sensor.mmwave_sensor_1_illuminance_lux
below: 50
enabled: false
- condition: or
conditions:
- condition: state
entity_id: media_player.main_hall_cast
state: playing
- condition: state
entity_id: media_player.playstation_4
state: "on"
- condition: state
entity_id: media_player.main_hall_cast
state: buffering
- condition: state
entity_id: media_player.main_hall_cast
state: paused
- condition: state
entity_id: media_player.playstation_4
state: playing
- condition: state
entity_id: media_player.playstation_4
state: paused
sequence:
- service: light.turn_on
data:
brightness_pct: 10
kelvin: 2446
target:
entity_id: light.main_hall_lamp
- conditions:
- condition: and
conditions:
- condition: sun
after: sunset
- condition: time
before: "20:30:00"
sequence:
- service: light.turn_on
data:
brightness_pct: 90
kelvin: 2770
target:
entity_id: light.main_hall_lamp
- conditions:
- condition: sun
before: sunrise
after: sunset
enabled: false
- condition: time
after: "20:30:00"
before: "07:00:00"
sequence:
- service: light.turn_on
data:
brightness_pct: 25
kelvin: 2345
target:
entity_id: light.main_hall_lamp
- choose:
- conditions:
- condition: trigger
id:
- MainHallLampOff
sequence:
- service: switch.turn_off
data: {}
target:
entity_id:
- switch.main_hall_outside_lights_back_and_side_l2
- conditions:
- condition: trigger
id:
- MainHallLampOn
sequence:
- service: switch.turn_on
data: {}
target:
entity_id:
- switch.main_hall_outside_lights_back_and_side_l2
mode: single