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

 找回密码
 立即注册
查看: 1740|回复: 8

[技术探讨] 请教下新建自动化时遇到的Response error: 500

[复制链接]

2

主题

17

帖子

238

积分

中级会员

Rank: 3Rank: 3

积分
238
金钱
221
HASS币
0
发表于 2022-11-5 21:36:23 | 显示全部楼层 |阅读模式
今天在创建新的自动化的时候提示Response error: 500,因为很少新建自动化,所以也不确定是不是今天的版本升级造成的。系统版本为[color=var(--primary-text-color)]Home Assistant 2022.11.1 Supervisor 2022.10.2Operating System 9.3 。查询日志如下
Logger: aiohttp.server
Source: util/file.py:40
First occurred: 21:34:09 (1 occurrences)
Last logged: 21:34:09
Error handling requestTraceback (most recent call last):  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request    resp = await request_handler(request)  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle    resp = await handler(request)  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl    return await handler(request)  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware    return await handler(request)  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware    return await handler(request)  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware    return await handler(request)  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 82, in ban_middleware    return await handler(request)  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware    return await handler(request)  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle    result = await result  File "/usr/src/homeassistant/homeassistant/components/config/__init__.py", line 147, in post    await hass.async_add_executor_job(_write, path, current)  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run    result = self.fn(*self.args, **self.kwargs)  File "/usr/src/homeassistant/homeassistant/components/config/__init__.py", line 243, in _write    write_utf8_file_atomic(path, contents)  File "/usr/src/homeassistant/homeassistant/util/file.py", line 40, in write_utf8_file_atomic    fdesc.write(utf8_data)UnicodeEncodeError: 'ascii' codec can't encode characters in position 31-32: ordinal not in range(128)
在这里请教各位大佬的帮助,非常感谢!
回复

使用道具 举报

18

主题

587

帖子

4293

积分

元老级技术达人

积分
4293
金钱
3671
HASS币
182
发表于 2022-11-5 21:45:17 | 显示全部楼层
UnicodeEncodeError: 'ascii' codec can't encode characters in position 31-32: ordinal not in range(128)

感觉是不是哪个地方用了中文,造成了这个问题?
回复

使用道具 举报

2

主题

17

帖子

238

积分

中级会员

Rank: 3Rank: 3

积分
238
金钱
221
HASS币
0
 楼主| 发表于 2022-11-5 21:45:21 | 显示全部楼层
第二条日志
Logger: homeassistant
Source: util/file.py:40
First occurred: 21:36:16 (1 occurrences)
Last logged: 21:36:16

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/storage.py", line 253, in _async_callback_delayed_write
    await self._async_handle_write_data()
  File "/usr/src/homeassistant/homeassistant/helpers/storage.py", line 278, in _async_handle_write_data
    await self.hass.async_add_executor_job(
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/storage.py", line 289, in _write_data
    json_util.save_json(
  File "/usr/src/homeassistant/homeassistant/util/json.py", line 92, in save_json
    write_utf8_file_atomic(filename, json_data, private)
  File "/usr/src/homeassistant/homeassistant/util/file.py", line 40, in write_utf8_file_atomic
    fdesc.write(utf8_data)
UnicodeEncodeError: 'ascii' codec can't encode character '\u738b' in position 543: ordinal not in range(128)
回复

使用道具 举报

2

主题

17

帖子

238

积分

中级会员

Rank: 3Rank: 3

积分
238
金钱
221
HASS币
0
 楼主| 发表于 2022-11-5 21:53:33 | 显示全部楼层
louis_lee 发表于 2022-11-5 21:45
UnicodeEncodeError: 'ascii' codec can't encode characters in position 31-32: ordinal not in range(12 ...

几个月前创建过一个自动化,当时是正常的。这期间除了升级系统之外也没有别的什么操作,我还想不到可能是哪里的问题
回复

使用道具 举报

18

主题

587

帖子

4293

积分

元老级技术达人

积分
4293
金钱
3671
HASS币
182
发表于 2022-11-5 21:58:16 | 显示全部楼层
'ascii' codec can't encode character '\u738b' in position 543: ordinal not in range(128)
'\u738b'就是中文的“王”字,你是在哪里使用的中文么?有可能是新版本不支持啊。
回复

使用道具 举报

2

主题

17

帖子

238

积分

中级会员

Rank: 3Rank: 3

积分
238
金钱
221
HASS币
0
 楼主| 发表于 2022-11-5 22:27:04 | 显示全部楼层
louis_lee 发表于 2022-11-5 21:58
'ascii' codec can't encode character '%u738b' in position 543: ordinal not in range(128)
'%u738b'就 ...

如果我的记忆没错的话,我的账户名一直都是”wang“而并非”王“,因为我在我保存密码的工具中显示我一直使用的用户名都是”wang“。 但我刚才去看的时候,发现用户名确实是”王“,我也不确定是否是我自己更改的。我将用户名重新改为”wang“并重启后,依旧提示相同的错误。错误日志如下:
Logger: aiohttp.server
Source: util/file.py:40
First occurred: 22:23:21 (1 occurrences)
Last logged: 22:23:21

Error handling request
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 82, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/__init__.py", line 147, in post
    await hass.async_add_executor_job(_write, path, current)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/config/__init__.py", line 243, in _write
    write_utf8_file_atomic(path, contents)
  File "/usr/src/homeassistant/homeassistant/util/file.py", line 40, in write_utf8_file_atomic
    fdesc.write(utf8_data)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 31-32: ordinal not in range(128)
回复

使用道具 举报

18

主题

587

帖子

4293

积分

元老级技术达人

积分
4293
金钱
3671
HASS币
182
发表于 2022-11-5 22:34:21 | 显示全部楼层
hass1002 发表于 2022-11-5 22:27
如果我的记忆没错的话,我的账户名一直都是”wang“而并非”王“,因为我在我保存密码的工具中显示我一直 ...
UnicodeEncodeError: 'ascii' codec can't encode characters in position 31-32: ordinal not in range(128)

position与之前一样,还是31-32,可能还有哪个地方没改。

File "/usr/src/homeassistant/homeassistant/components/config/__init__.py", line 243, in _write
    write_utf8_file_atomic(path, contents)

看起来像是配置文件啥的。

可以尝试给文件手工打个断点,再启动,看看具体是哪个文件的问题
/usr/src/homeassistant/homeassistant/components/config/__init__.py", line 243, in _write
    write_utf8_file_atomic(path, contents)

这个位置前面前面加个print(path, contents)先试试看看,是哪部分引起的问题。
回复

使用道具 举报

0

主题

86

帖子

1953

积分

金牌会员

Rank: 6Rank: 6

积分
1953
金钱
1867
HASS币
0
发表于 2022-11-7 15:33:22 | 显示全部楼层
我也遇到这个问题了,应该是新版本导致的,正在回退测试
回复

使用道具 举报

0

主题

23

帖子

196

积分

注册会员

Rank: 2

积分
196
金钱
173
HASS币
0
发表于 2022-12-8 22:32:39 | 显示全部楼层
我试过,之前我是因为autometion.yaml里面的格式出错试过
回复

使用道具 举报

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

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-28 14:39 , Processed in 0.068693 second(s), 30 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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