core: WebOS failing to set up after updating to a version newer than 2021.3.4
The problem
After updating to a new version (I tried every major update since 2021.3.4) the WebOS TV integration fails to set up due to some database error (more in the logs below).
I’m not using the default recorder, but an external one (Portainer); even if it has been this way since January, so I would rule that out as a possible problem.
What is version of Home Assistant Core has the issue?
2021.4.0b0
What was the last working version of Home Assistant Core?
2021.3.4
What type of installation are you running?
Home Assistant Container
Integration causing the issue
WebOS TV
Link to integration documentation on our website
https://www.home-assistant.io/integrations/webostv/
Example YAML snippet
# LG TV
webostv:
host: x.x.x.x
name: "kitchen_wall_tv_lg"
customize:
sources:
- Live TV
- Apple TV
turn_on_action:
service: wake_on_lan.send_magic_packet
data:
mac: "xx:xx:xx:xx:xx:xx"
Anything in the logs that might be useful for us?
2021-07-02 16:42:11 WARNING (SyncWorker_2) [homeassistant.components.webostv] LG webOS TV client-key file is being migrated to Sqlite!
--
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread] Inner exception:
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread] File "/usr/local/lib/python3.9/threading.py", line 912, in _bootstrap
self._bootstrap_inner()
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread] File "/usr/local/lib/python3.9/threading.py", line 954, in _bootstrap_inner
self.run()
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread] File "/usr/local/lib/python3.9/site-packages/sqlitedict.py", line 417, in run
inner_stack = traceback.extract_stack()
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread]
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread] sqlite3.OperationalError: database is locked
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread]
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread] Outer stack:
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread] File "/usr/local/lib/python3.9/threading.py", line 912, in _bootstrap
self._bootstrap_inner()
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread] File "/usr/local/lib/python3.9/threading.py", line 954, in _bootstrap_inner
self.run()
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread] File "/usr/local/lib/python3.9/threading.py", line 892, in run
self._target(*self._args, **self._kwargs)
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread] File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 77, in _worker
work_item.run()
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread] File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread] File "/usr/src/homeassistant/homeassistant/components/webostv/__init__.py", line 129, in convert_client_keys
with SqliteDict(config_file) as conf:
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread] File "/usr/local/lib/python3.9/site-packages/sqlitedict.py", line 173, in __init__
self.conn.execute(MAKE_TABLE)
2021-07-02 16:42:16 ERROR (Thread-4) [sqlitedict.SqliteMultithread] Exception will be re-raised at next call.
2021-07-02 16:42:16 ERROR (SyncWorker_2) [sqlitedict.SqliteMultithread] An exception occurred from a previous statement, view the logging namespace "sqlitedict" for outer stack.
2021-07-02 16:42:16 ERROR (MainThread) [homeassistant.setup] Error during setup of component webostv
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 249, in _async_setup_component
result = await task
File "/usr/src/homeassistant/homeassistant/components/webostv/__init__.py", line 103, in async_setup
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/components/webostv/__init__.py", line 140, in async_setup_tv
await hass.async_add_executor_job(convert_client_keys, config_file)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/webostv/__init__.py", line 129, in convert_client_keys
with SqliteDict(config_file) as conf:
File "/usr/local/lib/python3.9/site-packages/sqlitedict.py", line 174, in __init__
self.conn.commit()
File "/usr/local/lib/python3.9/site-packages/sqlitedict.py", line 530, in commit
self.select_one('--commit--')
File "/usr/local/lib/python3.9/site-packages/sqlitedict.py", line 520, in select_one
return next(iter(self.select(req, arg)))
File "/usr/local/lib/python3.9/site-packages/sqlitedict.py", line 512, in select
self.check_raise_error()
File "/usr/local/lib/python3.9/site-packages/sqlitedict.py", line 480, in check_raise_error
reraise(e_type, e_value, e_tb)
File "/usr/local/lib/python3.9/site-packages/sqlitedict.py", line 68, in reraise
raise value
File "/usr/local/lib/python3.9/site-packages/sqlitedict.py", line 414, in run
cursor.execute(req, arg)
sqlite3.OperationalError: database is locked
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 15 (6 by maintainers)
Closing this as the keys file migration to Sqlite is dropped from the code, Please create a new issue (better) or reopen this one if you still have problems with core 2022.02 (should be in beta end of next week)
I’ve been having the same issue, and finally decided to look into it. Since the integration wasn’t working anyway, I deleted the webostv.conf file (odd name, since it’s a SQLite db), cleared all pairings on the TV, and restarted HA.
HA notifies me that the TV needs to be paired. Cool. Click the button to initiate pairing and the TV prompts me to accept it. Cool. Accept the request on the TV… Nothing. The dialog in HA appears to time out after a few more seconds, and then the button to pair is enabled again. Closed the dialog and checked entities. No entry for the TV. Went back to the notification to pair the TV again. Clicked the button to pair… Nothing. No notification on the TV. Dialog behaves the same as before. No entity.
If I clear pairings on the TV and try to pair from HA again, I get no notice on the TV. If I also restart HA, I do get the notice to pair on the TV after clicking the button in HA.
Watching the logs in docker isn’t showing anything useful at all. Literally the only message I see in the logs mentioning that integration is
WARNING (MainThread) [homeassistant.components.webostv] LG webOS TV 10.2.100.124 needs to be paired
There is no other information written to the log.
The newly-created webostv.conf file, when opened in sqlite, contains a single table, called “unnamed,” with one row, containing the IP of the TV and a BLOB.
Here’s a dump of it.
2021.4.0b0 introduced migration for the configuration file into the DB (https://github.com/home-assistant/core/pull/47014) The message about migration can be seen in your log:
I assume there is some compatibility issue with our DB, can you add information of the DB engine you use? is it setup to use
utf8mb4
charset?