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

Unexpected error in worker for App replay_lights #23

Closed duckbert closed 3 years ago

duckbert commented 3 years ago

Dear all,

with the latest version I am unfortunately getting this error: 2020-09-14 12:10:15.026563 INFO replay_lights: Scheduling Replaying 7 day[s] back 2020-09-14 12:10:15.030449 WARNING replay_lights: ------------------------------------------------------------ 2020-09-14 12:10:15.031344 WARNING replay_lights: Unexpected error in worker for App replay_lights: 2020-09-14 12:10:15.032160 WARNING replay_lights: Worker Ags: {'id': '33e8f7c6936f4f48a46e2eb390a02978', 'name': 'replay_lights', 'objectid': 'c4afaed880854d3e814f46db3bd56172', 'type': 'scheduler', 'function': <bound method ReplayLights.scheduleNextEventBatch of <replay_lights.ReplayLights object at 0xb57e3dc0>>, 'pin_app': True, 'pin_thread': 1, 'kwargs': {'interval': 3600, '__thread_id': 'thread-1'}} 2020-09-14 12:10:15.033184 WARNING replay_lights: ------------------------------------------------------------ 2020-09-14 12:10:15.034627 WARNING replay_lights: Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/pymysql/connections.py", line 569, in connect sock = socket.create_connection( File "/usr/lib/python3.8/socket.py", line 808, in create_connection raise err File "/usr/lib/python3.8/socket.py", line 796, in create_connection sock.connect(sa) OSError: [Errno 99] Address not available During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/appdaemon/threading.py", line 887, in worker funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"])) File "/config/appdaemon/apps/ReplayLightsHistory/replay_lights.py", line 99, in scheduleNextEventBatch conn = pymysql.connect(host=self.databaseHost, user=self.databaseUser, password=self.databasePassword, db=self.databaseSchema, charset='utf8') File "/usr/lib/python3.8/site-packages/pymysql/init.py", line 94, in Connect return Connection(*args, **kwargs) File "/usr/lib/python3.8/site-packages/pymysql/connections.py", line 327, in init self.connect() File "/usr/lib/python3.8/site-packages/pymysql/connections.py", line 619, in connect raise exc pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 99] Address not available)") 2020-09-14 12:10:15.038063 WARNING replay_lights: ------------------------------------------------------------

ReplayLightsHistory worked nicely before. My config is as follows:

replay_lights: databaseType: MariaDB databaseUser: "homeassistant" databasePassword: **** module: replay_lights class: ReplayLights numberOfDaysBack: 7 deviceType: "light" enableTag: "input_boolean.light_replay_enabled" enableVal: "on" smartControlledByDumb: "light.bad_spot_1_2,light.bad_spot_2_2,light.bad_spot_3_2,light.buro_spot_1_2,light.buro_spot_2_2,light.buro_spot_3_2,light.buro_spot_4_2,light.elternlicht_2,light.esstischlampe_2,light.flur_spot_1_2,light.flur_spot_2_2,light.flur_spot_3_2,light.flur_spot_4_2,light.flur_spot_5_2,light.hue_ambiance_panel_1_2,light.hue_lightstrip_outdoor_1_2,light.hue_outdoor_spot_1_2,light.hue_outdoor_spot_2_2,light.insel_spot_1_2,light.insel_spot_2_2,light.kinderzimmerlampe_2,light.kinderzimmerlicht,light.kuchen_spot_1_2,light.kuchen_spot_2_2,light.kuchen_spot_3_2,light.kuchen_spot_4_2,light.kuchen_spot_5_2,light.stehlampe_2,light.treppenlicht_2,light.vorplatzlicht_1_2,light.vorplatzlicht_2_2,light.vorplatzlicht_3_2,light.wohnzimmerlampe_2" excludeList: "light.aussen,light.badezimmer,light.buero,light.carport,light.dachgeschoss,light.deck,light.elternschlafzimmer,light.entree,light.entree_spot_1_2,light.entree_spot_2_2,light.erdgeschoss,light.esszimmer,light.haus,light.kellerflur,light.kellertreppe,light.kinderschlafzimmer,light.kuche"

Mohlsson commented 3 years ago

I think you are missing the databaseHost configuration. Try with: databaseHost: "localhost" or databaseHost: "127.0.0.1"

Mohlsson commented 3 years ago

Any luck fixing this?

duckbert commented 3 years ago

Hi, Sorry for the late response. You were absolutely right. I had to provide the IP for the database host, the default „localhost“ stopped working for me (I blame my router config but hadn’t had the time to check)