I’ve had this automation running fine for a good year on Z2M, but after changing to ZHA it stopped working. Can anyone help me figure out why and what I should change:
The goal is to have a presence sensor in the kitchen, that determines if the lights should go on or not. There are three thresholds based on lux, that determines what level of brightness that should go on or whether the lights should turn off.
Two of the thresholds should trigger only if there is presence in the room, and the third, turning off the ligths, should happen regardless.
alias: Køkken Dagligdagsbelysning
description: ""
triggers:
- trigger: state
entity_id:
- binary_sensor.kokken_dagsbelysning_mellem_0_og_40
to: "on"
enabled: true
- trigger: state
entity_id:
- binary_sensor.threshold_kokken_dagsbelysning_mellem_70_og_140
to: "on"
enabled: true
- trigger: state
entity_id:
- binary_sensor.kokken_dagsbelysning_sluk_hvis_over_170
to: "on"
enabled: true
conditions:
- condition: state
entity_id: binary_sensor.presence_sensor_kokken
state:
- "on"
- condition: or
conditions:
- condition: state
entity_id: input_select.hus_tilstand
state: Hjemme
- condition: state
entity_id: input_select.hus_tilstand
state: Gæster
actions:
- alias: Lux mellem 0 og 40
if:
- condition: state
entity_id: binary_sensor.kokken_dagsbelysning_mellem_0_og_40
state:
- "on"
then:
- action: light.turn_on
metadata: {}
data:
brightness_pct: 70
transition: 12
color_temp_kelvin: 2451
target:
entity_id:
- light.home_assistant_connect_zbt_2_kokkenbordet
- data:
brightness_pct: 100
transition: 12
action: light.turn_on
target:
entity_id:
- light.spisebordet_1
- light.spisebordet_2
enabled: true
- alias: Lux mellem 30 og 80
if:
- condition: state
entity_id: binary_sensor.threshold_kokken_dagsbelysning_mellem_70_og_140
state: "on"
- type: is_occupied
condition: device
device_id: 6d1689c002eeac1fb41a6f99f823c7b1
entity_id: 8b4692a4827bfbe5784e4dd7291bd4b4
domain: binary_sensor
then:
- data:
brightness_pct: 70
transition: 12
target:
entity_id:
- light.home_assistant_connect_zbt_2_spisebordet
action: light.turn_on
- target:
entity_id:
- light.home_assistant_connect_zbt_2_kokkenbordet
data:
transition: 12
action: light.turn_off
enabled: true
- alias: Sluk hvis over 90
if:
- condition: state
entity_id: binary_sensor.kokken_dagsbelysning_sluk_hvis_over_170
state:
- "on"
enabled: true
then:
- data:
transition: 20
target:
entity_id:
- light.home_assistant_connect_zbt_2_kokken_alle_lys
action: light.turn_off
enabled: true
mode: single
Probably because when you went Z2M to ZHA the names changed, the features of the entities changed, and something is no longer correct.
You have the flowchart of what you want to do, just spend 5 minutes building it over in the UI so it works with the new hardware, because flipping coordinator schemes means the hardware is new…
Already did that, rebuilding everything and checking all the names. Yet it doesn’t want to run. So I was hoping someone could spot something I haven’t when I rebuilt the thing.
4. Click “Download trace”
5. It will create a file that ends with .json. Open the file and copy-paste its contents in your forum reply.
6. Before the first line of the trace, add three backticks and the word json