Announcement - AppDaemon 3.0 beta 4

A few features added around app dependency and reload, as well as a new filter function for preprocessing apps and a new Icon widget.

Also, a few bug fixes. In particular, I am now developing and running on 3.6.3 instead of 3.5.1, and that required some fixes to the async code.

hass.io release for this version should be available in a day or so according to @frenck

Enjoy!

3.0.0b4

Features

  • Single App dependencies can now be specified on the dependency line itself and don’t have to be a list of size 1
  • Added get_ad_version(), and ad_version to the config dictionary
  • Added filters for Apps
  • Added global module dependency tracking
  • Added plugin reload app control
  • Added icon widget

Fixes

  • Apps now correctly reload when HASS comes back up after a restart
  • get_error() now properly returns the error log logger object
  • get_hass_config() is now correctly named
  • app_args now correctly returns args for all apps
  • get_state() now returns fields from the attributes dictionary in preference to the top level dictionary if there is a clash. In particular, this now means it is easier to iterate through group members
  • Fixed a bug preventing an objects terminate() from being called when deleted from apps.yaml
  • Fixed a bug in which object info was not being cleaned out at object termination
  • Fixed an issue preventing dashboard updates on python 3.6

Breaking Changes

None

4 Likes

Has this not been released to PyPi yet?

Apparently not - small issue with the build process, stay tuned!

EDIT: Fixed now, sorry :wink:

1 Like

Quick re-test of this issue and I am unable to re-create the issue - so fingers crossed - looks like it is fixed!

Thanks again for this great tool!

Tom

Excellent - thanks for reporting back so quickly!

Hello,

Checked the dash and this issue has also been corrected. The radial-gauge widget is now updating in the dash panel. Many Thanks!

1 Like

Excellent - thanks for the confirmation.

I’m seeing this error when doing a cold restart of both HA and AppDaemon (each running in its own Docker container):

2018-03-04 19:18:26.037908 INFO AppDaemon Version 3.0.0b4 starting
2018-03-04 19:18:26.038952 INFO Configuration read from: /config/appdaemon.yaml
2018-03-04 19:18:26.042456 INFO AppDaemon: Starting Apps
2018-03-04 19:18:26.063081 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2018-03-04 19:18:26.157172 INFO AppDaemon: HASS: HASS Plugin Initializing
2018-03-04 19:18:26.161031 INFO AppDaemon: HASS: HASS Plugin initialization complete
2018-03-04 19:18:26.165516 INFO Dashboards are disabled
2018-03-04 19:18:26.167835 INFO Starting API
2018-03-04 19:18:26.192287 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-03-04 19:18:31.203111 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-03-04 19:18:36.212193 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-03-04 19:18:41.219426 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-03-04 19:18:46.229571 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-03-04 19:18:51.236339 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-03-04 19:18:56.243360 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-03-04 19:19:01.250785 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-03-04 19:19:06.258135 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-03-04 19:19:11.265041 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-03-04 19:19:16.271866 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-03-04 19:19:21.279156 WARNING AppDaemon: HASS: Disconnected from Home Assistant, retrying in 5 seconds
2018-03-04 19:19:26.788170 INFO AppDaemon: HASS: Connected to Home Assistant 0.64.3
/usr/lib/python3.5/site-packages/appdaemon/plugins/hass/hassplugin.py:266: RuntimeWarning: coroutine 'AppDaemon.state_update' was never awaited
  self.AD.state_update(self.namespace, {"event_type": "ha_disconnected", "data": {}})
2018-03-04 19:19:28.789270 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: latitude
2018-03-04 19:19:28.789947 ERROR AppDaemon: AppDaemon is terminating
close status: 31522
2018-03-04 19:19:28.794961 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: longitude
2018-03-04 19:19:28.795716 ERROR AppDaemon: AppDaemon is terminating
2018-03-04 19:19:28.797211 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: elevation
2018-03-04 19:19:28.798243 ERROR AppDaemon: AppDaemon is terminating
2018-03-04 19:19:28.799182 ERROR AppDaemon: Required attribute not set or obtainable from any plugin: time_zone
2018-03-04 19:19:28.800264 ERROR AppDaemon: AppDaemon is terminating
2018-03-04 19:19:28.915013 INFO AppDaemon: HASS: Disconnecting from Home Assistant
2018-03-04 19:19:28.916963 INFO AppDeamon Exited
2018-03-04 19:19:29,228 INFO exited: appdaemon (exit status 0; expected)

