Start automation based on input buttons per hour

With a situation of dynamic energy prices and solar panels I would (for now) like to have 48 buttons on a dashboard on which I can manually select which hours of today and tomorrow my car would be charging.

  1. For the hours of today if a button is selected my car should be charging in that hour
  2. At midnight the 24 buttons are moved to today and the 24 buttons of tomorrow are cleared to off

Reason for wanting to do it manually is I want to be aware of when my dishwasher is running, washing machine will be running, give preference on solar power versus lower tariffs and want to be for sure there is a certain minimum in my car and not that the rates have not been low enough to charge :slight_smile:

Any suggestions or alternatives for this?

I am picturing 48 input_boolean helpers for each of the 24 hours both days named:

input_boolean.today00
input_boolean.today01

etc.

and:

input_boolean.tomorrow00
input_boolean.tomorrow01

etc.

Then a time triggered automation for every hour. The action would have to check input_boolean.today ~ hour from the trigger to see if it is on or off and you can do your actions based on that. Something like

{{ states('input_boolean.today' ~ trigger.now.hour | string) == 'off' }}

Or on or whatever you need to look at.

Then the script that runs at midnight would loop from 0 to 24, set the today boolean to what the tomorrow one is at, and set the tomorrow boolean to off.

By being able to dynamically name the entity in a compare using the time, it will cut down on the yaml. You could also setup the helpers in yaml too instead of the UI.

Might be more manageable to use something like this?

Although if you are manually intervening alot, this might not be a good fit.

Alternatively, rather than setting on and off periods manually, you might be able to get the data for your solar output, and some smart plugs on your applications to do it dynamically for you with a bit of scripting/automations.

Sounds like a horrible idea with buttons.
Perhaps scheduler card could work?

Scheduler card/custom component - Share your Projects! / Dashboards & Frontend - Home Assistant Community

Maybe good to clarify, since I am dealing with a not so tech savy customer who will be using this, I want it to be as user friendly and accept the programming in itself costs more time. Therefore just wanted to have 48 buttons with a number to make it as clear cut as possible :slight_smile:

1 Like