mega_hacs icon indicating copy to clipboard operation
mega_hacs copied to clipboard

Пустой responce_template вызывает [aiohttp.server] Error handling request

Open kamulchik opened this issue 2 years ago • 0 comments

В responce_template, когда нет нужды отправлять d или ещё какую-нибудь команду меге, я оставил значение пустым. mega3: 3: response_template: "" 4: response_template: ""

В логе, в таком случае, ошибка.

Версии систем Enviroment: linux/docker HA version: mega_hacs version: 1.0.10b6 megad firmware version: используется mqtt: false

Ожидаемое поведение Интеграция отправит ответ меге с http кодом 200 и пустым телом.

LOG 2022-01-25 23:22:46 DEBUG (MainThread) [custom_components.mega.http.http] request from 192.168.1.200 <CIMultiDictProxy('Host': '192.168.1.200:8123', 'Connection': 'close', 'User-Agent': 'megad', 'Accept': 'text/html', 'Cache-Control': 'no-cache')> 2022-01-25 23:22:46 DEBUG (MainThread) [custom_components.mega.http.http] Request: {'pt': '4', 'm': '1', 'cnt': '58', 'mdid': 'mega3'} from '192.168.1.200' 2022-01-25 23:22:46 DEBUG (MainThread) [custom_components.mega.mega3.mega3_04] state after update off 2022-01-25 23:22:46 DEBUG (MainThread) [custom_components.mega.http.http] response 200 2022-01-25 23:22:46 ERROR (MainThread) [aiohttp.server] Error handling request Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/web_response.py", line 620, in body self._body = body = payload.PAYLOAD_REGISTRY.get(body) File "/usr/local/lib/python3.9/site-packages/aiohttp/payload.py", line 112, in get raise LookupError() aiohttp.payload.LookupError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request resp = await self._request_handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle resp = await handler(request) File "/usr/local/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 119, 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 77, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 24, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 78, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 144, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 135, in handle result = await result File "/config/custom_components/mega/http.py", line 148, in get Response(body='' if hub.fake_response else ret, content_type='text/plain') File "/usr/local/lib/python3.9/site-packages/aiohttp/web_response.py", line 595, in init self.body = body File "/usr/local/lib/python3.9/site-packages/aiohttp/web_response.py", line 622, in body raise ValueError("Unsupported body type %r" % type(body)) ValueError: Unsupported body type <class 'int'>

kamulchik avatar Jan 25 '22 20:01 kamulchik