When I restart both HA and AppDaemon again, everything starts properly.

seems to me that HA didnt set the latitude before its announcing that its running.
i would set a pause (from around 90 seconds) in the service startup from appdaemon.
that way HA is completely running before AD starts.

Just released the AppDaemon3 v0.2.0 add-on, containing v3.0.0b4.

1 Like

That will probably work for b4, thanks Rene. This looks like it was a small bug in the retry code, it will be fixed in the next release.

If you still can’t get this to work in the meantime, you can add a ;latitude directive to your appdaemon.yaml file under the appdaemon section. You will also likely need longitude, elevation and time_zone as well like this:

appdaemon:
...
  latitude: 40.0
  longitude: -73.0
  elevation: 16
  time_zone: America/New_York

However this should be fixed in the nexy beta and you can remove the directives.

1 Like

i have a delay in my appdaemon startup anyway, because HA takes ages to start and i dont want my AD log to start with 100 warnings that HA isnt connected :wink:

1 Like

OK…this one is weird. Consider this app:

import appdaemon.plugins.hass.hassapi as hass
#import appdaemon.appapi as appapi
import globals

class switches(hass.Hass):
#
# testing
#
     def initialize(self):
        self.log("Initializing Test #2")
        self.turn_off("input_boolean.heat_toms_office")
        self.log("1")
        self.listen_state(self.dummy,
                          globals.office_heater,
                          new="off", old="on")
        self.log("2")
     def dummy(self, entity, attribute, old, new, kwargs):
        self.log("dummy")
        return

If (and only if!) input_boolean.heat_toms_office is on, as soon as I write this app file, AppDaemon hangs - the only way to get it going again is to restart it (systemctl restart [email protected]).

Here’s the log when the input boolean is off (I tail both the normal log and the error log for Appdaemon):

2018-03-05 11:03:14.858908 INFO AppDaemon: Terminating t2
2018-03-05 11:03:14.859843 INFO AppDaemon: Reloading Module: /home/homeassistant/conf/apps/t2.py
2018-03-05 11:03:14.863269 INFO AppDaemon: Initializing app t2 using class switches from module t2
2018-03-05 11:03:14.866882 INFO t2: Initializing Test #2
2018-03-05 11:03:14.910390 INFO t2: 1
2018-03-05 11:03:14.913343 INFO t2: 2

2018-03-05 11:03:19.956024 INFO AppDaemon: Terminating t2
2018-03-05 11:03:19.956795 INFO AppDaemon: Reloading Module: /home/homeassistant/conf/apps/t2.py
2018-03-05 11:03:19.960329 INFO AppDaemon: Initializing app t2 using class switches from module t2
2018-03-05 11:03:19.963347 INFO t2: Initializing Test #2
2018-03-05 11:03:19.996942 INFO t2: 1
2018-03-05 11:03:19.999975 INFO t2: 2

I did two separate writes of the file.

Here’s what it looks like when the input boolean is on:

2018-03-05 11:05:03.800818 INFO AppDaemon: Terminating t2
2018-03-05 11:05:03.801809 INFO AppDaemon: Reloading Module: /home/homeassistant/conf/apps/t2.py
2018-03-05 11:05:03.805103 INFO AppDaemon: Initializing app t2 using class switches from module t2
2018-03-05 11:05:03.808020 INFO t2: Initializing Test #2
2018-03-05 11:05:03.876746 INFO t2: 1

At this point I can write the file as much as I want - AppDaemon is hung, the only thing I can do is restart it.

Weird…right?

Tom

1 Like

Very interesting - I have also heard something similar from @turboc, but your example app should make this a lot easier to track down. I think the culprit may be in some additional locking I added to the AppDaemon data structures in b4 but I’ll need to figure out why exactly it’s causing a problem.

2 Likes

Awesome - let me know if I can do anything to clarify or test for you.

Thanks,

Tom

1 Like

OK, I just reproduced it with the help of your app - looking at a fix now, thanks!

LOL - good deal - glad my efforts to cut it down to the bare essentials helped!

Tom

1 Like

OK, I have a fix for this in the code. Since this is fairly serious I’ll release an update later today.

1 Like

We have a new release, so closing this thread.

1 Like