sindrebroch / ha-magicmirror

Custom HomeAssistant-integration for MagicMirror
Apache License 2.0
14 stars 0 forks source link

From HA i get unknown error occurred. #17

Open jangshik opened 2 years ago

jangshik commented 2 years ago

Hello, first of all thank you for making such a great integration.

I have installed MMM-Remote-Control manually installed from your git. It seems i can access and use features on the web page(magicmirror ip:8080/remote.html)

but when i try to access from home assistant(same IP, whitelisted 192.168.29.0/24, HA IP and also tried with blank whitelist []) I get Unknown error occurred.

it seems i get err 104 connection reset by peer.errors={'base': 'cannot_connect'}

i can ssh from ha to magic mirror host ip, i dont understand why i get connection reset by peer.

Help would be very appreciated.

Thanks.

Version of the custom_component

v1.4.0

Configuration

MagicMirror config.js { module: 'MMM-Remote-Control', config: { customCommand: {}, showModuleApiMenu: true, secureEndpoints: true, apiKey: "somethingindigits", } },


Add your logs here.

Logger: custom_components.magicmirror Source: custom_components/magicmirror/config_flow.py:61 Integration: Magic Mirror (documentation, issues) First occurred: 17:12:10 (1 occurrences) Last logged: 17:12:10

error=[Errno 104] Connection reset by peer. errors={'base': 'cannot_connect'}

Logger: aiohttp.server Source: custom_components/magicmirror/api.py:83 Integration: Magic Mirror (documentation, issues) First occurred: 17:01:03 (23 occurrences) Last logged: 17:12:23

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 222, 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/config_entries.py", line 178, in post return await super().post(request, flow_id) File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper result = await method(view, request, data, *args, *kwargs) File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 110, in post result = await self._flow_mgr.async_configure(flow_id, data) File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 280, in async_configure result = await self._async_handle_step( File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 367, in _async_handle_step result: FlowResult = await getattr(flow, method)(user_input) File "/config/custom_components/magicmirror/config_flow.py", line 54, in async_step_user response: GenericResponse = await api.api_test() File "/config/custom_components/magicmirror/api.py", line 146, in api_test return GenericResponse.from_dict(await self.get(API_TEST)) File "/config/custom_components/magicmirror/api.py", line 106, in get return await self.handle_request(get) File "/config/custom_components/magicmirror/api.py", line 83, in handle_request raise Exception(f"Response not 200 OK {resp}") Exception: Response not 200 OK <ClientResponse(http://192.168.29.112:8080/api/test) [400 Bad Request]> <CIMultiDictProxy('Access-Control-Allow-Origin': '', 'X-DNS-Prefetch-Control': 'off', 'Expect-CT': 'max-age=0', 'X-Frame-Options': 'SAMEORIGIN', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Download-Options': 'noopen', 'X-Content-Type-Options': 'nosniff', 'X-Permitted-Cross-Domain-Policies': 'none', 'Referrer-Policy': 'no-referrer', 'X-XSS-Protection': '0', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '166', 'Etag': 'W/"a6-7TFy9clM9rwQNiht2z4gvOP9Avg"', 'Date': 'Tue, 04 Oct 2022 08:01:03 GMT', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=5')>

Describe the bug

A clear and concise description of what the bug is.

Debug log


Add your logs here.
sindrebroch commented 2 years ago

Hi! Weird, not something I have seen before I think.

Are you able to access http://:8080/api/test from the browser? Shouldn't be a authentication issue when the problem occurs on the test-endpoint.

Are you running the latest version of MagicMirror?

jangshik commented 2 years ago

Hi! Weird, not something I have seen before I think.

Are you able to access http://:8080/api/test from the browser? Shouldn't be a authentication issue when the problem occurs on the test-endpoint.

Are you running the latest version of MagicMirror?

result of http://:8080/api/test (whilst running magic mirror, in a test environment - no display attached using vnc - using ssh command to control it works fine) {"success":false,"status":"error","reason":"unknown","info":"Not initialized, have you opened or refreshed your browser since the last time you started MagicMirror?"} other functions on the remote page regarding raspberry pi commands work, whilst magicmirror command(edit view) does not work.

I am running magicmirror version 2.20.0

sindrebroch commented 1 year ago

Do you by any chance run the MMM-Screencast module? Looks like something similar to this issue, which we never really was able to figure out, and was really hard to reproduce for me.

https://github.com/sindrebroch/ha-magicmirror/issues/2