Start automation from within custom component

Hi

is it possible to start an automation form within a custom component?

I would like to make a custom switch that will start eg automation “start all lights” when the turn_on() is triggered. This way I hope to put the logic of the component outside the python component, creating freedom and platform independency.

TX

Mario

Why not try a python script?

Could you make the automation listen for an event and make your component fire that event?

I thought of that but what to use the power and integration of hass.

yeah, that is it :stuck_out_tongue: KISS …
I was so focused on a solution that the configuration.yaml determines what automation to start that i lost sight on this, the other way around.

Tx for this suggestion. I will give it a try …

Mario

Python scripts are part of HASS. I would argue they are more powerful than automations when it comes to editing them as you can make edits and rerun the script without the need/hassle of restarting HASS and hoping there are no problems.