Hi I created an automation to switch my Inverter to Mode : On when the total home load is above 7000W. Once this mode is selected I need HA to monitor the total load and when the load stays below 7000W for 15 min, I need HA to switch to Mode : Inverter. This automation needs to run continually to select the Mode based on the load conditions. (>7000W Mode : ON, <7000W for 15min Mode : Inverter)
Below my code, but there is a problem, the automation switch to Mode : ON, but not back to Mode : Inverter every time once 15min lapsed.
did you construct this in yaml? or did you use the ui to construct? curious because of the “and” constructs…
you should avoid device id’s:
which not only will help you, but it also helps us edit your code (because home assistant front end will nuke device id’s that don’t exist in our system).
i definitely see a number of issues in your code. the “and” condition isn’t correct
the format is here:
note how the “and” comes before all the actual conditions… as a result you’re not getting an “and”… you’re effectively getting an “or” in your conditions.
by the way, you shoudln’t need to check the power sensor state again. you can use trigger id’s to know what triggered it (whether it was triggered because you were above or below the threshold).
if you post up an entity_id code version instead of device id, it’d be easier for me to edit it for you if you’d like.
Please consider marking my post above with the Solution tag. It will automatically place a check-mark next to the topic’s title which signals to other users that this topic has been resolved. This helps users find answers to similar questions.