How to trigger an event from an custom programmed add-on?

Hi everyone,

I am an experienced Python developer, but never implemented an HA Add-On.

Today, I started with my first HA Add-On and it already works with the basic features.

However, I have a use case in that I want to trigger an HA Event from my Python code, so I can build Automations with it later.

How can I trigger an HA Event from my Add-On?

See my code: https://github.com/Alwinator/addon-spotify-connect/blob/ae46e3fa5a406352251dcac934f9f858381718c3/spotify/rootfs/etc/services.d/spotifyd/runner.py#L17

Answered by Frenck here.