Hey guys,
I am looking for a way to turn on and off a bunch of shellys when a sensor reports above or below X for 30 seconds.
I found that the numeric state trigger only fires if the value actually crosse the specified amount but this will not fire if the sensor value already is above x.
I’v then tried
alias: E-Heizkörper ausschalten
description: ""
trigger:
- platform: state
entity_id:
- sensor.myenergi_xx3_power_import
for:
hours: 0
minutes: 0
seconds: 0
condition:
- condition: numeric_state
entity_id: sensor.xx3_power_import
above: 1000
But as soon as i set the for options to 30 seconds the automation does not work at all.
Could you help me out?
Thanks
As you have discovered a standard State trigger will not work in this case because the for:
would require that the value remains exactly the same for at least 30 seconds. Numeric state is the correct trigger type for the standard case of your application. If there are non-standard cases you are concerned about you should describe them and we may be able to suggest other triggers to use in addition to your Numeric state trigger.
2 Likes
Coming back to my initial topic since I am stil struggeling with those types of automations.
My use case is this:
I’d like to execute a certain automations if reported energy usage exeeds or is below a certain value for at least 30 seconds.
So if energy usage goes above 500 for 3 seconds, then gets back under 500 the automation would not trigger, but if energy usage goes above 500 for 30 seconds or more it should trigger.
I am fine with the numeric state trigger only executing if a threshold is being crossed but I cannot get the duration to work.
Any help is highly appreciated ![:slight_smile: :slight_smile:](https://community.home-assistant.io/images/emoji/twitter/slight_smile.png?v=10)
The basic trigger for that would be:
trigger:
- platform: numeric_state
entity_id: sensor.your_energy_sensor
above: 500
for: "00:00:30"
condition: []
action:
- YOUR ACTIONS
Thanks for the response! Unfortunately this does not seem to work. The automation triggers immediately, ignoring the duration.
Are there any situations where the duration in the for-statement might be ignored?
This is my automation:
alias: Batteriespeicher Ü-Laden (STOPP)
description: weil kein Überschuss mehr
trigger:
- platform: numeric_state
entity_id: sensor.myenergi_power_import
above: 100
for:
hours: 0
minutes: 0
seconds: 30
condition: []
action:
- type: turn_off
device_id: ccce626d4c6125e8c3e69fb71a89302c
entity_id: switch.tasmota_powerstation_laden
domain: switch