Core: recorder error every few seconds

Created on 7 Oct 2020  路  28Comments  路  Source: home-assistant/core

The problem

Every few seconds an error like this occurs

Environment

arch | armv7l
-- | --
chassis | 聽
dev | false
docker | true
docker_version | 19.03.12
hassio | true
host_os | Raspbian GNU/Linux 10 (buster)
installation_type | Home Assistant Supervised
os_name | Linux
os_version | 5.4.51-v7l+
python_version | 3.8.5
supervisor | 247
timezone | Europe/Bucharest
version | 0.116.0
virtualenv | false

Problem-relevant configuration.yaml


Traceback/Error logs

File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance  is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance  is not present in this Session
2020-10-07 21:40:29 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance <States at 0xadc72e68> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance  is not present in this Session
2020-10-07 21:40:29 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance <States at 0xadc72e68> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance  is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance  is not present in this Session
2020-10-07 21:40:30 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance <States at 0xadc72e68> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance  is not present in this Session
2020-10-07 21:40:30 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance <States at 0xadc72e68> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance  is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance  is not present in this Session
2020-10-07 21:40:31 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance <States at 0xadc72e68> is not present in this Session
2020-10-07 21:40:31 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance <States at 0xadc72e68> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance  is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance  is not present in this Session
2020-10-07 21:40:32 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance <States at 0xadc72e68> is not present in this Session
2020-10-07 21:40:32 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance <States at 0xadc72e68> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expung

Additional information

recorder

Most helpful comment

It seems to be solved with

db_url: mysql://db_user:db_pass@core-mariadb/homeassistant?charset=utf8mb4

All 28 comments

Please post your configuration.yaml for recorder

db_url: mysql://db_user:db_pass@core-mariadb/homeassistant?charset=utf8
purge_keep_days: 1
exclude:
  domains:
    - automation
    - weblink
    - updater
    - persistent_notification
    - proximity
    - weather
  entities:
    - sun.sun
    - sensor.last_boot
    - sensor.date
    - sensor.date_time
    - sensor.time
    - switch.adguard_safe_search
    - switch.adguard_safe_browsing
    - switch.adguard_protection
    - switch.adguard_parental_control
    - switch.adguard_filtering
    - sensor.adguard_safe_searches_enforced
    - sensor.adguard_safe_browsing_blocked
    - sensor.adguard_rules_count
    - sensor.adguard_parental_control_blocked
    - sensor.adguard_dns_queries_blocked_ratio
    - sensor.adguard_dns_queries_blocked
    - sensor.adguard_dns_queries
    - sensor.adguard_average_processing_speed
    - sensor.load_15m
    - sensor.load_1m
    - sensor.load_5m
    - calendar.contacts
    - calendar.sarbatori_in_romania
    - calendar.XXXXXemailXXX_gmail_com
    - light.672c1459_cb66f4bc
    - light.9ec4ed9c_6a5dad42
    - media_player.672c1459_cb66f4bc
    - media_player.9ec4ed9c_6a5dad42
    - sensor.expira_site1
    - sensor.expira_site2
    - sensor.living_program_temperature
    - sensor.mucegai
    - sensor.telefon_ionut_location
    - sensor.snapshot_backup
    - binary_sensor.snapshots_stale
    - vacuum.roborock
    - sensor.router_kb_sec_sent
    - sensor.router_kb_sec_received
    - input_select.lumini_living_efecte
    - input_boolean.hold_termostat_state
    - sensor.deluge_up_speed
    - sensor.memory_use
    - sensor.memory_free
    - sensor.deluge_down_speed
    - sensor.telefon_ionut_battery
    - sensor.airly_description
  event_types:
    - call_service # Don't record service calls
    - service_removed
    - service_executed
    - platform_discovered
    - homeassistant_start
    - feedreader
    - service_registered
    - component_loaded
    - logbook_entry
    - system_log_event
    - hacs/repository
    - panels_updated
    - hacs/status
    - hacs/config
    - homeassistant_stop
    - persistent_notifications_updated
    - hacs/reload
    - lovelace_updated
    - timer_out_of_sync

recorder documentation
recorder source
(message by IssueLinks)

Is there an exception that happens before all this starts?

Do you by chance have a State is not JSON serializable in your log ?

