Adding a "switch" in the App to manually run a Automation

I want to send a range of commands to a Solar Inverter, bij manually clicking on an on/off “switch” in the App. So that visual “switch” itself is not connected to any existing device. It must only run two automations, one which it is switched ON, and another automation when it is switched Off.

How?

Probably several ways but I’d create a helper as a toggle then assign an automation that runs when the toggle goes on/off.

That worked, thanks!

The easier method would be a script since it doesn’t need a helper

You can do that with the “Interaction” part of a (button) card:

To get the on-off behaviour, make two alternative cards and set their visibility so that only one of them is visible at any time. So the card that reads “turn on!” is only visible when something is off and the the “turn off…” one when it’s on.

Naturally, for the latter to work, you need some way for HA of knowing if something is on or off. If that method is “remember what command was last sent”, then yes, making a helper sensor (that can show up as an on/off-type card) and trigger off of that is a good way. But if you can write the logic to detect if something is on or off, that’s the better way to do it.