Hi,
is it possible to creat an automation whose trigger is a constant (unknown) value of a sensor during a period (e.g. 30 seconds)? The automation should fire if a power sensor of a smart plug doesn’t change during a few seconds. Of course there will be a few more conditions.
How can I achieve that?
Note that this trigger will only fire when the template evaluates to true after having evaluated to false, and then stays true for 30 seconds. Of course, like all other triggers, this implies the necessity of a state change (in this case the state of sensor.XYZ changing from a value that causes the template to evaluate to false, to a value that cause the template to evaluate to true.)
Depending on the states of the sensor and exactly what you want, you may need a slightly more complex template, such as testing if the numeric value of the state is between two values.
Hi,
Thanks for your answer. Something seems not to work with this one.
What I am trying to do is this: I have a washing machine and a dryer in the laundry room that are connected to two smart plugs, but to one fuse. This fuse blows from time to time when both devices are running at the same time. I don’t see this in Home Assistant, and the smart plug of the washing machine doesn’t report a “finish” via the automation anymore, but the laundry just stays in the washing drum. If the smart plugs suddenly get no power, the sensors for current and power of the smart plugs continue to display the last measured value constantly. I want to take advantage of this, so that after a few seconds of completely constant power, a message is issued by Home Assistant “fuse blown”. In that case, I can turn the fuse back on and temporarily turn off one of the appliances without the laundry being in the drum for long.
So my idea was to use the constant value over a short period of time as a trigger, and as a condition that the device is on and the power is greater than 0.
Actually, what you wrote me should be enough, but I get an error:
Message malformed: extra keys not allowed @ data[‘entity_id’]
Do you have an idea what might have gone wrong?
Can you share the YAML of what you wrote? What I suggested had no entity_id key, so should not have caused such an error.
But, given your further clarification, I would suggest something different. E.g., you could create a template binary sensor that is on whenever the sensor changes state, and then goes off whenever it doesn’t change state for some period of time. E.g.:
Hi everybody,
I never thought it could be so simple. After a while I asked (just for fun) Chat GPT and immediately a working solution came up that I want to share with you:
trigger:
platform: state
entity_id: sensor.waschkeller_leistung
for:
seconds: 20
Thanks to you all for you comments and best regards!
Rado