Announcement - AppDaemon 3.0 beta 1!

Setting app_dir should still work fine, although I’ll retest it :slight_smile:

It’s also possible that I didn’t properly define is. The actual directory is located at /opt/appdaemon_beta/apps. This definition worked fine in the mainline release though.

It seems that the beta requires dependencies which are not compatible with the latest (0.61.1) version of HASS.

HASS requires:
aiohttp-2.3.7 yarl-0.18.0

AppDaemon Beta requires:
aiohttp-2.3.9 yarl-1.0.0

When the new versions are installed, the Home Assistant frontend (among many other things) will not load. Reinstalling Home Assistant over top of the AppDaemon beta resolves the issue and doesn’t seem to cause any harm to AppDaemon.

appdaemon doesn;t require that late a version, just > 2.2.3. So if you downgrade it to 2.3.7, HASS and AD will both be happy.

This though is why it’s good practice to run them in separate environments

I assume AppDaemon is simply installing the latest?

Correct, yes.

1 Like

Thank you!

1 Like

HA should just be up to date with the latest version :stuck_out_tongue:
but i am glad for the headsup

2018-01-19 21:19:44.436726 WARNING AppDaemon: ------------------------------------------------------------
2018-01-19 21:19:44.436974 WARNING AppDaemon: Unexpected error in worker for App Brita Notification:
2018-01-19 21:19:44.437153 WARNING AppDaemon: Worker Ags: {'name': 'Brita Notification', 'attribute': 'state', 'kwargs': {}, 'entity': 'sensor.brita_filter_change', 'old_state': 'False', 'id': UUID('b51cbe09-5113-48b5-abfd-c64aae847ceb'), 'function': <bound method Notify.evaluate_notice of <countdown_notify.Notify object at 0x7f6e6f984390>>, 'type': 'attr', 'new_state': 'False'}
2018-01-19 21:19:44.437259 WARNING AppDaemon: ------------------------------------------------------------
2018-01-19 21:19:44.437445 WARNING AppDaemon: Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/appdaemon/appdaemon.py", line 401, in worker
    self.sanitize_state_kwargs(app, args["kwargs"]))
  File "/opt/appdaemon/apps/countdown_notify.py", line 14, in evaluate_notice
    days_remaining = self.get_state(entity, "days_remaining")
TypeError: get_state() takes from 1 to 2 positional arguments but 3 were given

/opt/appdaemon/apps/countdown_notify.py:

import appdaemon.plugins.hass.hassapi as hass

"""
Notifies the specified notifier on
the days you specify.
"""

class Notify(hass.Hass):
  def initialize(self):
    if "countdown_entity" in self.args:
      self.listen_state(self.evaluate_notice, self.args["countdown_entity"])

  def evaluate_notice(self, entity, attribute, old, new, kwargs):
    days_remaining = self.get_state(entity, "days_remaining")
    entity_friendly_name = self.get_state(entity, "friendly_name")

    if type(self.args["notification_days"]) == int:
      notification_days = [self.args["notification_days"]]
    else:
      notification_days = [int(day) for day in self.args["notification_days"].split(",")]

    if days_remaining in notification_days:
      self.send_notice()
    elif self.args["notify_overdue"] and days_remaining < 0:
      self.send_notice()

  def send_notice(self):
    self.log("Sending notification")
    self.call_service("notify/" + self.args["notify"], message = self.args["message"])
    self.call_service("persistent_notification/create", message = self.args["message"])

/opt/appdaemon/apps/apps.yaml:

  module: countdown_notify
  class: Notify
  countdown_entity: sensor.brita_filter_change
  notification_days: 0 #A mandatory list of when to notify, can be 1 or more value, eg: 1,2,7,30
  notify_overdue: True #An optional argument, if true we will continue to notify after 0
  notify: home_assistant #The name of the notify service
  message: "It's time to change the Brita filter!"

You were right… I’m sure that I tried a lot but somehow the browser got stuck.

I have now installed the latest HA 0.61, reinstalled appdaemon 3.0.0b1, restarted everything and cleared the browser cash.

And voilà, it works

2 Likes

Try changing this:

self.get_state(entity, "days_remaining")

to:

self.get_state(entity, attribute="days_remaining")

Not sure if this is new or bug, any idea @aimc

1 Like

@ReneTode I managed to build a add-on for hassio and got the beta working.
It’s not very refined as I built it for personal use only.

nice @matt2005 you could always share it, with people that would like it.
but i am glad that you can use AD 3.0 now (dont be mad when i send people to you when they ask how :wink: )

No, this is correct behavior and hasn’t changed recently. If the docs are wrong somewhere let me know.

Very interesting. The “workaround” fixed it. In previous versions my originally posted code worked. Thanks @snjoetw!

2 Likes

I noticed that after updating to Version 3.0 b1 my yamaha media_players-widgets doesn’t show the media title anymore when i listen to NET-RADIO-Streams. Before it did work correctly.

When I activate bluetooth and stream from my mobile device to the Yamaha Receiver all informations are being showed correctly.
A similar error appears with my mussiccast device where with NET RADIO Streaming only the station (media_artist) is shown and the media_title and media_track ist not shown.

In HA everything is shown correctly as you can see in the following screenshots:

@ReneTode Here is a modified version of the appdaemon add-on for hassio.
Appdaemon
I haven’t had chance to set up as a repo so you need to copy the appdaemonmatt folder to /addons
Once installed you need to change the version configuration option to 3.0.0b1
This will install the beta, it will reinstall on each restart.
You will need to manually fix the appdaemon config and apps.

if people want it i will point them to it.

I can’t get the duration in listen_state to work. It triggers instantly the callback, regards the amount of time I set it up.
Has anything changed for that?
I’ve no errors in log, it just fires
EDIT: This is my app, look that is the simpliest app I have

import appdaemon.plugins.hass.hassapi as hass
import datetime

class luz_wc_pasillo(hass.Hass):

    def initialize(self):
        self.listen_state(self.movimiento_wc, "binary_sensor.movimiento14_14_0", new="on")
        self.listen_state(self.movimiento_wc_off, "binary_sensor.movimiento14_14_0", new="off", duration=self.args["duracion"])

    def movimiento_wc(self, entity, attribute, old, new, kwargs):
        if self.get_state("light.wc_pasillo") == "off":
            self.turn_on("light.wc_pasillo")

    def movimiento_wc_off(self, entity, attribute, old, new, kwargs):
        if self.get_state("light.wc_pasillo") == "on":
            self.turn_off("light.wc_pasillo")

You may need to convert the duration argument to an int.

1 Like