Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error #28

Open
Axydas opened this issue Jan 5, 2023 · 4 comments
Open

Error #28

Axydas opened this issue Jan 5, 2023 · 4 comments

Comments

@Axydas
Copy link

Axydas commented Jan 5, 2023

Somebody can help me please? I am getting the below error when i start the AppDeamon:

2023-01-05 14:49:48.246531 INFO replay_lights: started
2023-01-05 14:49:48.247819 INFO replay_lights: Defaulting Home Assistant config directory to /config
2023-01-05 14:49:48.250710 INFO AppDaemon: App initialization complete
2023-01-05 14:49:53.004592 INFO replay_lights: Scheduling Replaying 7 day[s] back
2023-01-05 14:49:53.004849 WARNING replay_lights: ------------------------------------------------------------
2023-01-05 14:49:53.005069 WARNING replay_lights: Unexpected error in worker for App replay_lights:
2023-01-05 14:49:53.005288 WARNING replay_lights: Worker Ags: {'id': '48ab0c12ac2b4fa194a248c1c9b4f5bc', 'name': 'replay_lights', 'objectid': '002323eb3a384000ac83a6d57d6750dd', 'type': 'scheduler', 'function': <bound method ReplayLights.scheduleNextEventBatch of <replay_lights.ReplayLights object at 0x7f777cfcf610>>, 'pin_app': True, 'pin_thread': 5, 'kwargs': {'interval': 3600, '__thread_id': 'thread-5'}}
2023-01-05 14:49:53.005537 WARNING replay_lights: ------------------------------------------------------------
2023-01-05 14:49:53.006016 WARNING replay_lights: Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/appdaemon/threading.py", line 904, in worker
funcref(self.AD.sched.sanitize_timer_kwargs(app, args["kwargs"]))
File "/config/appdaemon/apps/ReplayLightsHistory/replay_lights.py", line 108, in scheduleNextEventBatch
for entity_id, event_new_state, c_date in result:
UnboundLocalError: local variable 'result' referenced before assignment
2023-01-05 14:49:53.006220 WARNING replay_lights: ------------------------------------------------------------

@Mohlsson
Copy link
Owner

Sorry about the delay. The error indicates that replay lights cant find your database type or has an error when reading the database. Have you configured replay_lights correctly in appdaemon/apps/apps.yaml. The log should include "Defaulting Database...". Check that databaseType is sqlite3 or MariaDB.

@Axydas
Copy link
Author

Axydas commented Jan 23, 2023

Yes i am using mariaDB

Here is my configuration:

replay_lights:
#hassDir: '/home/jondoe/.homeassistant'
databaseType: mariadb
databaseHost: "localhost"
databaseUser: "xxxxxx"
databasePassword: "xxx
xxx"
databaseSchema: "xxx***xxx"
module: replay_lights
class: ReplayLights
numberOfDaysBack: 7
deviceType: "light"
enableTag: "binary_sensor.alarm_status"
enableVal: "on"
#smartControlledByDumb: "switch.master_bed,switch.living_room_lamp"
excludeList: "light.office_light_lt,light.second_room_lamp_lt,light.third_room_lamp_lt"

@Axydas
Copy link
Author

Axydas commented Jan 23, 2023

Update after a small change. I change the databaseType to MariaDB (case sensitive) and now i am getting a different error:

2023-01-23 10:36:41.071328 INFO replay_lights: started
2023-01-23 10:36:41.072118 INFO replay_lights: Defaulting Home Assistant config directory to /config
2023-01-23 10:36:41.074051 INFO AppDaemon: App initialization complete
2023-01-23 10:36:46.004967 INFO replay_lights: Scheduling Replaying 7 day[s] back
2023-01-23 10:36:46.006934 WARNING replay_lights: ------------------------------------------------------------
2023-01-23 10:36:46.007281 WARNING replay_lights: Unexpected error in worker for App replay_lights:
2023-01-23 10:36:46.007618 WARNING replay_lights: Worker Ags: {'id': 'eaef5ac332ad4b0b80f052a744c1f592', 'name': 'replay_lights', 'objectid': '82b2c61c56d441c9bf1cb88b5e269252', 'type': 'scheduler', 'function': <bound method ReplayLights.scheduleNextEventBatch of <replay_lights.ReplayLights object at 0x7efea75be980>>, 'pin_app': True, 'pin_thread': 5, 'kwargs': {'interval': 3600, '__thread_id': 'thread-5'}}
2023-01-23 10:36:46.007929 WARNING replay_lights: ------------------------------------------------------------
2023-01-23 10:36:46.008431 WARNING replay_lights: Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 613, in connect
sock = socket.create_connection(
File "/usr/lib/python3.10/socket.py", line 845, in create_connection
raise err
File "/usr/lib/python3.10/socket.py", line 833, 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.10/site-packages/appdaemon/threading.py", line 904, 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.10/site-packages/pymysql/connections.py", line 353, in init
self.connect()
File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 664, in connect
raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 99] Address not available)")
2023-01-23 10:36:46.008725 WARNING replay_lights: ------------------------------------------------------------

@xkill
Copy link
Contributor

xkill commented Dec 12, 2023

Update after a small change. I change the databaseType to MariaDB (case sensitive) and now i am getting a different error:

2023-01-23 10:36:41.071328 INFO replay_lights: started 2023-01-23 10:36:41.072118 INFO replay_lights: Defaulting Home Assistant config directory to /config 2023-01-23 10:36:41.074051 INFO AppDaemon: App initialization complete 2023-01-23 10:36:46.004967 INFO replay_lights: Scheduling Replaying 7 day[s] back 2023-01-23 10:36:46.006934 WARNING replay_lights: ------------------------------------------------------------ 2023-01-23 10:36:46.007281 WARNING replay_lights: Unexpected error in worker for App replay_lights: 2023-01-23 10:36:46.007618 WARNING replay_lights: Worker Ags: {'id': 'eaef5ac332ad4b0b80f052a744c1f592', 'name': 'replay_lights', 'objectid': '82b2c61c56d441c9bf1cb88b5e269252', 'type': 'scheduler', 'function': <bound method ReplayLights.scheduleNextEventBatch of <replay_lights.ReplayLights object at 0x7efea75be980>>, 'pin_app': True, 'pin_thread': 5, 'kwargs': {'interval': 3600, '__thread_id': 'thread-5'}} 2023-01-23 10:36:46.007929 WARNING replay_lights: ------------------------------------------------------------ 2023-01-23 10:36:46.008431 WARNING replay_lights: Traceback (most recent call last): File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 613, in connect sock = socket.create_connection( File "/usr/lib/python3.10/socket.py", line 845, in create_connection raise err File "/usr/lib/python3.10/socket.py", line 833, 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.10/site-packages/appdaemon/threading.py", line 904, 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.10/site-packages/pymysql/connections.py", line 353, in init self.connect() File "/usr/lib/python3.10/site-packages/pymysql/connections.py", line 664, in connect raise exc pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 99] Address not available)") 2023-01-23 10:36:46.008725 WARNING replay_lights: ------------------------------------------------------------

Seems that the appdaemon cannot connect to the MariaDB service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants