I have an automation to turn on a light in red when the load is about 2700W and turn it off when it is below 2000W for 3 minutes. The code is as follows
alias: Warning light on if the load is high
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.srne_current_load_power
above: 2700
id: Load is high
- platform: numeric_state
entity_id:
- sensor.srne_current_load_power
for:
hours: 0
minutes: 3
seconds: 0
below: 2000
action:
- if:
- condition: trigger
id:
- Load is high
then:
- service: light.turn_on
data:
color_name: red
target:
entity_id: light.warning
else:
- service: light.turn_off
data: {}
target:
entity_id: light.warning
I have another automation to turn the same light when the battery SOC of the battery is below 20% and turn it off when the SOC is above 20%
alias: Warning light if Battery is low
description: ""
trigger:
- platform: numeric_state
entity_id:
- sensor.jk_bms_state_of_charge
id: Battery is low
below: 19
- platform: numeric_state
entity_id:
- sensor.jk_bms_state_of_charge
for:
hours: 0
minutes: 3
seconds: 0
above: 20
condition: []
action:
- if:
- condition: trigger
id:
- Battery is low
then:
- service: light.turn_on
data:
color_name: red
target:
entity_id: light.warning
else:
- service: light.turn_off
data: {}
target:
entity_id: light.warning
mode: single
But when these 2 are enabled together, one automation will turn on/off the light even when the other one is supposed to do the other way.
How can I merge this 2 automation to turn on the light if the load is above 2700W and/or battery SOC is below 20%. Also turn off when the load is below 2000W and/or battery SOC is above 20%.
following is the summary what I want to have.
Load is above 2700W and SOC below 20% - light on
Load is above 2700W and SOC above 20% - light on
Load is below 2000W and SOC below 20% - light on
Load is below 2000W and SOC above 20% - light off
Can someone please help me with the cording to achieve this?