````txt
2020-10-07 22:14:57 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for sonoff which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-10-07 22:14:57 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for favicon which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-10-07 22:14:57 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for browser_mod which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-10-07 22:14:57 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for blitzortung which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-10-07 22:14:57 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-10-07 22:14:57 INFO (MainThread) [homeassistant.setup] Setup of domain logger took 0.0 seconds
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setting up recorder
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setting up http
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setup of domain http took 0.1 seconds
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setting up system_log
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setup of domain system_log took 0.0 seconds
2020-10-07 22:14:58 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=273 from 2020-10-07 18:56:31)
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setup of domain recorder took 0.2 seconds
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 1: {'cloud', 'webhook', 'search', 'device_automation', 'api', 'config', 'http', 'hassio', 'onboarding', 'websocket_api', 'image', 'person', 'lovelace', 'auth', 'alexa', 'system_log', 'frontend'}
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setting up webhook
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setup of domain webhook took 0.0 seconds
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setting up device_automation
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setup of domain device_automation took 0.0 seconds
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setting up api
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setting up config
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setting up hassio
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setting up websocket_api
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setup of domain websocket_api took 0.0 seconds
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setting up lovelace
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setting up auth
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setup of domain auth took 0.0 seconds
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setting up alexa
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setup of domain alexa took 0.0 seconds
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setup of domain api took 0.5 seconds
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setup of domain config took 0.6 seconds
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setting up image
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setting up search
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setup of domain search took 0.0 seconds
2020-10-07 22:14:58 INFO (MainThread) [homeassistant.setup] Setup of domain image took 0.0 seconds
2020-10-07 22:14:58 INFO (SyncWorker_17) [homeassistant.loader] Loaded camera from homeassistant.components.camera
2020-10-07 22:14:59 INFO (MainThread) [homeassistant.setup] Setting up person
2020-10-07 22:14:59 INFO (MainThread) [homeassistant.setup] Setup of domain lovelace took 0.5 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up cloud
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain cloud took 0.1 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain person took 1.2 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up onboarding
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain onboarding took 0.0 seconds
2020-10-07 22:15:00 INFO (SyncWorker_8) [homeassistant.loader] Loaded panel_custom from homeassistant.components.panel_custom
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up frontend
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain frontend took 0.0 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain hassio took 1.8 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {'weather', 'ssdp', 'tag', 'smartthings', 'input_select', 'map', 'zeroconf', 'history', 'cast', 'xiaomi_miio', 'sun', 'mqtt', 'system_health', 'sonarr', 'automation', 'openuv', 'upnp', 'sonoff', 'input_text', 'accuweather', 'google', 'wake_on_lan', 'speedtestdotnet', 'logbook', 'input_boolean', 'cert_expiry', 'fan', 'media_player', 'met', 'google_assistant', 'script', 'tts', 'dialogflow', 'yeelight', 'notify', 'climate', 'group', 'homekit_controller', 'coronavirus', 'updater', 'switch', 'default_config', 'discovery', 'proximity', 'tuya', 'media_source', 'openweathermap', 'mobile_app', 'input_datetime', 'zone', 'airly', 'sensor', 'favicon', 'persistent_notification', 'input_number', 'esphome', 'ifttt', 'binary_sensor', 'media_extractor', 'browser_mod', 'intent_script', 'device_tracker', 'light', 'blitzortung', 'influxdb', 'scene', 'hacs', 'vacuum'}
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up weather
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain weather took 0.0 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up tag
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up input_select
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up map
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain map took 0.0 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up history
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain history took 0.0 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up sun
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain sun took 0.0 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up system_health
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain system_health took 0.0 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up sonarr
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain sonarr took 0.0 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up openuv
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain openuv took 0.0 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up input_text
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up accuweather
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain accuweather took 0.0 seconds
2020-10-07 22:15:00 INFO (SyncWorker_2) [homeassistant.util.package] Attempting install of httplib2==0.10.3
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up logbook
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up input_boolean
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up cert_expiry
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain cert_expiry took 0.0 seconds
2020-10-07 22:15:00 INFO (SyncWorker_10) [homeassistant.loader] Loaded philips_js from homeassistant.components.philips_js
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up google_assistant
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up dialogflow
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain dialogflow took 0.0 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up group
2020-10-07 22:15:00 INFO (SyncWorker_9) [homeassistant.loader] Loaded html5 from homeassistant.components.html5
2020-10-07 22:15:00 INFO (SyncWorker_14) [homeassistant.loader] Loaded generic_thermostat from homeassistant.components.generic_thermostat
2020-10-07 22:15:00 INFO (SyncWorker_12) [homeassistant.loader] Loaded deluge from homeassistant.components.deluge
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up media_source
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up openweathermap
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain openweathermap took 0.0 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up input_datetime
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up zone
2020-10-07 22:15:00 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for mitemp_bt which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up favicon
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain favicon took 0.0 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up input_number
2020-10-07 22:15:00 INFO (SyncWorker_15) [homeassistant.loader] Loaded workday from homeassistant.components.workday
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up browser_mod
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up intent_script
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setup of domain intent_script took 0.0 seconds
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.setup] Setting up scene
2020-10-07 22:15:00 INFO (MainThread) [homeassistant.components.scene] Setting up scene.homeassistant
2020-10-07 22:15:01 INFO (MainThread) [homeassistant.setup] Setting up smartthings
2020-10-07 22:15:01 INFO (MainThread) [homeassistant.setup] Setting up zeroconf
2020-10-07 22:15:01 INFO (MainThread) [homeassistant.setup] Setting up mqtt
2020-10-07 22:15:01 INFO (MainThread) [homeassistant.setup] Setup of domain mqtt took 0.0 seconds
2020-10-07 22:15:01 INFO (MainThread) [homeassistant.setup] Setup of domain logbook took 0.9 seconds
2020-10-07 22:15:01 INFO (MainThread) [homeassistant.setup] Setup of domain media_source took 0.9 seconds
2020-10-07 22:15:01 INFO (MainThread) [homeassistant.setup] Setup of domain scene took 0.8 seconds
2020-10-07 22:15:01 INFO (MainThread) [homeassistant.setup] Setup of domain tag took 1.4 seconds
2020-10-07 22:15:01 INFO (MainThread) [homeassistant.setup] Setup of domain google_assistant took 0.9 seconds
2020-10-07 22:15:01 INFO (MainThread) [homeassistant.setup] Setup of domain zeroconf took 0.4 seconds
2020-10-07 22:15:01 INFO (MainThread) [homeassistant.setup] Setting up climate
2020-10-07 22:15:01 INFO (MainThread) [homeassistant.setup] Setup of domain climate took 0.0 seconds
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.setup] Setting up xiaomi_miio
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.setup] Setup of domain xiaomi_miio took 0.0 seconds
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.setup] Setting up script
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.setup] Setting up fan
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.setup] Setup of domain fan took 0.0 seconds
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.setup] Setting up light
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.setup] Setting up vacuum
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.setup] Setup of domain vacuum took 0.0 seconds
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.setup] Setup of domain smartthings took 1.4 seconds
2020-10-07 22:15:02 INFO (Thread-5) [homeassistant.components.mqtt] Connected to MQTT server localhost:1883 (0)
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.setup] Setup of domain light took 0.1 seconds
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.setup] Setting up automation
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.setup] Setup of domain script took 0.2 seconds
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.setup] Setup of domain group took 2.0 seconds
2020-10-07 22:15:02 ERROR (MainThread) [homeassistant.components.weather] The openweathermap platform for the weather integration does not support platform setup. Please remove it from your config.
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.components.weather] Setting up weather.openweathermap
2020-10-07 22:15:02 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor 0x00158d0002f88a96 click
.
.
.
.
.

