Hi
I would like to block all automations in automations.yaml file based on true/false condition.
Following code should block any actions, but it doesn’t.
condition:
- condition: template
value_template: ‘{{ not is_state(“sensor.price_below_threshold”, “true”) }}’
I checked that the condition returns correct state, but the automation still works after “true” state. Any further ideas why this is not the case?
alias: IVT control
description: Styra värmepumpen via Nordpool spotpris med relä
trigger:
- platform: state
entity_id:
- sensor.nordpool_kwh_se3_sek_3_095_025
condition:
- condition: template
value_template: '{{ not is_state("sensor.price_below_threshold", "true") }}'
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: sensor.electricity_price_4_levels_24h
above: 3
sequence:
- service: light.turn_off
target:
entity_id: light.hue_smart_plug_1_3
data: {}
- service: switch.turn_on
data: {}
target:
entity_id: switch.shelly1_244cab43e0e5
- service: notify.notify
data:
message: "Nivå 4: dyrt"
title: Expensive
- conditions:
- condition: numeric_state
entity_id: sensor.electricity_price_4_levels_24h
above: 2
sequence:
- service: light.turn_off
target:
entity_id: light.hue_smart_plug_1_3
data: {}
- service: switch.turn_off
data: {}
target:
entity_id: switch.shelly1_244cab43e0e5
- service: notify.notify
data:
message: "Nivå 3: normal"
title: Normal
- conditions:
- condition: numeric_state
entity_id: sensor.electricity_price_4_levels_24h
above: 1
sequence:
- service: light.turn_off
target:
entity_id: light.hue_smart_plug_1_3
data: {}
- service: switch.turn_off
data: {}
target:
entity_id: switch.shelly1_244cab43e0e5
- service: notify.notify
data:
message: "Nivå 2: billigt"
title: Cheap
- conditions:
- condition: numeric_state
entity_id: sensor.electricity_price_4_levels_24h
above: -1
sequence:
- service: light.turn_on
target:
entity_id: light.hue_smart_plug_1_3
data: {}
- service: switch.turn_off
data: {}
target:
entity_id: switch.shelly1_244cab43e0e5
- service: notify.notify
data:
message: "Nivå 0: Gratis"
title: Burn it
default:
- service: light.turn_on
target:
entity_id: light.hue_white_lamp_1
data: {}
- service: switch.turn_off
data: {}
target:
entity_id: switch.shelly1_244cab43e0e5
- service: notify.notify
data:
message: "Nivå 1: väldigt billigt"
title: Bäst
mode: restart