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

Does this still work? #25

Closed ASNNetworks closed 3 years ago

ASNNetworks commented 3 years ago

Does this module still even work? I installed and have set up everything, but none of my lights seem to turn on, while they were on during the same times for the last 7 days. Installed through HACS, this is my config:

replay_lights:
  hassDir: '/config'
  databaseType: sqlite3
  databaseHost: "localhost"
  databaseSchema: "homeassistant"
  module: replay_lights
  class: ReplayLights
  numberOfDaysBack: 7
  deviceType: "light"
  enableTag: "input_boolean.scene_vakantie"
  enableVal: "on"
  excludeList: "light.woonkamer_z_lampen,light.z_lampen_kamers,light.wc_z_lampen,light.gang_boven_z_lampen,light.woonkamer_z_disco"  
Mohlsson commented 3 years ago

My installation still works. There are a number of things that can make it fail though. Can you check the log from HA/Supervisor/AppDaemon/Log where this module logs what it does. There may be clues to what is happening there.

ASNNetworks commented 3 years ago

error.log shows:

2021-07-04 19:07:46.776600 WARNING replay_lights: ------------------------------------------------------------
2021-07-04 19:50:33.549508 WARNING replay_lights: ------------------------------------------------------------
2021-07-04 19:50:33.550527 WARNING replay_lights: Unexpected error initializing app: replay_lights:
2021-07-04 19:50:33.551201 WARNING replay_lights: ------------------------------------------------------------
2021-07-04 19:50:33.552419 WARNING replay_lights: Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 996, in check_app_updates
    await self.init_object(app)
  File "/usr/lib/python3.8/site-packages/appdaemon/app_management.py", line 315, in init_object
    modname = await utils.run_in_executor(self, __import__, app_args["module"])
  File "/usr/lib/python3.8/site-packages/appdaemon/utils.py", line 299, 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 "/config/appdaemon/apps/ReplayLightsHistory/replay_lights.py", line 2, in <module>
    import pymysql.cursors
ModuleNotFoundError: No module named 'pymysql'

2021-07-04 19:50:33.553165 WARNING replay_lights: -----

appdaemon.log shows:

2021-07-04 19:50:33.542672 INFO AppDaemon: Initializing app replay_lights using class ReplayLights from module replay_lights
2021-07-04 19:50:33.553925 WARNING AppDaemon: Logged an error to /config/appdaemon/logs/error.log
2021-07-04 19:50:33.556057 WARNING AppDaemon: Unable to find module replay_lights - initialize() skipped
Mohlsson commented 3 years ago

Looks like you are using MariaDB and did not install PyMySQL. Check the last paragraph in the readme.

ASNNetworks commented 3 years ago

Looks like you are using MariaDB and did not install PyMySQL. Check the last paragraph in the readme.

I have MariaDB installed, but I only use that for NGINX. I still use the recorder of HA and have home-assistant_v2.db. So this works with either MariaDB or PyMySQL? I thought I could just use the normal recorder integration.

Mohlsson commented 3 years ago

I see now that the change made a while ago for MariaDB requires all installations to have PyMySQL, try to install this and test again.

ASNNetworks commented 3 years ago

But I don't use MariaDB for the recorder. All my history is saved using default HA, in the home-assistant_v2.db file. What good will having PyMySQL do, if my history is not recorded in MariaDB?

Mohlsson commented 3 years ago

Sorry, as the code look right now PyMySQL must be installed. If you want to change it, it is fine by me, unfortunately I do not have the time to do it. If you change it, do a pull request and I will merge it into this repository.