『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 6258|回复: 7

[已解决] 无日志无历史记录

[复制链接]

10

主题

198

帖子

1791

积分

金牌会员

Rank: 6Rank: 6

积分
1791
金钱
1593
HASS币
0
发表于 2020-2-21 16:36:40 | 显示全部楼层 |阅读模式
本帖最后由 sdhuaren 于 2020-2-28 19:58 编辑

已自行解决,原因是
  db_url: mysql://hass:password@core-mariadb/homeassistant?charset=utf8
中莫名少了后面几个字符,导致数据库无效
------------------------------------------------------------------------------------------
日志为空

Capture1.JPG


历史记录也无数据
Capture2.JPG

以下为系统log,怀疑与数据库有关,使用的是MariaDB,很多error看不懂;
另外有几个超时的warning(……taking over 10 seconds),每次启动HA都会出现。不知道是否正常,请大神指点


2020-02-20 22:05:29 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=57 from 2020-02-19 12:53:38)
2020-02-20 22:05:51 WARNING (MainThread) [homeassistant.setup] Setup of recorder is taking over 10 seconds.
2020-02-20 22:05:55 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for braviatv_psk which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2020-02-20 22:05:56 ERROR (SyncWorker_18) [yahooweather] No woid is received!
2020-02-20 22:05:56 WARNING (SyncWorker_18) [homeassistant.components.yweather.weather] Can't retrieve WOEID from Yahoo!
2020-02-20 22:06:10 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform yr is taking over 10 seconds.
2020-02-20 22:06:10 ERROR (MainThread) [homeassistant.components.yr.sensor] Retrying in 19 minutes:
2020-02-20 22:06:10 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform wake_on_lan is taking over 10 seconds.
2020-02-20 22:06:17 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback async_setup_entity_restore.<locals>._write_unavailable_states(<Event homeassistant_start[L]>) at /usr/src/homeassistant/homeassistant/helpers/entity_registry.py:502
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 526, in _write_unavailable_states
    states.async_set(entry.entity_id, STATE_UNAVAILABLE, attrs)
  File "/usr/src/homeassistant/homeassistant/core.py", line 977, in async_set
    state = State(entity_id, new_state, attributes, last_changed, None, context)
  File "/usr/src/homeassistant/homeassistant/core.py", line 715, in __init__
    f"Invalid entity id encountered: {entity_id}. "
homeassistant.exceptions.InvalidEntityFormatError: Invalid entity id encountered: sensor._iphone_battery_state. Format should be <domain>.<object_id>
2020-02-20 22:06:17 ERROR (MainThread) [homeassistant.components.template.cover] could not convert string to float: 'unknown'
2020-02-20 22:06:17 ERROR (MainThread) [homeassistant.components.template.cover] could not convert string to float: 'unknown'
2020-02-20 22:06:17 ERROR (MainThread) [homeassistant.components.template.light] Received invalid light is_on state: unavailable. Expected: on, off, true, false
2020-02-20 22:06:51 ERROR (Recorder) [homeassistant.components.recorder.util] Error executing query: 'charmap' codec can't encode characters in position 0-3: character maps to <undefined>
2020-02-20 22:06:53 WARNING (MainThread) [homeassistant.components.device_tracker] The 'hide_if_away' option (with value 'False') is deprecated, please remove it from your configuration. This option will become invalid in version 0.107.0
2020-02-20 22:18:36 ERROR (MainThread) [frontend.js.latest.202001302] blob:http://192.168.0.33:8123/8f5d286 ... a43d55873fd:1:19166 Uncaught RangeError: Source is too large
2020-02-20 22:25:21 ERROR (MainThread) [homeassistant.components.yr.sensor] Retrying in 18 minutes:
2020-02-20 22:43:32 ERROR (MainThread) [homeassistant.components.yr.sensor] Retrying in 17 minutes:
2020-02-20 23:00:43 ERROR (MainThread) [homeassistant.components.yr.sensor] Retrying in 18 minutes:
2020-02-20 23:05:57 ERROR (MainThread) [homeassistant.components.updater] Could not contact Home Assistant Update to check for updates
2020-02-21 00:18:58 ERROR (MainThread) [homeassistant.components.yr.sensor] Retrying in 17 minutes:
2020-02-21 00:36:09 ERROR (MainThread) [homeassistant.components.yr.sensor] Retrying in 16 minutes:
2020-02-21 11:53:24 ERROR (MainThread) [homeassistant.components.yr.sensor] Retrying in 15 minutes:
2020-02-21 12:08:35 ERROR (MainThread) [homeassistant.components.yr.sensor] Retrying in 16 minutes:
2020-02-21 13:24:53 ERROR (MainThread) [homeassistant.components.yr.sensor] Retrying in 16 minutes:
2020-02-21 13:41:04 ERROR (MainThread) [homeassistant.components.yr.sensor] Retrying in 19 minutes:
2020-02-21 15:54:58 ERROR (MainThread) [frontend.js.latest.202001302] http://sdhuaren.vicp.cc/frontend ... b4fa3b.js:2038:1142 Uncaught SyntaxError: Unexpected token {
2020-02-21 15:55:11 ERROR (SyncWorker_4) [homeassistant.components.logbook] Error executing query: (MySQLdb._exceptions.OperationalError) (2006, 'MySQL server has gone away')
[SQL: SELECT DISTINCT states.entity_id AS states_entity_id
FROM states]
(Background on this error at: http://sqlalche.me/e/e3q8)
2020-02-21 15:55:12 ERROR (SyncWorker_4) [homeassistant.components.logbook] Error executing query: (sqlalchemy.exc.InvalidRequestError) Can't reconnect until invalid transaction is rolled back
[SQL: SELECT DISTINCT states.entity_id AS states_entity_id
FROM states]
[parameters: [immutabledict({})]]
2020-02-21 15:55:12 ERROR (SyncWorker_4) [homeassistant.components.logbook] Error executing query: (sqlalchemy.exc.InvalidRequestError) Can't reconnect until invalid transaction is rolled back
[SQL: SELECT DISTINCT states.entity_id AS states_entity_id
FROM states]
[parameters: [immutabledict({})]]
2020-02-21 15:55:12 ERROR (SyncWorker_4) [homeassistant.components.recorder.util] Error executing query: (sqlalchemy.exc.InvalidRequestError) Can't reconnect until invalid transaction is rolled back
[SQL: SELECT DISTINCT states.entity_id AS states_entity_id
FROM states]
[parameters: [immutabledict({})]]
2020-02-21 15:55:12 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1171, in _execute_context
    conn = self._revalidate_connection()
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 457, in _revalidate_connection
    "Can't reconnect until invalid "
sqlalchemy.exc.InvalidRequestError: Can't reconnect until invalid transaction is rolled back

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.7/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/real_ip.py", line 39, in real_ip_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 123, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/logbook/__init__.py", line 190, in get
    return await hass.async_add_job(json_events)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/logbook/__init__.py", line 187, in json_events
    _get_events(hass, self.config, start_day, end_day, entity_id)
  File "/usr/src/homeassistant/homeassistant/components/logbook/__init__.py", line 443, in _get_events
    entity_ids = _get_related_entity_ids(session, entities_filter)
  File "/usr/src/homeassistant/homeassistant/components/logbook/__init__.py", line 389, in _get_related_entity_ids
    result = [row.entity_id for row in query if entity_filter(row.entity_id)]
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3389, in __iter__
    return self._execute_and_instances(context)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3414, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 982, in execute
    return meth(self, multiparams, params)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 293, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1101, in _execute_clauseelement
    distilled_params,
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1176, in _execute_context
    e, util.text_type(statement), parameters, None, None
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1476, in _handle_dbapi_exception
    util.raise_from_cause(sqlalchemy_exception, exc_info)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 398, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 152, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1171, in _execute_context
    conn = self._revalidate_connection()
  File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 457, in _revalidate_connection
    "Can't reconnect until invalid "
sqlalchemy.exc.StatementError: (sqlalchemy.exc.InvalidRequestError) Can't reconnect until invalid transaction is rolled back
[SQL: SELECT DISTINCT states.entity_id AS states_entity_id
FROM states]
[parameters: [immutabledict({})]]
2020-02-21 16:19:34 ERROR (MainThread) [frontend.js.latest.202001302] http://sdhuaren.vicp.cc/frontend ... b4fa3b.js:2038:1142 Uncaught SyntaxError: Unexpected token {
2020-02-21 16:20:34 ERROR (MainThread) [frontend.js.latest.202001302] http://sdhuaren.vicp.cc/frontend ... b4fa3b.js:2038:1142 Uncaught SyntaxError: Unexpected token {

回复

使用道具 举报

5

主题

66

帖子

332

积分

论坛分享达人

积分
332
金钱
266
HASS币
0
发表于 2020-4-18 16:10:17 来自手机 | 显示全部楼层
楼主具体怎么解决的,我换完数据库 日志和历史都没了
回复

使用道具 举报

10

主题

198

帖子

1791

积分

金牌会员

Rank: 6Rank: 6

积分
1791
金钱
1593
HASS币
0
 楼主| 发表于 2020-4-18 20:35:17 | 显示全部楼层
yan0422 发表于 2020-4-18 16:10
楼主具体怎么解决的,我换完数据库 日志和历史都没了

肯定是你的数据库没有启动,检查下插件配置和configuration.yaml配置
回复

使用道具 举报

5

主题

66

帖子

332

积分

论坛分享达人

积分
332
金钱
266
HASS币
0
发表于 2020-4-18 20:42:54 | 显示全部楼层
sdhuaren 发表于 2020-4-18 20:35
肯定是你的数据库没有启动,检查下插件配置和configuration.yaml配置
recorder:
  purge_keep_days: 5
  db_url: mysql+pymysql://hass:hass123456@localhost/hass?charset=utf8


我的是这样的,进入界面,左面的历史和日志没有了,其他的正常

然后提示框里面提示
Invalid config
The following integrations and platforms could not be set up:

recorder
history
logbook
default_config
Please check your config.
回复

使用道具 举报

10

主题

198

帖子

1791

积分

金牌会员

Rank: 6Rank: 6

积分
1791
金钱
1593
HASS币
0
 楼主| 发表于 2020-4-18 21:15:34 | 显示全部楼层
yan0422 发表于 2020-4-18 20:42
我的是这样的,进入界面,左面的历史和日志没有了,其他的正常

然后提示框里面提示
recorder:
  db_url: mysql://homeassistant:password@core-mariadb/homeassistant?charset=utf8


以上是我的格式,跟你不太一样。另外检查下Add-on的配置
回复

使用道具 举报

10

主题

198

帖子

1791

积分

金牌会员

Rank: 6Rank: 6

积分
1791
金钱
1593
HASS币
0
 楼主| 发表于 2020-4-18 21:17:19 | 显示全部楼层
yan0422 发表于 2020-4-18 20:42
我的是这样的,进入界面,左面的历史和日志没有了,其他的正常

然后提示框里面提示
recorder:
  db_url: mysql://homeassistant:password@core-mariadb/homeassistant?charset=utf8


以上是我的格式,跟你不太一样。另外检查下Add-on的配置
回复

使用道具 举报

1

主题

9

帖子

97

积分

注册会员

Rank: 2

积分
97
金钱
88
HASS币
0
发表于 2021-12-29 15:37:53 | 显示全部楼层
也是相同的错误,我看着我的配置挨个字符核对都一样,不知道为什么还是不写日志。
回复

使用道具 举报

13

主题

88

帖子

332

积分

中级会员

Rank: 3Rank: 3

积分
332
金钱
244
HASS币
0
发表于 2023-10-8 16:58:02 | 显示全部楼层
zgz200 发表于 2021-12-29 15:37
也是相同的错误,我看着我的配置挨个字符核对都一样,不知道为什么还是不写日志。 ...

这配置文件是在哪看的呢?我都不知道去哪看
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-24 08:31 , Processed in 0.071379 second(s), 32 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表