Fire event as action of a generic automation

I am trying to build an alarm clock, as for instance indicated here

https://community.home-assistant.io/t/creating-an-alarm-clock-updated/15195/5

That is a lot of code and I would like to separate it out and keep it as generic as possible as I will need more of those. I have all of it wrapped into a package. The final goal would be to use the package as some sort of generic alarm clock gui. Whenever I need another alarm clock I can copy the package, rename all from “alarm_x” to “alarm_x+1” and I would be done.

The last thing I would need for that is a way to keep the action generic so that the “actual action” is not triggered in the automation but somewhere else. Intuitively I would just fire an event named “alarm_x” and pick this up somewhere else. However there is no service.event I could call it seems.

What would be the best way to achieve this?

1 Like

I found it myself. It is not really documented it seems (at least I did not find it), but it is mentioned at the bottom of the scrip manual:

https://home-assistant.io/docs/scripts/

Just use:

event: LOGBOOK_ENTRY
event_data:
name: Paulus
message: is waking up
entity_id: device_tracker.paulus
domain: light

In the action instead of a service section.

2 Likes