2020-10-07 22:15:02 INFO (MainThread) [homeassistant.setup] Setup of domain automation took 0.2 seconds
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.setup] Setup of domain input_select took 2.6 seconds
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.setup] Setup of domain input_text took 2.3 seconds
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.setup] Setup of domain input_boolean took 2.2 seconds
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.setup] Setup of domain zone took 2.2 seconds
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.setup] Setup of domain input_datetime took 2.2 seconds
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.setup] Setup of domain input_number took 2.2 seconds
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor 0x00158d0003d27b52 temperature
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor 0x00158d0003d27b52 linkquality
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor 0x00158d0003d27b52 action
2020-10-07 22:15:03 INFO (SyncWorker_18) [homeassistant.loader] Loaded alarm_control_panel from homeassistant.components.alarm_control_panel
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.fan] Setting up fan.xiaomi_miio
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.light] Setting up light.xiaomi_miio
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.vacuum] Setting up vacuum.xiaomi_miio
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.light] Setting up light.xiaomi_miio
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor 0x00158d0003d281fb click
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor 0x00158d0003d281fb temperature
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor 0x00158d0003d281fb linkquality
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor 0x00158d0003d281fb action
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.xiaomi_miio.fan] Initializing with host 192.168.0.110 (token 078fd...)
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.xiaomi_miio.light] Initializing with host 192.168.0.104 (token 25dcd...)
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.xiaomi_miio.vacuum] Initializing with host 192.168.0.162 (token 43336...)
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor 0x00158d000408d2e4 temperature
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor 0x00158d000408d2e4 humidity
.
.
.
.
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor 0x00158d00045d71bc linkquality
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.setup] Setting up alarm_control_panel
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.setup] Setup of domain alarm_control_panel took 0.0 seconds
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor 0x00158d00045d7220 battery
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: sensor 0x00158d00045d7220 linkquality
.
.
.
.

2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.mqtt.discovery] Found new component: device_automation 0x04cf8cdf3c7cdb1a action_right_double
2020-10-07 22:15:03 INFO (SyncWorker_5) [homeassistant.loader] Loaded google_maps from homeassistant.components.google_maps
2020-10-07 22:15:03 INFO (MainThread) [homeassistant.components.alarm_control_panel] Setting up alarm_control_panel.xiaomi_miio
2020-10-07 22:15:03 INFO (SyncWorker_7) [miio.vacuum] model: rockrobo.vacuum.v1
2020-10-07 22:15:04 INFO (MainThread) [homeassistant.components.weather] Setting up weather.accuweather
2020-10-07 22:15:05 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2940565680] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/connection.py", line 95, in async_handle
handler(self.hass, self, schema(msg))
File "/config/custom_components/browser_mod/connection.py", line 36, in handle_update
devices[deviceID].update(msg.get("data", None))
File "/config/custom_components/browser_mod/connection.py", line 81, in update
self.media_player = self.media_player or create_entity(
File "/config/custom_components/browser_mod/helpers.py", line 30, in create_entity
adder = hass.data[DOMAIN][DATA_ADDERS][platform]
KeyError: 'media_player'
2020-10-07 22:15:06 INFO (MainThread) [homeassistant.components.climate] Setting up climate.smartthings
2020-10-07 22:15:06 INFO (MainThread) [homeassistant.components.fan] Setting up fan.smartthings
2020-10-07 22:15:06 INFO (MainThread) [homeassistant.components.light] Setting up light.smartthings
2020-10-07 22:15:06 INFO (MainThread) [homeassistant.components.scene] Setting up scene.smartthings
2020-10-07 22:15:06 INFO (SyncWorker_12) [homeassistant.loader] Loaded lock from homeassistant.components.lock
2020-10-07 22:15:06 INFO (SyncWorker_17) [homeassistant.loader] Loaded cover from homeassistant.components.cover
2020-10-07 22:15:06 INFO (MainThread) [homeassistant.setup] Setting up lock
2020-10-07 22:15:06 INFO (MainThread) [homeassistant.setup] Setup of domain lock took 0.0 seconds
2020-10-07 22:15:06 INFO (MainThread) [homeassistant.setup] Setting up cover
2020-10-07 22:15:06 INFO (MainThread) [homeassistant.setup] Setup of domain cover took 0.0 seconds
2020-10-07 22:15:06 INFO (MainThread) [homeassistant.components.lock] Setting up lock.smartthings
2020-10-07 22:15:06 INFO (MainThread) [homeassistant.components.cover] Setting up cover.smartthings
2020-10-07 22:15:06 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2940565680] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/connection.py", line 95, in async_handle
handler(self.hass, self, schema(msg))
File "/config/custom_components/browser_mod/connection.py", line 36, in handle_update
devices[deviceID].update(msg.get("data", None))
File "/config/custom_components/browser_mod/connection.py", line 108, in update
self.camera = self.camera or create_entity(
File "/config/custom_components/browser_mod/helpers.py", line 30, in create_entity
adder = hass.data[DOMAIN][DATA_ADDERS][platform]
KeyError: 'camera'
2020-10-07 22:15:08 ERROR (MainThread) [homeassistant.components.xiaomi_miio.light] Got exception while fetching the state: Unable to discover the device 192.168.0.104
2020-10-07 22:15:10 WARNING (MainThread) [homeassistant.setup] Setup of browser_mod is taking over 10 seconds.
2020-10-07 22:15:11 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2940565680] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/connection.py", line 95, in async_handle
handler(self.hass, self, schema(msg))
File "/config/custom_components/browser_mod/connection.py", line 36, in handle_update
devices[deviceID].update(msg.get("data", None))
File "/config/custom_components/browser_mod/connection.py", line 108, in update
self.camera = self.camera or create_entity(
File "/config/custom_components/browser_mod/helpers.py", line 30, in create_entity
adder = hass.data[DOMAIN][DATA_ADDERS][platform]
KeyError: 'camera'
2020-10-07 22:15:16 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2940565680] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/connection.py", line 95, in async_handle
handler(self.hass, self, schema(msg))
File "/config/custom_components/browser_mod/connection.py", line 36, in handle_update
devices[deviceID].update(msg.get("data", None))
File "/config/custom_components/browser_mod/connection.py", line 108, in update
self.camera = self.camera or create_entity(
File "/config/custom_components/browser_mod/helpers.py", line 30, in create_entity
adder = hass.data[DOMAIN][DATA_ADDERS][platform]
KeyError: 'camera'
2020-10-07 22:15:19 INFO (MainThread) [homeassistant.setup] Setting up google
.
.
.
.

2020-10-07 22:15:22 INFO (MainThread) [homeassistant.setup] Setup of domain ssdp took 0.0 seconds

2020-10-07 22:15:22 INFO (MainThread) [custom_components.hacs]

HACS (Home Assistant Community Store)

Version: 1.6.0
This is a custom integration
If you have any issues with this you need to open an issue here:

https://github.com/hacs/integration/issues

2020-10-07 22:15:22 INFO (MainThread) [custom_components.hacs] Setup task HacsSetupTask.WEBSOCKET
2020-10-07 22:15:22 INFO (MainThread) [custom_components.hacs] Setup task HacsSetupTask.FRONTEND
2020-10-07 22:15:22 WARNING (MainThread) [aiohttp.websocket] websocket connection is closing.
2020-10-07 22:15:22 WARNING (MainThread) [aiohttp.websocket] websocket connection is closing.
2020-10-07 22:15:22 WARNING (MainThread) [asyncio] socket.send() raised exception.
.
.
.
2020-10-07 22:15:22 WARNING (MainThread) [asyncio] socket.send() raised exception.
2020-10-07 22:15:22 WARNING (MainThread) [aiohttp.websocket] websocket connection is closing.
2020-10-07 22:15:22 WARNING (MainThread) [asyncio] socket.send() raised exception.
2020-10-07 22:15:22 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.workday
2020-10-07 22:15:22 INFO (MainThread) [homeassistant.components.light] Setting up light.switch
.
.
.

2020-10-07 22:15:22 INFO (MainThread) [homeassistant.components.light] Setting up light.switch
2020-10-07 22:15:22 INFO (MainThread) [homeassistant.components.switch] Setting up switch.smartthings
2020-10-07 22:15:22 INFO (SyncWorker_10) [homeassistant.loader] Loaded facebook from homeassistant.components.facebook
2020-10-07 22:15:22 INFO (MainThread) [homeassistant.setup] Setting up upnp
2020-10-07 22:15:22 INFO (SyncWorker_6) [homeassistant.loader] Loaded geo_location from homeassistant.components.geo_location
2020-10-07 22:15:22 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.2940565680] Error handling message: Unknown error
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/connection.py", line 95, in async_handle
handler(self.hass, self, schema(msg))
File "/config/custom_components/browser_mod/connection.py", line 36, in handle_update
devices[deviceID].update(msg.get("data", None))
File "/config/custom_components/browser_mod/connection.py", line 108, in update
self.camera = self.camera or create_entity(
File "/config/custom_components/browser_mod/helpers.py", line 30, in create_entity
adder = hass.data[DOMAIN][DATA_ADDERS][platform]
KeyError: 'camera'
2020-10-07 22:15:22 INFO (MainThread) [homeassistant.components.light] Setting up light.yeelight
2020-10-07 22:15:22 INFO (MainThread) [homeassistant.components.light] Setting up light.yeelight
2020-10-07 22:15:22 INFO (MainThread) [homeassistant.components.binary_sensor] Setting up binary_sensor.openuv
.
.
.

2020-10-07 22:15:29 INFO (MainThread) [homeassistant.components.light] Setting up light.mqtt
2020-10-07 22:15:29 INFO (MainThread) [custom_components.hacs.repository.integration.hacs.integration] Registration completed
2020-10-07 22:15:29 INFO (MainThread) [homeassistant.components.switch] Setting up switch.mqtt
2020-10-07 22:15:29 INFO (MainThread) [custom_components.hacs.data] Restore started
2020-10-07 22:15:31 INFO (MainThread) [custom_components.hacs.data] Restore done
2020-10-07 22:15:31 INFO (MainThread) [custom_components.hacs] Setup task HacsSetupTask.SENSOR
2020-10-07 22:15:31 INFO (MainThread) [custom_components.hacs] Stage changed: HacsStage.WAITING
2020-10-07 22:15:31 INFO (MainThread) [custom_components.hacs] Setup complete, waiting for Home Assistant before startup tasks starts
2020-10-07 22:15:31 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.hacs
2020-10-07 22:15:31 INFO (MainThread) [homeassistant.components.esphome] Can't connect to ESPHome API for 192.168.0.110: Error connecting to ('192.168.0.110', 6053): [Errno 111] Connect call failed ('192.168.0.110', 6053)
2020-10-07 22:15:31 INFO (MainThread) [homeassistant.components.esphome] Trying to reconnect to 192.168.0.110 in 3 seconds
2020-10-07 22:15:33 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.upnp
2020-10-07 22:15:33 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up upnp platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 193, in _async_setup_platform
await asyncio.shield(task)
File "/usr/src/homeassistant/homeassistant/components/upnp/sensor.py", line 93, in async_setup_entry
device: Device = hass.data[DOMAIN][DOMAIN_DEVICES][udn]
KeyError: 'uuid:e4c797e0-82ce-4f84-b56d-085d9d77c8cd'
2020-10-07 22:15:34 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform xiaomi_miio is taking over 10 seconds.
2020-10-07 22:15:35 INFO (MainThread) [homeassistant.components.esphome] Can't connect to ESPHome API for 192.168.0.110: Error connecting to ('192.168.0.110', 6053): [Errno 111] Connect call failed ('192.168.0.110', 6053)
2020-10-07 22:15:35 INFO (MainThread) [homeassistant.components.esphome] Trying to reconnect to 192.168.0.110 in 6 seconds
2020-10-07 22:15:41 INFO (MainThread) [homeassistant.components.esphome] Can't connect to ESPHome API for 192.168.0.110: Error connecting to ('192.168.0.110', 6053): [Errno 111] Connect call failed ('192.168.0.110', 6053)
2020-10-07 22:15:41 INFO (MainThread) [homeassistant.components.esphome] Trying to reconnect to 192.168.0.110 in 10 seconds
2020-10-07 22:15:43 ERROR (MainThread) [homeassistant.components.xiaomi_miio.light] Got exception while fetching the state: Unable to discover the device 192.168.0.104
2020-10-07 22:15:46 ERROR (SyncWorker_17) [miio.miioprotocol] Got error when receiving: timed out
2020-10-07 22:15:46 ERROR (MainThread) [homeassistant.components.sensor] xiaomi_miio: Error on device update!
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 192, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 192, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 192, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 192, in send
data, addr = s.recvfrom(1024)
socket.timeout: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 346, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 469, in async_device_update
await self.async_update() # type: ignore
File "/usr/src/homeassistant/homeassistant/components/xiaomi_miio/sensor.py", line 326, in async_update
self._state = await self.hass.async_add_executor_job(
File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(self.args, *self.kwargs)
File "/usr/local/lib/python3.8/site-packages/miio/gateway.py", line 383, in get_illumination
return self.send("get_illumination").pop()
File "/usr/local/lib/python3.8/site-packages/miio/device.py", line 146, in send
return self._protocol.send(
File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 232, in send
return self.send(
File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 232, in send
return self.send(
File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 232, in send
return self.send(
File "/usr/local/lib/python3.8/site-packages/miio/miioprotocol.py", line 240, in send
raise DeviceException("No response from the device") from ex
miio.exceptions.DeviceException: No response from the device
2020-10-07 22:15:48 INFO (MainThread) [homeassistant.setup] Setup of domain device_tracker took 24.6 seconds
2020-10-07 22:15:48 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.mobile_app
2020-10-07 22:15:48 INFO (MainThread) [homeassistant.components.device_tracker] Setting up device_tracker.mobile_app
2020-10-07 22:15:48 INFO (MainThread) [homeassistant.setup] Setting up proximity
2020-10-07 22:15:48 INFO (MainThread) [homeassistant.setup] Setup of domain proximity took 0.0 seconds
2020-10-07 22:15:48 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 50.86s
2020-10-07 22:15:48 INFO (MainThread) [homeassistant.core] Starting Home Assistant
2020-10-07 22:15:48 ERROR (MainThread) [homeassistant.components.mold_indicator.sensor] Unable to parse temperature sensor sensor.temperatura_living with state: unavailable
2020-10-07 22:15:48 ERROR (MainThread) [homeassistant.components.mold_indicator.sensor] Unable to parse humidity sensor sensor.umiditate_living, state: unavailable
2020-10-07 22:15:48 ERROR (MainThread) [homeassistant.components.mold_indicator.sensor] Unable to parse temperature sensor sensor.temperatura_living with state: unavailable
2020-10-07 22:15:48 ERROR (MainThread) [homeassistant.components.mold_indicator.sensor] Unable to parse humidity sensor sensor.umiditate_living, state: unavailable
2020-10-07 22:15:48 INFO (SyncWorker_45) [homeassistant.components.zeroconf] Starting Zeroconf broadcast
2020-10-07 22:15:49 INFO (MainThread) [homeassistant.core] Timer:starting
2020-10-07 22:15:49 INFO (MainThread) [custom_components.hacs] Stage changed: HacsStage.STARTUP
2020-10-07 22:15:49 INFO (MainThread) [custom_components.hacs] setup task HacsSetupTask.CATEGORIES
.
.
.
2020-10-07 22:15:51 INFO (MainThread) [custom_components.hacs] Loading known repositories
2020-10-07 22:15:51 INFO (MainThread) [homeassistant.components.mobile_app.notify] mobile_app push notification rate limits for Telefon Ionut: 5 sent, 300 allowed, 0 errors, resets in 4:44:08
2020-10-07 22:15:52 INFO (SyncWorker_40) [homeassistant.loader] Loaded spotify from homeassistant.components.spotify
2020-10-07 22:15:56 INFO (SyncWorker_47) [homeassistant.loader] Loaded xiaomi_aqara from homeassistant.components.xiaomi_aqara
2020-10-07 22:15:57 INFO (MainThread) [homeassistant.components.generic_thermostat.climate] Obtained current and target temperature. Generic thermostat active. 25.47, 24.0
2020-10-07 22:16:02 ERROR (MainThread) [homeassistant.components.google_assistant.http] Request for https://homegraph.googleapis.com/v1/devices:reportStateAndNotification failed: 404
2020-10-07 22:16:04 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: (MySQLdb._exceptions.OperationalError) (1366, "Incorrect string value: '\xF0\x9F\x90\xBC' for column homeassistant.states.state at row 1")
[SQL: INSERT INTO states (domain, entity_id, state, attributes, event_id, last_changed, last_updated, created, old_state_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)]
[parameters: ('sensor', 'sensor.telefon_ionut_sim_1', '馃惣', '{"carrier name": "Vodafone RO", "iso country code": "", "friendly_name": "Telefon Ionut SIM_1", "icon": "mdi:sim"}', 11101170, datetime.datetime(2020, 10, 7, 19, 15, 27, 582700, tzinfo=), datetime.datetime(2020, 10, 7, 19, 15, 27, 582700, tzinfo=), datetime.datetime(2020, 10, 7, 19, 16, 4, 29127, tzinfo=), None)]
(Background on this error at: http://sqlalche.me/e/13/e3q8)
2020-10-07 22:16:04 ERROR (Recorder) [homeassistant.components.recorder] Error in database connectivity during commit: (MySQLdb._exceptions.OperationalError) (1366, "Incorrect string value: '\xF0\x9F\x90\xBC' for column homeassistant.states.state at row 1")
[SQL: INSERT INTO states (domain, entity_id, state, attributes, event_id, last_changed, last_updated, created, old_state_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)]
[parameters: ('sensor', 'sensor.telefon_ionut_sim_1', '馃惣', '{"carrier name": "Vodafone RO", "iso country code": "", "friendly_name": "Telefon Ionut SIM_1", "icon": "mdi:sim"}', 11101170, datetime.datetime(2020, 10, 7, 19, 15, 27, 582700, tzinfo=), datetime.datetime(2020, 10, 7, 19, 15, 27, 582700, tzinfo=), datetime.datetime(2020, 10, 7, 19, 16, 4, 29127, tzinfo=), None)]
(Background on this error at: http://sqlalche.me/e/13/e3q8). (retrying in 3 seconds)
2020-10-07 22:16:06 INFO (MainThread) [homeassistant.components.generic_thermostat.climate] Keep-alive - Turning off heater switch.centrala_termica
2020-10-07 22:16:07 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance is not present in this Session
2020-10-07 22:16:07 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance is not present in this Session
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
self._commit_event_session()
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
self.event_session.expunge(dbstate)
File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance is not present in this Session
2020-10-07 22:16:07 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance is not present in this Session
2020-10-07 22:16:07 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance is not present in this Session
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
self._commit_event_session()
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
self.event_session.expunge(dbstate)
File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance is not present in this Session
.
.
.
.
2020-10-07 22:16:11 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance is not present in this Session
2020-10-07 22:16:11 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance is not present in this Session
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
self._commit_event_session()
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
self.event_session.expunge(dbstate)
File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance is not present in this Session
2020-10-07 22:16:11 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance is not present in this Session
2020-10-07 22:16:11 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance is not present in this Session
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
self._commit_event_session()
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
self.event_session.expunge(dbstate)
File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance is not present in this Session
2020-10-07 22:16:11 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance is not present in this Session
2020-10-07 22:16:11 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance is not present in this Session
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
self._commit_event_session()
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
self.event_session.expunge(dbstate)
File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance is not present in this Session
2020-10-07 22:16:11 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance is not present in this Session
2020-10-07 22:16:11 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance is not present in this Session
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
self._commit_event_session()
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
self.event_session.expunge(dbstate)
File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance is not present in this Session
2020-10-07 22:16:11 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance is not present in this Session
2020-10-07 22:16:11 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance is not present in this Session
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
self._commit_event_session()
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
self.event_session.expunge(dbstate)
File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance is not present in this Session
2020-10-07 22:16:11 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance is not present in this Session
2020-10-07 22:16:12 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance is not present in this Session
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
self._commit_event_session()
File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
self.event_session.expunge(dbstate)
File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
raise sa_exc.InvalidRequestError(

````

2020-10-07 22:16:04 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: (MySQLdb._exceptions.OperationalError) (1366, "Incorrect string value: '\\xF0\\x9F\\x90\\xBC' for column `homeassistant`.`states`.`state` at row 1")
[SQL: INSERT INTO states (domain, entity_id, state, attributes, event_id, last_changed, last_updated, created, old_state_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)]
[parameters: ('sensor', 'sensor.telefon_ionut_sim_1', '馃惣', '{"carrier name": "Vodafone RO", "iso country code": "", "friendly_name": "Telefon Ionut SIM_1", "icon": "mdi:sim"}', 11101170, datetime.datetime(2020, 10, 7, 19, 15, 27, 582700, tzinfo=<UTC>), datetime.datetime(2020, 10, 7, 19, 15, 27, 582700, tzinfo=<UTC>), datetime.datetime(2020, 10, 7, 19, 16, 4, 29127, tzinfo=<UTC>), None)]
(Background on this error at: http://sqlalche.me/e/13/e3q8)
2020-10-07 22:16:04 ERROR (Recorder) [homeassistant.components.recorder] Error in database connectivity during commit: (MySQLdb._exceptions.OperationalError) (1366, "Incorrect string value: '\\xF0\\x9F\\x90\\xBC' for column `homeassistant`.`states`.`state` at row 1")
[SQL: INSERT INTO states (domain, entity_id, state, attributes, event_id, last_changed, last_updated, created, old_state_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)]
[parameters: ('sensor', 'sensor.telefon_ionut_sim_1', '馃惣', '{"carrier name": "Vodafone RO", "iso country code": "", "friendly_name": "Telefon Ionut SIM_1", "icon": "mdi:sim"}', 11101170, datetime.datetime(2020, 10, 7, 19, 15, 27, 582700, tzinfo=<UTC>), datetime.datetime(2020, 10, 7, 19, 15, 27, 582700, tzinfo=<UTC>), datetime.datetime(2020, 10, 7, 19, 16, 4, 29127, tzinfo=<UTC>), None)]
(Background on this error at: http://sqlalche.me/e/13/e3q8). (retrying in 3 seconds)

In looks invalid utf-8 data causes the commit to fail, and it can't recover.

Looks like another case of #31785

I can replicate by manually setting a any state to 馃惣

It seems to be solved with

db_url: mysql://db_user:db_pass@core-mariadb/homeassistant?charset=utf8mb4

It looks like we may need to update the recorder docs https://www.home-assistant.io/integrations/recorder/#custom-database-engines

I'm going to see if I can work up something to handle this case better so the recorder can move forward as chatset mis-matches are unfortunately common.

Run into the same issue after updating to 0.116.0 this night. Lost data from ~ 04:12 to today morning as I restarted HA.
I saw the same thing in Log like described by @IonutNeagu

After the restart I had this message after HA was available in the log:

Logger: homeassistant.components.recorder
Source: components/recorder/__init__.py:598
Integration: Recorder (documentation, issues)
First occurred: 7:44:21 (1 occurrences)
Last logged: 7:44:21

Ended unfinished session (id=748 from 2020-10-08 05:36:53)

DB string with issue was:

mysql://[user]:[password]@core-mariadb/homeassistant?charset=utf8
```` 

I now replaced it with

mysql://[user]:[password]@core-mariadb/homeassistant?charset=utf8mb4
````

will see if this helps.

Edit:
This doesn't solve the issue for me.
I run a recorder.purge for one day of my history (as this is the thing that usually happen at 04:12).

2020-10-08 07:50:05 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-08 05:50:05.855916+00:00
2020-10-08 07:50:05 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.007127s
2020-10-08 07:50:05 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.003787s
2020-10-08 07:50:05 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 05:50:05.855916+00:00
2020-10-08 07:50:05 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 327 states
2020-10-08 07:50:05 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 331 events
2020-10-08 07:50:05 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 0 recorder_runs
2020-10-08 07:50:30 DEBUG (Recorder) [homeassistant.components.recorder] Sending keepalive
2020-10-08 07:50:37 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:37.950448+00:00
2020-10-08 07:50:37 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.006329s
2020-10-08 07:50:37 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.001893s
2020-10-08 07:50:37 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 06:50:06+00:00
2020-10-08 07:50:37 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1657 states
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1696 events
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:38.088299+00:00
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.003873s
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.003124s
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 07:50:06+00:00
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1520 states
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1555 events
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:38.327787+00:00
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.003116s
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.001560s
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 08:50:07+00:00
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1523 states
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1553 events
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:38.572105+00:00
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.002332s
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.001814s
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 09:50:08+00:00
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1514 states
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1544 events
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:38.813720+00:00
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.004993s
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.007702s
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 10:50:08+00:00
2020-10-08 07:50:38 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1429 states
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1460 events
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:39.097222+00:00
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.003479s
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.003133s
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 11:50:09+00:00
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1466 states
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1497 events
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:39.336348+00:00
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.002184s
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.006353s
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 12:50:10+00:00
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1429 states
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1467 events
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:39.556345+00:00
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.002410s
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.001860s
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 13:50:11+00:00
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1440 states
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1483 events
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:39.755050+00:00
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.003370s
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.002927s
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 14:50:11+00:00
2020-10-08 07:50:39 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1388 states
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1418 events
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:40.095497+00:00
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.003148s
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.003773s
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 15:50:12+00:00
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1495 states
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1518 events
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:40.414508+00:00
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.002512s
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.001858s
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 16:50:13+00:00
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1390 states
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1420 events
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:40.638581+00:00
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.002074s
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.001501s
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 17:50:14+00:00
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1429 states
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1464 events
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:40.936373+00:00
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.004330s
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.002263s
2020-10-08 07:50:40 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 18:50:15+00:00
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1571 states
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1612 events
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:41 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:41 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance <States at 0x7faf8d972400> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:41.321311+00:00
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.006711s
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.004741s
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 19:50:15+00:00
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1592 states
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1634 events
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:41.624956+00:00
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.002103s
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.001629s
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 20:50:16+00:00
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1639 states
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1710 events
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:41.926313+00:00
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.003438s
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.003123s
2020-10-08 07:50:41 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 21:50:17+00:00
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1500 states
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1529 events
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:42 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:42 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance <States at 0x7faf8d972400> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:42.319432+00:00
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.009236s
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.004917s
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 22:50:17+00:00
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1595 states
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1630 events
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:42.668070+00:00
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.003406s
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.003056s
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-08 23:50:18+00:00
2020-10-08 07:50:42 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1619 states
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1646 events
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:43 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:43 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance <States at 0x7faf8d972400> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:43.044324+00:00
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.004738s
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.002720s
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-09 00:50:19+00:00
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1516 states
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1546 events
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:43.363863+00:00
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.002235s
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.002538s
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-09 01:50:20+00:00
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1414 states
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1448 events
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:43.746095+00:00
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.001754s
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.002793s
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-09 02:50:21+00:00
2020-10-08 07:50:43 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 2127 states
2020-10-08 07:50:44 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 2157 events
2020-10-08 07:50:44 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:44 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:44 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance <States at 0x7faf8d972400> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:44 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:44.206199+00:00
2020-10-08 07:50:44 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.002238s
2020-10-08 07:50:44 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.001265s
2020-10-08 07:50:44 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-09 03:50:21+00:00
2020-10-08 07:50:44 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1600 states
2020-10-08 07:50:44 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1630 events
2020-10-08 07:50:44 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:44 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:44.574094+00:00
2020-10-08 07:50:44 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.002333s
2020-10-08 07:50:44 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.001692s
2020-10-08 07:50:44 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-09 04:50:22+00:00
2020-10-08 07:50:44 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1687 states
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1724 events
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:45 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:45 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance <States at 0x7faf8d972400> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:45.097565+00:00
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.001790s
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.001208s
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-09 05:50:23+00:00
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1966 states
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 2443 events
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging hasn't fully completed yet
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before target 2020-09-09 05:50:45.536522+00:00
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.008664s
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.util] converting 1 rows to native objects took 0.001227s
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.purge] Purging states and events before 2020-09-09 05:50:45.536522+00:00
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 4 states
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 4 events
2020-10-08 07:50:45 DEBUG (Recorder) [homeassistant.components.recorder.purge] Deleted 1 recorder_runs
2020-10-08 07:50:46 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:46 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance <States at 0x7faf8d972400> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:47 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:47 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance <States at 0x7faf8d972400> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:48 ERROR (Recorder) [homeassistant.components.recorder] Error executing query: Instance <States at 0x7faf8d972400> is not present in this Session
2020-10-08 07:50:48 ERROR (Recorder) [homeassistant.components.recorder] Error saving events: Instance <States at 0x7faf8d972400> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7faf8d972400> is not present in this Session

Same error at 4:12 am (recorder purge?)

Logger: homeassistant.components.recorder
Source: components/recorder/__init__.py:501
Integration: Recorder (documentation, issues)
First occurred: 4:12:14 (15099 occurrences)
Last logged: 8:23:52

Error executing query: Instance <States at 0x7f69db7b8940> is not present in this Session
Error executing query: Instance <States at 0x7f69e25551f0> is not present in this Session

Logger: homeassistant.components.recorder
Source: components/recorder/__init__.py:497
Integration: Recorder (documentation, issues)
First occurred: 4:12:14 (15099 occurrences)
Last logged: 8:23:52

Error saving events: Instance <States at 0x7f69db7b8940> is not present in this Session
Error saving events: Instance <States at 0x7f69e25551f0> is not present in this Session
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 442, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/usr/src/homeassistant/homeassistant/components/recorder/__init__.py", line 497, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7f69db7b8940> is not present in this Session

After HA restart:

Logger: homeassistant.components.recorder
Source: components/recorder/__init__.py:598
Integration: Recorder (documentation, issues)
First occurred: 8:25:51 (1 occurrences)
Last logged: 8:25:51

Ended unfinished session (id=154 from 2020-10-07 19:28:30)

My recorder configuration:

db_url: "mysql://db_user:db_pass@core-mariadb/homeassistant?charset=utf8"
purge_keep_days: 7
exclude:
  domains:
    - automation
    - updater
    - sun
    - scenes
    - script
    - group
    - mqtt
    - device_tracker
    - input_boolean
    - history_graph

I'm seeing very similar errors but I don't use a custom database (nor do I change recorder settings). Logs attached.
home-assistant.zip

@balloob Have you had a chance to look at my logs? Just wanted to make sure it's the same root case as some log entries are different.

@swiergot The issue in your log is not related.

(sqlite3.DatabaseError) database disk image is malformed

Your sqlite database is corrupt.

Move away home-assistant_v2.db* and restart. A new database will be created.

@bdraco It was fine before the upgrade. I have a snapshot created right before yesterday's upgrade and I reverted to that snapshot today, works fine.

I will attempt an upgrade again to see if the problem reproduces.

You can check the old database with https://www.sqlite.org/pragma.html#pragma_integrity_check

@bdraco Any ETA for the fix?

I now configured auto_purge: false in recorder to avoid crash at 04:12 as a workaround.

sqlite> pragma integrity_check;
* in database main *
Main freelist: size is 612 but should be 616
row 1309 missing from index ix_states_entity_id_last_updated
row 157218 missing from index ix_states_entity_id_last_updated
row 157551 missing from index ix_states_entity_id_last_updated
row 159641 missing from index ix_states_entity_id_last_updated
wrong # of entries in index ix_states_last_updated
wrong # of entries in index ix_states_event_id
wrong # of entries in index ix_states_entity_id_last_updated
row 226227 missing from index ix_events_context_id
row 226244 missing from index ix_events_context_id
row 226245 missing from index ix_events_context_id
row 229086 missing from index ix_events_context_id
row 229087 missing from index ix_events_context_id
row 229088 missing from index ix_events_context_id
row 229089 missing from index ix_events_context_id
row 229090 missing from index ix_events_context_id
wrong # of entries in index ix_events_context_id
wrong # of entries in index ix_events_time_fired
wrong # of entries in index ix_events_context_user_id
wrong # of entries in index ix_events_event_type_time_fired

Not sure if it indicates a severe problem.

Retried the upgrade and the database crashed again after some time. Since nobody else is reporting problems with this version, I will not investigate it further. I have just switched to MariaDB, hopefully it won't kill my Raspberry :)

Same error at 4:12 am (recorder purge?)

I have the same error 2 days in a row at this time now on v0.116.1 , yesterday on 0.116.0
also high cpu use

I have a py-spy from yesterday https://www.dropbox.com/s/upk7vczfchzh6ei/spy-0.116.0-recorder_error.svg?dl=0
and this is a py-spy from today with the custom_recorder from @bdraco https://www.dropbox.com/s/4en0nbpn1olral4/spy-0.116.1-custom-recorder-error.svg?dl=0

these are my errors

2020-10-10 04:12:05 ERROR (Recorder) [custom_components.recorder] Error executing query: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:05 ERROR (Recorder) [custom_components.recorder] Error saving events: Instance <States at 0x7f97481069a0> is not present in this Session
Traceback (most recent call last):
  File "/config/custom_components/recorder/__init__.py", line 450, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/config/custom_components/recorder/__init__.py", line 509, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:05 ERROR (Recorder) [custom_components.recorder] Error executing query: Instance <States at 0x7f97491edfa0> is not present in this Session
2020-10-10 04:12:05 ERROR (Recorder) [custom_components.recorder] Error saving events: Instance <States at 0x7f97491edfa0> is not present in this Session
Traceback (most recent call last):
  File "/config/custom_components/recorder/__init__.py", line 450, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/config/custom_components/recorder/__init__.py", line 509, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7f97491edfa0> is not present in this Session
2020-10-10 04:12:13 ERROR (Recorder) [custom_components.recorder] Error executing query: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:13 ERROR (Recorder) [custom_components.recorder] Error saving events: Instance <States at 0x7f97481069a0> is not present in this Session
Traceback (most recent call last):
  File "/config/custom_components/recorder/__init__.py", line 450, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/config/custom_components/recorder/__init__.py", line 509, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:21 ERROR (Recorder) [custom_components.recorder] Error executing query: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:21 ERROR (Recorder) [custom_components.recorder] Error saving events: Instance <States at 0x7f97481069a0> is not present in this Session
Traceback (most recent call last):
  File "/config/custom_components/recorder/__init__.py", line 450, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/config/custom_components/recorder/__init__.py", line 509, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:21 ERROR (Recorder) [custom_components.recorder] Error executing query: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:21 ERROR (Recorder) [custom_components.recorder] Error saving events: Instance <States at 0x7f97481069a0> is not present in this Session
Traceback (most recent call last):
  File "/config/custom_components/recorder/__init__.py", line 450, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/config/custom_components/recorder/__init__.py", line 509, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:30 ERROR (Recorder) [custom_components.recorder] Error executing query: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:30 ERROR (Recorder) [custom_components.recorder] Error saving events: Instance <States at 0x7f97481069a0> is not present in this Session
Traceback (most recent call last):
  File "/config/custom_components/recorder/__init__.py", line 450, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/config/custom_components/recorder/__init__.py", line 509, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:30 ERROR (Recorder) [custom_components.recorder] Error executing query: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:30 ERROR (Recorder) [custom_components.recorder] Error saving events: Instance <States at 0x7f97481069a0> is not present in this Session
Traceback (most recent call last):
  File "/config/custom_components/recorder/__init__.py", line 450, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/config/custom_components/recorder/__init__.py", line 509, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:43 ERROR (Recorder) [custom_components.recorder] Error executing query: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:43 ERROR (Recorder) [custom_components.recorder] Error saving events: Instance <States at 0x7f97481069a0> is not present in this Session
Traceback (most recent call last):
  File "/config/custom_components/recorder/__init__.py", line 450, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/config/custom_components/recorder/__init__.py", line 509, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:43 ERROR (Recorder) [custom_components.recorder] Error executing query: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:12:43 ERROR (Recorder) [custom_components.recorder] Error saving events: Instance <States at 0x7f97481069a0> is not present in this Session
Traceback (most recent call last):
  File "/config/custom_components/recorder/__init__.py", line 450, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/config/custom_components/recorder/__init__.py", line 509, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:13:00 ERROR (Recorder) [custom_components.recorder] Error executing query: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:13:00 ERROR (Recorder) [custom_components.recorder] Error saving events: Instance <States at 0x7f97481069a0> is not present in this Session
Traceback (most recent call last):
  File "/config/custom_components/recorder/__init__.py", line 450, in _commit_event_session_or_retry
    self._commit_event_session()
  File "/config/custom_components/recorder/__init__.py", line 509, in _commit_event_session
    self.event_session.expunge(dbstate)
  File "/usr/local/lib/python3.8/site-packages/sqlalchemy/orm/session.py", line 1854, in expunge
    raise sa_exc.InvalidRequestError(
sqlalchemy.exc.InvalidRequestError: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:13:00 ERROR (Recorder) [custom_components.recorder] Error executing query: Instance <States at 0x7f97481069a0> is not present in this Session
2020-10-10 04:13:00 ERROR (Recorder) [custom_components.recorder] Error saving events: Instance <States at 0x7f97481069a0> is not present in this Session

Now I have deleted the custom_recorder and updated to v0.116.2

Can you upload a zip of the code you were using for the custom one? I'm wondering if you pulled the code from 0.117 before the fix that went into 0.116.1 was merged until dev

Edit: That does look what happened from the py-spy.

@IonutNeagu
Thanks, I've changed it

Was this page helpful?
0 / 5 - 0 ratings