I have this automation. It’s pretty stupid actually. Starting from 4pm, it checks every 15 mins if the solar output is less than 100 W. If so it enables the discharge of my solar battery to take over for the night. However I’m now searching for a smart way to check if the value is less than 100W at least for 15 mins. Even ChatGpt cannot help here as it suggesting using a for which doesn’t seem to be available.
Can anybody help?
Thanks
alias: "Anker: Discharge am Abend"
description: ""
triggers:
- minutes: /15
trigger: time_pattern
conditions:
- condition: time
after: "18:00:00"
before: "21:00:00"
- condition: not
conditions:
- condition: state
entity_id: sensor.solarbank_e1600_mode
state: discharge
- condition: numeric_state
entity_id: sensor.solarbank_e1600_solar_power
below: 100
- condition: numeric_state
entity_id: sensor.solarbank_e1600_state_of_charge
above: 30
actions:
- action: script.battery_priority
data: {}
- data:
title: Solarstrom zu niedrig
message: Schalte Batterie auf discharge um.
action: notify.all_phones
mode: single
An alternative approach might be to define a threshold helper based on sensor.solarbank_e1600_solar_power, then your trigger entity would just be on or off.
This is a trigger (numeric state)which accepts for:
This is a condition (time)
Basically, your current automation is triggering 96 times a day unnecessarily. Replace your trigger with @jackjourneyman’s suggestion and all should be fine
So I changed it to this, now my question is (and yes this is a n00b question): Let’s say it triggers at 4pm, it will not run the action, as condition is not met, where i check time must be after 6pm. Will it trigger again at 6pm?
but if the value is going < 100 at 5 and not going > 100 again, it will not trigger again at 6pm and therefor it will never actually trigger the action correct?
To deal with that you could have a second automation triggered by the time (6pm), with battery level as a condition.
If that achieves what you want, you could combine the two into a single automation with two triggers, 6pm and battery state, and a choose action depending on which has fired.