Can anyone help. I have appdaemon running as a docker on unraid - that connects to Home Assistant running on a different docker again on unraid.
I have an app that runs - that is basically a python script that doesnt connect to home assistant at all - it connects to my alarm system and translates the output of that into my MQTT server (again on a different docker on unraid).
The trouble is when I restart Home Assistant - appdaemon restarts my alarm app and this causes it to die and stop writing the output to mqtt and the only way I can fix it is to restart appdaemon itself - I currently have an automation in Home Assistant to restart the appdaemon docker after it restarts.
Is there any thing I can do in config or else where to tell app daemon not to restart this app when it reconnects to Home Assistant.
like @Odianosen25 points out you can prevent it from restarting.
but there is also another thing you can do.
you say your app dies and AD needs restarting.
in most cases that is because some processes cant handle a new start before the active one is stopped.
you can create an terminal(self) function. that will run as soon as the app get stopped (or reinitialised)
I made the change to this and indeed it does not try and restart the app, however the act of trying to reconnect to Home Assistant seems to cause the app to stop functioning. Am I missing something - does it shut down the apps if it loses a connection.
normally when something goes wrong and an app stops working there is an error in the errorlog.
you say that your app only connects to your alarmsystem and translates that to mqtt.
how does it send that to mqtt? does it use HA for that?
how is HA installed? does a restart also influence your mqtt?
does a restart from HA maybe influence the state from your alarmsystem?
what exactly is hanging?
i guess that i like @Odianosen25 cant tell much without you sharing more info. (errors, code, how you have tried debugging, etc.)
What I discovered was that if I logged onto the App Daemon docker terminal and ran the python script manually and restarted HASS then I had the same issue - given that it is essentially a stand alone app, I have switched over to running it on the Home Assistant Docker using an automation to start it when Home Assistant starts.
i am sorry to say but this is no app at all.
i dont even see how it would get started.
you dont import anything from AD, and there is no class that AD can connect to.
its not an standalone app, its just a python script that has no relation to AD.
obviously it also will never generate any error or logging in the AD logs, because there is no relation.
i hope for you that your solution keeps working.
for your information:
any app that has something to do with appdaemon has at least these line:
import appdaemon.plugins.hass.hassapi as hass #or any other plugin (in the moment only MQTT is available through 3th parties)
class the_classname_mentioned in_apps_yaml(hass.Hass): # connected to the plugin
def initialize(self):
#some stuff related to AD
if those lines arnt there it cant be called an appdaemon app.
As @ReneTode said that is definitely not an app. I do think I understand what you are trying to do, and I had similar use of it sometime back. But what you will have to do is thus:
Run this python script standalone in your box. You said you use docker, so might have to figure out how to do it.
You can use one of the mqtt AppD plugin to subscribe to the topics for the alarm and do your automation based on that.
I am presently trying to work on a TCP Server/Client plugin for AppD, as the one in HA is so limiting. With that, it will be possible to completely run this script you have within AppD (with some modification of course ).
Sorry we can’t give much more, but this should help with some pointers.