Create automation based on user-defined triggers

I’m trying to automate some solar/battery functions.
I’d like to create a section with my existing solar controls that allow the user to “create their own automation”…so to speak.

For example:

  1. User wants to discharge battery down to 30%. There’s some dropdowns, input numbers/times.
    They select “discharge” and limit of “30”, then “run”.
  2. User wants to force charge until 3pm.
    They select charge and time of 3pm, then “run”.

Basically, one page where they can create a custom automation based on a few conditions they choose.

What’s the best way to do this?
I’ve created some input helpers with charge level and time, but unsure how to move on from here.
Has anyone done anything similar to this? Any help is appreciated, thanks.

sounds like you’re most of the way there. is your question how to go from input helpers to a ui page?

if so the input_helpers you created each have widgets that you can add to a dashboard.
you could create an input_button and then an automation that triggers on the input_button and uses the values set in your charge level and time helpers…

if your question is how to discharge to 30 and stuff like that… it depends on your specific devices, so i can’t answer that given the info here…

Hi burnsy180,

Are you writing a blueprint? Sounds like it to me…

Yeah I’ve got both input helpers added to a dashboard, just trying to figure out the best way to write/structure the building blocks.
I’m guessing helpers for charge/discharge choice, level/time choice, then actual level, and time.
Then have a heap of logic building blocks with things like (if charge choice, then if level choice, then charge until level).

Also if the trigger is the “run” button, would it be best to then trigger the automation, or just enable it, and have it on until it’s completed, then turn itself off/disable. Or would a script be better suited?

Kinda, but for the end user, not an admin.

I would not have the button enabled/disable an automation. that’s quite a hack. I would either have the automation trigger off the button or I would have the button invoke the script.