In my custom component I registered two services. In my component, I want to publish MQTT messages when the services are called.
Now the problem is that the services are called within a worker thread by HASS, which do not have any event loop running. Therefore I am unable to call the async hass.components.mqtt.async_publish()
function.
What can I do? Probably, I should not create a new event loop, and probably, I should not store a reference to the main event loop and use this one either?