Can someone explain automation condition checking?

thanks for helping!
Therein lies the problem…what I am understanding is that once the condition has been met ONCE, HA will not evaluate that condition again?

it will check it every time you cross from less then 50 to more then 50. But it has to fall below 50 and more then 50 again for it to trigger again.

1 Like

the conditions are checked when and only when the trigger for the automation occurs (goes from false to true). if the condition(s) aren’t met at that exact moment then the automation actions aren’t going to run. And the condition won’t be checked again until the next trigger occurs.

If you want there to be more checking of the condition outside of your original trigger then you need to create another trigger that matches the conditions of the condition as noted above.

you may also need to add a second (or more) condition that matches the conditions of your original trigger.

1 Like

OK, so perhaps someone can help then setup the automation logic :
The geyser must switch on when the SOC is > 50, it is after 11am AND the power draw from the grid is < 500W.
If the grid draw is> 500 the geyser much switch off (even if SOC > 50)
If the grid draw drops below 500 again (and SOC is still > 50) the geyser must switch on again

in English : I want the geyser to only use solar power and as soon as the HA detects that grid is being used the geyser must be switched off. It has the lowest load priorty

hi. yes, this is now sounding like what I have to do. HA does not seem to do persistent monitoring of a condition.

Persistent monitoring is only for triggers.

If a trigger occurs then the conditions are checked.

So if you want to monitor three things, time, soc and power, use three triggers. Then sort out the logic in the conditions.

2 Likes

Hi
is that 3 triggers in the SAME automation or 3 separate triggers in 3 different automations?

Lastly : are the “WHEN” conditions OR or AND? So would my trigger “SOC > 50 , Grid Power < 500” require BOTH to be met or either to be met in order for the action to take place?

by default, conditions (WHEN) are and. You can explicitly make them and by using the and condition, you can also use the or condition. Making it possible to mix and match and and or.

1 Like

Don’t confuse triggers with conditions.

1 Like

you probably have two triggers to turn the geyser ON (first automation):

  • SOC rises over 50% or
  • it turns 11

and three conditions with that automation:

  • it is between 11 and midnight (or whenever your latest time is) and
  • your SOC is over 50% and
  • grid power is over 500

But then you probably also want to turn it OFF again (in a second automation) when

  • Grid Power drops below 500 or
  • SOC goes below 50%
  • your latest time arrives

if you want a condition with that one it would be that the geysir is already turned on.

1 Like

Yes, I have not listed the OFF trigger but your assumption is 100%

FYI to all who assisted : I found a much better solution. My PV systems exposes a ‘state change’ trigger on the battery SOC. Thus I set a trigger to monitor the state from “Any State” to “Any State”. Under the Conditions I then add in the SOC & Grid power rules. This way the trigger is fired almost continually as the battery charges and discharges and thus its state changes.

1 Like

I know you said you used a different method and it’s working but to answer your question for next time…

three triggers in one automation

you can also add the trigger(s) to switch it off to the same automation but it may make it harder to read therefore making maintenance a bit harder. So making two automations - one for on & one for off - might make more sense. Some people have an unhealthy compulsion to cram everything into one huge unwieldy automation. But that’s personal preference.

I DO have a separate ON & OFF automation - would be very tricky otherwise to manage!

1 Like

If you want a trigger that fires ‘continually’, just use a time pattern trigger.

1 Like

Time pattern triggers are rarely the best choice. Even triggering on all state changes and putting in a condition is a better option. e.g.

trigger:
  - platform: state
    entity_id: sensor.battery_soc
    not_to:
      - unavailable
      - unknown
condition:
  - condition: numeric_state
    entity_id: sensor.battery_soc
    above: 50
4 Likes

The “not_to:” part is really smart. :grinning:

I don’t know how copy/paste code into a window like you guys have done… but here is the trigger I defined

alias: Geyser ON - (SOC>50)(Grid<500)(<6pm)
description: ""
trigger:
  - platform: state
    entity_id:
      - sensor.solarsynk_2301280141_battery_soc
    from: null
    to: null
condition:
  - condition: numeric_state
    entity_id: sensor.solarsynk_2301280141_battery_soc
    above: 50
  - condition: numeric_state
    entity_id: sensor.solarsynk_2301280141_grid_power
    below: "500"
  - condition: state
    entity_id: switch.1001e2bc91
    state: "off"
  - condition: time
    before: "18:00:00"
action:
  - service: switch.turn_on
    data: {}
    target:
      entity_id: switch.1001e2bc91
mode: restart

https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

Or

https://community.home-assistant.io/t/how-to-format-your-code-in-forum-posts/702762

1 Like