[AppDaemon] Tutorial #1 Tracker-Notifier

It will kind of …

The way the scheduler is constructed, it will catch events scheduled for the current time or earlier so it won’t miss firing the event if it ends up in the schedule to run, say, a second ago. However, SN is correct, there is no point in doing it this way - you can always call a callback directly from your code if you want to, they are after all just Python functions.

1 Like

I am very late to the party for this notification automation via AppDaemon. I am running HA 2023.2.2 and just copied and pasted the code provide at the very top of this string. I added two lines to import the hass api as follows in my door_notifications.py file:

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

I did change the binary sensors for the proper door entity I wish to use in the .py file. I can provide that if necessary, however, my issue lies in the error.log file. I have attached my error below. Any help someone can provide to help me fix this is very much appreciated.

2023-02-05 18:56:58.718392 WARNING door_notifications: ------------------------------------------------------------

2023-02-05 18:56:58.739889 WARNING door_notifications: ------------------------------------------------------------

2023-02-05 18:56:58.740551 WARNING door_notifications: Unexpected error in worker for App door_notifications:

2023-02-05 18:56:58.741123 WARNING door_notifications: Worker Ags: {‘id’: ‘96a5e4608c584957b66785cc44099d17’, ‘name’: ‘door_notifications’, ‘objectid’: ‘44dbfe5c59bb4dc99d81ef2260dfb8ec’, ‘type’: ‘state’, ‘function’: <bound method DoorMonitor.tracker of <door_notifications.DoorMonitor object at 0xffff93206b60>>, ‘attribute’: ‘state’, ‘entity’: ‘binary_sensor.garage_entry_door’, ‘new_state’: ‘on’, ‘old_state’: ‘off’, ‘pin_app’: True, ‘pin_thread’: 8, ‘kwargs’: {‘entity’: ‘binary_sensor.front_door_door’, ‘__thread_id’: ‘thread-8’}}

2023-02-05 18:56:58.741736 WARNING door_notifications: ------------------------------------------------------------

2023-02-05 18:56:58.742544 WARNING door_notifications: Traceback (most recent call last):

File “/usr/lib/python3.10/site-packages/appdaemon/threading.py”, line 917, in worker

funcref(

File “/config/appdaemon/apps/door_notifications/door_notifications.py”, line 23, in tracker

self.door_timer_library[entity] = self.run_in(self.notifier, seconds=int(self.args['ttl']), entity_name=entity)

File “/usr/lib/python3.10/site-packages/appdaemon/utils.py”, line 226, in inner_sync_wrapper

f = run_coroutine_threadsafe(self, coro(self, *args, **kwargs))

TypeError: ADAPI.run_in() missing 1 required positional argument: ‘delay’