Hi,
I created an automation in order to implement a smart charging mode for my wallbox.
With that, I can charge my car on excess solar power from my PV plant.
The automation is working fine, but I have a curiosity.
To enable/disable this “smart charging mode” I use an input boolean.
The automation is triggered by any change in the PV production power, which happens quite frequently, then I test the input boolean in the automation conditions.
I wonder if it would be more efficient to enable/disable the automation in synch with the status of the input boolean instead. That would also pose the problem of how to secure the synchronization even after a restart.
So in summary, which is the recommended way to enable/disable an automation based on an input boolean?
Are you controlling the state of the input_boolean from the UI, and are you solely using this input_boolean as condition in the automation?
If so, then in fact you are now looking for a way to control the state of an automation (enabled or disabled) from the UI, don’t you?
One way to do this is to create a button card like this:
That’s the recommended way of controlling the automation’s behavior. Ideally, an automation should manage itself via its triggers and conditions.
Enabling/disabling it should be left for special occasions such as testing. For example, you can have multiple versions of an automation and test each one individually to determine which works best.