That’s it, in the instructions in the comments of the service state that to enable we have to:
sudo systemctl --system daemon-reload
That confused me at first too.
Regarding the autostart, do you see many errors on the log if you restart the system? I get many connection-to-HA errors and finally the correct block with the HelloWorld. I think that the problem is that we have to start AppDaemon after HA has completely booted up so I tried adding in the appdaemon.service:
But still some errors thrown into the log. I tried adding a delay (e.g., OnBootSec=8min) too but with no luck. Anyone found a solution to this? AppDaemon is booting fine, but I would like to remove those errors from the log.
Thanks for this tip. I struggled to get it going and this was the cause. It is specific to mounting the drive and editing the files on a Mac. The OS makes the apple double file for each file in each directory of a network drive. This screws up appdaemon.
Deleting these files and all is well.
Is there anyway to have appdaemon ignore the .appledouble files?
this setting turns this property off and seems to work. defaults write com.apple.desktopservices DSDontWriteNetworkStores true
I’m new to appdaemon and Python. How do you debug your code syntax? All I can see from the documentation is how to run it again by restarting appdaemon. And that doesn’t tell me my syntax errors.
your syntax errors get listed in your error logfile. (the one you have set in your appdaemon.cfg)
you dont even need to restart appdaemon. as soon as you save a changed app it will re initialize and if you have any errors in your code it will show up in the error log.
great because that doesn’t give any errors. Do I have to do anything other than set the ha_url in the appdaemon.cfg file to integrate it with HA? It doesn’t seem to be responding to anything I do in HA?
if you have an entity in hass which is called switch.den_power_outlet then your callback should go off when the switch is turned on.
it should then turn off light.den_fan_light
in your logfile you should at least see the line “turning on xmas tree” appear.
if thats not there the there should be something in the error log.
Ok,
I’m getting messages from the initialization function, but when I turn on the switch, I get the following.
Here is the error I am getting - TypeError: adjust_tree_state() takes 5 positional arguments but 6 were given
The documentation says that
For state callbacks, a class defined callback function should look like this:
def my_callback(self, entity, attribute, old, new, **kwargs):
<do some useful work here>
My code has def adjust_tree_state(self, entity, attribute, old, new, **kwargs):
Which are the same variable names as the documentation calls for (I’m not very inventive until I need the variables for something that deserves a different name).