Hi all,
I have problems doing an automation simply switching on a switch if value is above, and wait for being below to switch it off again. Should be a simple one, but it does not work like I expect it, i.e. the “wait_for_trigger” obviously acts different to what I understand it to.
Here´s my automation yaml:
alias: Solar Charging
description: ""
trigger:
- platform: numeric_state
entity_id: sensor.solar_power_status
above: 2000
condition: []
action:
- service: switch.turn_on
target:
entity_id:
- switch.garage_chargingdevice_switch
data: {}
- wait_for_trigger:
- platform: numeric_state
entity_id:
- sensor.solar_power_status
below: 1500
for:
hours: 0
minutes: 0
seconds: 0
timeout:
hours: 0
minutes: 5
seconds: 0
milliseconds: 0
- service: switch.turn_off
metadata: {}
data: {}
target:
entity_id: switch.garage_chargingdevice_switch
mode: single
The result is, that when value is jumping above 2000, the switch gets turned on for 5min, then it gets switched off again - anyway how the value is. I thought it should wait for the value getting below 1500 as stated in the above term - am I wrong in this?
In the trace for this step I see
result: false
state: 2007
wanted_state_below: 1500
The same trigger that fires the automation, cannot get waited for to within the automation. Am I wrong or the system? Bug or me?
I worked around it now by having two automations, one for switching on, one for switching off. But shouldn´t this be the way to do something like that?
Any input appreciated…
BR, Jo