I have this automation of light where changing of brightness can happen in two ways:
- There is motion, it is below a lux threshold and the light was already off
- The light is already on but my sensor “day interval” changes, so that is input to a brightness change
The above two goes into each “Choose” action, but that also means that I define all brightness twice. Can I somehow avoid that?
alias: Lys - Entré
description: ""
trigger:
- platform: state
entity_id:
- binary_sensor.ophold
from: "off"
to: "on"
id: turn_on
- platform: numeric_state
entity_id: sensor.hue_motion_2_illuminance_lux
for:
hours: 0
minutes: 3
seconds: 0
below: input_number.luxgraense
id: lux_low
- platform: state
entity_id:
- binary_sensor.ophold
from: "on"
to: "off"
id: turn_off
for:
hours: 0
minutes: 10
seconds: 0
- platform: numeric_state
entity_id: sensor.hue_motion_2_illuminance_lux
for:
hours: 0
minutes: 3
seconds: 0
above: input_number.luxgraense
id: lux_high
- platform: state
entity_id:
- sensor.day_interval
id: day_interval
condition:
- condition: state
entity_id: input_boolean.automation_status
state: "on"
action:
- alias: Tænd
choose:
- conditions:
- condition: trigger
id:
- turn_on
- lux_low
- condition: numeric_state
entity_id: sensor.hue_motion_2_illuminance_lux
below: input_number.luxgraense
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "off"
alias: Confirm entrelys er slukket
- condition: state
entity_id: input_boolean.aut_entre
state: "off"
alias: Confirm entre boolean fra
- condition: state
entity_id: binary_sensor.ophold
state: "on"
- condition: state
entity_id: sensor.day_interval
state: morgen1
sequence:
- service: light.turn_on
data:
brightness_pct: 20
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- conditions:
- condition: trigger
id:
- turn_on
- lux_low
- condition: numeric_state
entity_id: sensor.hue_motion_2_illuminance_lux
below: input_number.luxgraense
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "off"
alias: Confirm entrelys er slukket
- condition: state
entity_id: input_boolean.aut_entre
state: "off"
alias: Confirm entre boolean fra
- condition: state
entity_id: binary_sensor.ophold
state: "on"
- condition: state
entity_id: sensor.day_interval
state: morgen2
sequence:
- service: light.turn_on
data:
brightness_pct: 40
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- conditions:
- condition: trigger
id:
- turn_on
- lux_low
- condition: numeric_state
entity_id: sensor.hue_motion_2_illuminance_lux
below: input_number.luxgraense
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "off"
alias: Confirm entrelys er slukket
- condition: state
entity_id: input_boolean.aut_entre
state: "off"
alias: Confirm entre boolean fra
- condition: state
entity_id: binary_sensor.ophold
state: "on"
- condition: state
entity_id: sensor.day_interval
state: dag1
sequence:
- service: light.turn_on
data:
brightness_pct: 100
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- conditions:
- condition: trigger
id:
- turn_on
- lux_low
- condition: numeric_state
entity_id: sensor.hue_motion_2_illuminance_lux
below: input_number.luxgraense
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "off"
alias: Confirm entrelys er slukket
- condition: state
entity_id: input_boolean.aut_entre
state: "off"
alias: Confirm entre boolean fra
- condition: state
entity_id: binary_sensor.ophold
state: "on"
- condition: state
entity_id: sensor.day_interval
state: aften1
sequence:
- service: light.turn_on
data:
brightness_pct: 85
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- conditions:
- condition: trigger
id:
- turn_on
- lux_low
- condition: numeric_state
entity_id: sensor.hue_motion_2_illuminance_lux
below: input_number.luxgraense
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "off"
alias: Confirm entrelys er slukket
- condition: state
entity_id: input_boolean.aut_entre
state: "off"
alias: Confirm entre boolean fra
- condition: state
entity_id: binary_sensor.ophold
state: "on"
- condition: state
entity_id: sensor.day_interval
state: aften2
sequence:
- service: light.turn_on
data:
brightness_pct: 40
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- conditions:
- condition: trigger
id:
- turn_on
- lux_low
- condition: numeric_state
entity_id: sensor.hue_motion_2_illuminance_lux
below: input_number.luxgraense
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "off"
alias: Confirm entrelys er slukket
- condition: state
entity_id: input_boolean.aut_entre
state: "off"
alias: Confirm entre boolean fra
- condition: state
entity_id: binary_sensor.ophold
state: "on"
- condition: state
entity_id: sensor.day_interval
state: aften3
sequence:
- service: light.turn_on
data:
brightness_pct: 30
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- conditions:
- condition: trigger
id:
- turn_on
- lux_low
- condition: numeric_state
entity_id: sensor.hue_motion_2_illuminance_lux
below: input_number.luxgraense
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "off"
alias: Confirm entrelys er slukket
- condition: state
entity_id: input_boolean.aut_entre
state: "off"
alias: Confirm entre boolean fra
- condition: state
entity_id: binary_sensor.ophold
state: "on"
- condition: state
entity_id: sensor.day_interval
state: aften4
sequence:
- service: light.turn_on
data:
brightness_pct: 25
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- conditions:
- condition: trigger
id:
- turn_on
- lux_low
- condition: numeric_state
entity_id: sensor.hue_motion_2_illuminance_lux
below: input_number.luxgraense
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "off"
alias: Confirm entrelys er slukket
- condition: state
entity_id: input_boolean.aut_entre
state: "off"
alias: Confirm entre boolean fra
- condition: state
entity_id: binary_sensor.ophold
state: "on"
- condition: state
entity_id: sensor.day_interval
state: nat1
sequence:
- service: light.turn_on
data:
brightness_pct: 15
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- choose:
- conditions:
- condition: trigger
id: turn_off
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "on"
- condition: state
entity_id: input_boolean.aut_entre
state: "off"
sequence:
- service: light.turn_off
data: {}
target:
entity_id: light.shellydimmer2_a4e57cba34c7
alias: Sluk uden bevægelse
- choose:
- conditions:
- condition: trigger
id: lux_high
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "on"
sequence:
- service: light.turn_off
data: {}
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.aut_entre
alias: Sluk ved høj lux
- alias: Lux afhængig af dag
choose:
- conditions:
- condition: trigger
id:
- day_interval
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "on"
- condition: state
entity_id: sensor.day_interval
state: morgen1
sequence:
- service: light.turn_on
data:
brightness_pct: 20
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- conditions:
- condition: trigger
id:
- day_interval
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "on"
- condition: state
entity_id: sensor.day_interval
state: morgen2
sequence:
- service: light.turn_on
data:
brightness_pct: 40
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- conditions:
- condition: trigger
id:
- day_interval
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "on"
- condition: state
entity_id: sensor.day_interval
state: dag1
sequence:
- service: light.turn_on
data:
brightness_pct: 100
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- conditions:
- condition: trigger
id:
- day_interval
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "on"
- condition: state
entity_id: sensor.day_interval
state: aften1
sequence:
- service: light.turn_on
data:
brightness_pct: 85
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- conditions:
- condition: trigger
id:
- day_interval
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "on"
- condition: state
entity_id: sensor.day_interval
state: aften2
sequence:
- service: light.turn_on
data:
brightness_pct: 40
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- conditions:
- condition: trigger
id:
- day_interval
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "on"
- condition: state
entity_id: sensor.day_interval
state: aften3
sequence:
- service: light.turn_on
data:
brightness_pct: 30
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- conditions:
- condition: trigger
id:
- day_interval
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "on"
- condition: state
entity_id: sensor.day_interval
state: aften4
sequence:
- service: light.turn_on
data:
brightness_pct: 25
target:
entity_id: light.shellydimmer2_a4e57cba34c7
- conditions:
- condition: trigger
id:
- day_interval
- condition: state
entity_id: light.shellydimmer2_a4e57cba34c7
state: "on"
- condition: state
entity_id: sensor.day_interval
state: nat1
sequence:
- service: light.turn_on
data:
brightness_pct: 15
target:
entity_id: light.shellydimmer2_a4e57cba34c7
mode: single