I am using the script below, but its not working as expected. I want to make sure that if the value is between 0,4 and 2 the switch is turned on. The script seems to work if it goes over or under these values. But its not working if the values are already met. This is to prevent the switch not working after a reboot of homeassistant.
alias: "WPBoiler inschakelen "
description: Boven 450watt productie
trigger:
- platform: numeric_state
entity_id: sensor.power_consumption
above: 0.4
below: 2
condition:
- condition: numeric_state
entity_id: sensor.power_consumption
above: 0.4
below: 2
action:
- service: notify.notify
data:
message: Warmtepomp Boiler Ingeschakeld
- service: switch.turn_on
data: {}
target:
entity_id: switch.0x7cb03eaa0a0c1b45
mode: single