sindrebroch / ha-magicmirror

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

Failed setup 400 Bad Request #29

Closed hesspoint closed 1 month ago

hesspoint commented 2 months ago

Version of the custom_component

latest of everything: MM, MM HA integration 1.5.0b5, latest fork of MMM-Remote Control MM module from sindrebroch, HA Core 2024.8.1, Supervisor 2024.08.0, Operating System 13.0

Describe the bug

Since yesterday the integration won't connect to my MM anymore:

Failed setup, will retry: Response not 200 OK <ClientResponse(http://xxxxxxxxxxx:8080/api/brightness) [400 Bad Request]> <CIMultiDictProxy('Access-Control-Allow-Origin': '*', 'Referrer-Policy': 'no-referrer', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Content-Type-Options': 'nosniff', 'X-DNS-Prefetch-Control': 'off', 'X-Download-Options': 'noopen', 'X-Frame-Options': 'SAMEORIGIN', 'X-Permitted-Cross-Domain-Policies': 'none', 'X-XSS-Protection': '0', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '166', 'Etag': 'W/"a6-7TFy9clM9rwQNiht2z4gvOP9Avg"', 'Date': 'Thu, 15 Aug 2024 11:35:57 GMT', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=5')>

Before it was working. I did not do any changes or updates to MM, HA, modules or integration. Only update I did was HA Operating System from 12.x to 13.0. That coincided with the integration stopping to work. However no idea if the HA Operating system has any impact on the integration, I honestly doubt it.

The usual things like rebooting MM, the MM pi, restarting HA etc. does not help

Interestingly I noticed a while ago that I could not turn the screen on and off via the integration anymore (I opened a separate issue for that a while back). It is interesting as the log mentions the brightness which is part of the monitor entitiy where already the turn on/off was not working, though up to now the brightness slider was working fine. My guess is somehow that is the culprit.

Also important info: The MM itself is up and running and I can access it via the MMM-RemoteControl web interface (outside of home assistant) just fine. So it does not seem to be the module but the HA integration somehow.

Debug log


Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 354, in _async_refresh
    self.data = await self._async_update_data()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/magicmirror/coordinator.py", line 64, in _async_update_data
    brightness: QueryResponse = await self.api.get_brightness()
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/magicmirror/api.py", line 212, in get_brightness
    return QueryResponse.from_dict(await self.get(API_BRIGHTNESS))
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/magicmirror/api.py", line 108, in get
    return await self.handle_request(get)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/magicmirror/api.py", line 85, in handle_request
    raise Exception(f"Response not 200 OK {resp}")
Exception: Response not 200 OK <ClientResponse(http://xxxxxxxxx:8080/api/brightness) [400 Bad Request]>
<CIMultiDictProxy('Access-Control-Allow-Origin': '*', 'Referrer-Policy': 'no-referrer', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'X-Content-Type-Options': 'nosniff', 'X-DNS-Prefetch-Control': 'off', 'X-Download-Options': 'noopen', 'X-Frame-Options': 'SAMEORIGIN', 'X-Permitted-Cross-Domain-Policies': 'none', 'X-XSS-Protection': '0', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '166', 'Etag': 'W/"a6-7TFy9clM9rwQNiht2z4gvOP9Avg"', 'Date': 'Thu, 15 Aug 2024 11:07:25 GMT', 'Connection': 'keep-alive', 'Keep-Alive': 'timeout=5')>
hesspoint commented 2 months ago

@sindrebroch any news?? It is very annoying not being able to control the MM anymore and throws my automations out of wack. Please check the issue. Thanks!

hesspoint commented 1 month ago

Ok I solved this one by completely deleting the integration and setting it up again.

Yet many other issues persist