I’m using an automation that is triggered, when the temperature is changing below a certain value and when the time is between a specific range.
But it seems, this will start the action only, if the temperature change (event of changing below 20.9) is between 05:00 and 20:00. If the temparature change is between 20:00 and 05:00, the action does not start.
But I need the following:
If the temperature is below 20.9 and it’s between 20:00 and 05:00 --> no action
If the temperature is below 20.9 and time is between 05:00 and 20:00 (e.g. changes from 04:59 to 05:00) --> start action.
Yep. A trigger with an above/below will only trigger once the previous state and current state cross the boundaries.
If the previous state was already pass the boundary, it wont cause the trigger to fire. This is true whether the automation was on or not when that happened.
So, looking…this automation will never turn that switch back off. Do you have another one to manage that? If so, we’ll just add another trigger at 5 am. Well, I’m going to do 5:01 am as I’m not 100% sure if 5:00 is techincally ‘after: 05:00’ or not.
alias: HeizungWohnzimmer (an)
description: ''
trigger:
- type: temperature
platform: device
device_id: 1982c4b75a6d4dd9acd4c7f1ce22b665
entity_id: sensor.multisensor
domain: sensor
below: 20.9
for:
hours: 0
minutes: 15
seconds: 0
- platform: time
at: "05:01:00"
condition:
- condition: time
after: "05:00:00"
before: "20:00:00"
# This one will already be true on the device trigger. So it's mainly just to see if it's true
# at the 5am trigger.
# Also, might have to tweak this. Not sure how to convert your device trigger to this...
- condition: numeric_state
entity_id: sensor.multisensor
below: 20.9
action:
- type: turn_on
device_id: 3061cbfd74064419b7e420f0db478853
entity_id: switch.heizung_wohnzimmer
domain: switch
- service: notify.pushnotify
data:
message: Heizung Wohnzimmer EINgeschaltet
title: Heizung Wohnzimmer EINgeschaltet
mode: single
Is there any other solution to have a condition test like asked by me?
I want to launch the action, when both conditions are true (temp below 20.9 and time equal 05:00 AM).
This is really something I use very often with time parameters.
Just note, this will now trigger for EVERY state change that is lower than 20.9. So if it goes from 20.9 to 20.8, you’ll get another trigger. So you would have to add another condition if you want to make sure it’s not doing the action over and over again.
Or, just use time as your trigger, and the condition is temp < 20.9.
trigger:
platform: time
at: "05:00:00"
condition:
< less than 20.9 degrees >
There are many ways to do it. Your original problem is the numeric_state trigger only tells you when the thing crosses the threshold (because you added ‘below’). If you didn’t add ‘below’, you could have put the temperature in the condition rather than in the trigger.