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

Error in appdeamon ligs #2

Closed w1tw0lf closed 4 years ago

w1tw0lf commented 4 years ago

Getting the following errors 2020-02-02 08:40:35.285584 INFO AppDaemon: Loading App Module: /config/appdaemon/apps/replay_lights.py 2020-02-02 08:40:35.289347 WARNING Error: ------------------------------------------------------------ 2020-02-02 08:40:35.290279 WARNING Error: Unexpected error loading module: /config/appdaemon/apps/replay_lights.py: 2020-02-02 08:40:35.291258 WARNING Error: ------------------------------------------------------------ 2020-02-02 08:40:35.295300 WARNING Error: Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 788, in check_app_updates await utils.run_in_executor(self, self.read_app, mod["name"], mod["reload"]) File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 276, in run_in_executor response = future.result() File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 580, in read_app self.modules[module_name] = importlib.import_module(module_name) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 779, in exec_module File "<frozen importlib._bootstrap_external>", line 916, in get_code File "<frozen importlib._bootstrap_external>", line 846, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/config/appdaemon/apps/replay_lights.py", line 26 for row in c.execute(f'SELECT event_data FROM events WHERE time_fired > datetime("now","localtime","-{self.numberOfDaysBack} days","+1 minutes") AND time_fired < datetime("now","localtime","-{self.numberOfDaysBack} days","+61 minut$ try:

in appdeamon it shows the app has terminated.

Mohlsson commented 4 years ago

Are you using the default SQLite database for Home Assistant?

w1tw0lf commented 4 years ago

Yip, default SQLite

w1tw0lf commented 4 years ago

Just had a look at replay_lights.py and seems for me that lin 26 is missing things at the end of the line.

for row in c.execute(f'SELECT event_data FROM events WHERE time_fired > datetime("now","localtime","-{self.numberOfDaysBack} days","+1 minutes") AND time_fired < datetime("now","localtime","-{self.numberOfDaysBack} days","+61 minut$ try:

Mohlsson commented 4 years ago

Oups, I did commit with a truncated line. Fixed now, please try again.

w1tw0lf commented 4 years ago

Thanks that solved that part.