Hi @dgomes thanks for your reply!
I just commented out all of the queries except the 1st one and restarted. Still getting errors.
For reference the whole log file since restart:
2018-03-06 22:52:52 ERROR (SyncWorker_12) [sqlalchemy.pool.NullPool] Error closing cursor
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/engine/result.py", line 1186, in fetchone
row = self._fetchone_impl()
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/engine/result.py", line 1067, in _fetchone_impl
return self.cursor.fetchone()
sqlite3.ProgrammingError: Cannot operate on a closed database.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1288, in _safe_close_cursor
cursor.close()
sqlite3.ProgrammingError: Cannot operate on a closed database.
2018-03-06 22:52:52 ERROR (MainThread) [homeassistant.components.sensor] sql: Error on device update!
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/engine/result.py", line 1186, in fetchone
row = self._fetchone_impl()
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/engine/result.py", line 1067, in _fetchone_impl
return self.cursor.fetchone()
sqlite3.ProgrammingError: Cannot operate on a closed database.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 197, in _async_add_entity
yield from entity.async_device_update(warning=False)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 327, in async_device_update
yield from self.hass.async_add_job(self.update)
File "/usr/local/lib/python3.6/asyncio/futures.py", line 327, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/local/lib/python3.6/asyncio/tasks.py", line 250, in _wakeup
future.result()
File "/usr/local/lib/python3.6/asyncio/futures.py", line 243, in result
raise self._exception
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/sensor/sql.py", line 132, in update
for res in result:
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/engine/result.py", line 868, in __iter__
row = self.fetchone()
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/engine/result.py", line 1195, in fetchone
self.cursor, self.context)
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception
exc_info
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
raise value.with_traceback(tb)
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/engine/result.py", line 1186, in fetchone
row = self._fetchone_impl()
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/engine/result.py", line 1067, in _fetchone_impl
return self.cursor.fetchone()
sqlalchemy.exc.ProgrammingError: (sqlite3.ProgrammingError) Cannot operate on a closed database. (Background on this error at: http://sqlalche.me/e/f405)
2018-03-06 22:53:45 ERROR (SyncWorker_14) [sqlalchemy.pool.NullPool] Exception during reset or similar
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/pool.py", line 703, in _finalize_fairy
fairy._reset(pool)
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/pool.py", line 873, in _reset
pool._dialect.do_rollback(self)
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 457, in do_rollback
dbapi_connection.rollback()
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id 1774896240 and this is thread id 1808450672
2018-03-06 22:53:45 ERROR (SyncWorker_14) [sqlalchemy.pool.NullPool] Exception closing connection <sqlite3.Connection object at 0x688b0420>
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/pool.py", line 703, in _finalize_fairy
fairy._reset(pool)
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/pool.py", line 873, in _reset
pool._dialect.do_rollback(self)
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 457, in do_rollback
dbapi_connection.rollback()
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id 1774896240 and this is thread id 1808450672
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/pool.py", line 317, in _close_connection
self._dialect.do_close(connection)
File "/srv/homeassistant/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 463, in do_close
dbapi_connection.close()
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread.The object was created in thread id 1774896240 and this is thread id 1808450672
It’s strange, looks like the DB file is not being opened (it exists and works, i just checked with sqlite CLI and also the meterreads are being loaded succesfully. I wonder if something did not go correctly with the upgrade but the history recorder is working, so not sure. (running Python 3.6.4 btw)
Johan