Delay app startup until mqtt is available #579
-
I have an app that registers on mqtt events. At startup the app fails as the registering on the mqtt events fail. What would be the best way to delay the startup of the app until the mqtt service is started? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Can you post some code? One hack would be to have a |
Beta Was this translation helpful? Give feedback.
-
How do you deploy your stack? If you use docker you can set dependencies, and make sure mqtt is running before home assistant starts. |
Beta Was this translation helpful? Give feedback.
-
I made some simplified code for testing. What I found out:
While shutting down HA
The code I used: modules/hapsTest.py:
apps/mqttTest.py:
Thanks a lot for your help |
Beta Was this translation helpful? Give feedback.
-
For the record, I added BTW, still loving pyscript a lot, I use it for all my automations :) |
Beta Was this translation helpful? Give feedback.
For the record, I added
"dependencies": ["mqtt"]
to the manfest.json a few months ago and have never seen the issue again
BTW, still loving pyscript a lot, I use it for all my automations :)