Mohlsson / ReplayLightsHistory

AppDaemon App for Home Assistant to replay light switch history when no one is home.
Apache License 2.0
29 stars 5 forks source link

Unable to start the app #21

Closed gdsjgh closed 3 years ago

gdsjgh commented 4 years ago

Hi,

The app seems to be unable to start in AppDaemon. I get the following error message but don't really know how to make sense of it. Do you need any other data to debug?

[22:18:14] INFO: Starting AppDaemon...
2020-08-16 22:18:16.255588 INFO AppDaemon: AppDaemon Version 4.0.3 starting
2020-08-16 22:18:16.257261 INFO AppDaemon: Python version is 3.8.2
2020-08-16 22:18:16.258157 INFO AppDaemon: Configuration read from: /config/appdaemon/appdaemon.yaml
2020-08-16 22:18:16.258918 INFO AppDaemon: Added log: AppDaemon
2020-08-16 22:18:16.259974 INFO AppDaemon: Added log: Error
2020-08-16 22:18:16.260823 INFO AppDaemon: Added log: Access
2020-08-16 22:18:16.261597 INFO AppDaemon: Added log: Diag
2020-08-16 22:18:16.310031 INFO AppDaemon: Loading Plugin HASS using class HassPlugin from module hassplugin
2020-08-16 22:18:16.358293 INFO HASS: HASS Plugin Initializing
2020-08-16 22:18:16.359421 INFO HASS: HASS Plugin initialization complete
2020-08-16 22:18:16.361227 INFO AppDaemon: HTTP is disabled
2020-08-16 22:18:16.484223 INFO HASS: Connected to Home Assistant 0.114.0
2020-08-16 22:18:16.573139 INFO AppDaemon: App 'replay_lights' added
2020-08-16 22:18:16.575248 INFO AppDaemon: Found 1 total apps
2020-08-16 22:18:16.576543 INFO AppDaemon: Starting Apps with 1 workers and 1 pins
2020-08-16 22:18:16.694509 INFO HASS: Evaluating startup conditions
2020-08-16 22:18:16.814865 INFO AppDaemon: Got initial state from namespace default
2020-08-16 22:18:18.583307 INFO AppDaemon: Scheduler running in realtime
2020-08-16 22:18:18.589276 INFO AppDaemon: Adding /config/appdaemon/apps to module import path
2020-08-16 22:18:18.590977 INFO AppDaemon: Adding /config/appdaemon/apps/ReplayLightsHistory to module import path
2020-08-16 22:18:18.596445 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/ReplayLightsHistory/replay_lights.py
2020-08-16 22:18:18.728178 INFO AppDaemon: Initializing app replay_lights using class ReplayLights from module replay_lights
2020-08-16 22:18:18.730747 WARNING replay_lights: ------------------------------------------------------------
2020-08-16 22:18:18.732785 WARNING replay_lights: Unexpected error initializing app: replay_lights:
2020-08-16 22:18:18.733720 WARNING replay_lights: ------------------------------------------------------------
2020-08-16 22:18:18.737206 WARNING replay_lights: Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 820, in check_app_updates
    await self.init_object(app)
  File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 279, in init_object
    "object": app_class(
  File "/usr/lib/python3.8/site-packages/appdaemon/plugins/hass/hassapi.py", line 46, in __init__
    adbase.ADBase.__init__(self, ad, name, logging, args, config, app_config, global_vars)
  File "/usr/lib/python3.8/site-packages/appdaemon/adbase.py", line 75, in __init__
    self.dashboard_dir = self.AD.http.dashboard_dir
AttributeError: 'NoneType' object has no attribute 'dashboard_dir'
2020-08-16 22:18:18.738229 WARNING replay_lights: ------------------------------------------------------------
2020-08-16 22:18:18.739627 WARNING AppDaemon: Unable to find module replay_lights - initialize() skipped
2020-08-16 22:18:18.741381 INFO AppDaemon: App initialization complete
Mohlsson commented 4 years ago

Unfortunately I am not an expert on AppDaemon but I found a very similar question at https://community.home-assistant.io/t/appdaemon-unable-to-find-modules-while-initializing/180112

This is how my appdaemon.yaml looks: secrets: /config/secrets.yaml log: logfile: STDOUT errorfile: STDERR appdaemon: threads: 10 app_dir: /config/appdaemon/apps plugins: HASS: type: hass ha_url: http://hassio/homeassistant hadashboard: dash_url: http://127.0.0.1:5050 dash_dir: /config/appdaemon/dashboards

I hope you can solve it from this. /Martin

gdsjgh commented 4 years ago

Hi,

Thanks for the tip. I got it working now.

You simply need to add this in the config. No idea why. But it works

http:
  url: !secret appdaemon_http_url

Bonus question: when adding the input_number.replay_days_back in the config. Does the app refresh itself the number of days in the input_number variable changes? I can't see any ack of the changes being referred to in the logs.

Thanks!

Mohlsson commented 4 years ago

In my experience the app is only reloaded when there are changes to the python file. You can always restart AppDaemon and the apps will be reloaded with new settings.