HomeAssistant-Mods / home-assistant-miele

Miele integration for Home assistant
138 stars 32 forks source link

Failed to retrieve Miele devices: HTTPSConnectionPool(host='api.mcs3.miele.com', port=443) #144

Closed c11umw closed 1 year ago

c11umw commented 1 year ago

Hi. The integration has been working fine for more than 6 months Then after a scheduled overnight reboot it stopped working and hasn't worked since.

Suspected an issue with Miele servers, but the android phone app still works fine. Tried reloading the integration in case of a corrupt file, but it's the same.

My config (configuration.yaml):

# Miele Access
miele:
  client_id: !secret miele_client_id
  client_secret: !secret miele_client_secret
  lang: en

Error 1:

Logger: homeassistant.setup
Source: custom_components/miele/__init__.py:109
Integration: miele ([documentation](https://github.com/HomeAssistant-Mods/home-assistant-miele), [issues](https://github.com/HomeAssistant-Mods/home-assistant-miele/issues))
First occurred: 10:55:47 (1 occurrences)
Last logged: 10:55:47

Error during setup of component miele
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 256, in _async_setup_component
    result = await task
  File "/config/custom_components/miele/__init__.py", line 153, in async_setup
    hass.data[DOMAIN][DATA_DEVICES] = _to_dict(data_get_devices)
  File "/config/custom_components/miele/__init__.py", line 109, in _to_dict
    for item in items:
TypeError: 'NoneType' object is not iterable

Error2:

Logger: custom_components.miele.miele_at_home
Source: custom_components/miele/miele_at_home.py:48
Integration: miele ([documentation](https://github.com/HomeAssistant-Mods/home-assistant-miele), [issues](https://github.com/HomeAssistant-Mods/home-assistant-miele/issues))
First occurred: 10:55:47 (1 occurrences)
Last logged: 10:55:47

Failed to retrieve Miele devices: HTTPSConnectionPool(host='api.mcs3.miele.com', port=443): Max retries exceeded with url: /v1/devices?language=en (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f64f7bb80>: Failed to establish a new connection: [Errno -2] Name does not resolve'))
sxdjt commented 1 year ago

Seems resolvable here.

dig api.mcs3.miele.com

; <<>> DiG 9.10.6 <<>> api.mcs3.miele.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 63415
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;api.mcs3.miele.com.        IN  A

;; ANSWER SECTION:
api.mcs3.miele.com. 11233   IN  A   20.224.173.26

;; Query time: 29 msec
;; SERVER: 192.168.1.1#53(192.168.1.1)
;; WHEN: Fri Mar 03 07:37:17 PST 2023
;; MSG SIZE  rcvd: 63
c11umw commented 1 year ago

Yea, it must be something with my network. I use PiHoles with Unbound DNS and when I ping that name it doesn't resolve (even if I add it to the whitelist).

pi@pihole:~ $ ping api.mcs3.miele.com
ping: api.mcs3.miele.com: No address associated with hostname

It also fails on my PC, but if I manually choose cloudflare DNS in my IP4 then it resolves the name to the IP. Weird

sxdjt commented 1 year ago

Hmm - what upstream DNS are you using on the Pihole?

Edit: If it is network-wide, whatever is resolving your DNS for your router/modem is having issues. If you can, try setting them to use 1.1.1.1 or 9.9.9.9 and see if that helps?

c11umw commented 1 year ago

1.1.1.1 and 1.0.0.1 The same ones I manually define on the PC.

The mobile app still works 'cos it's looking up a different dns name (cdn.api.miele.com)

sxdjt commented 1 year ago

Flush the DNS cache on the Pihole?

c11umw commented 1 year ago

I think it's the router. It's acting buggy when I look into the firewall and system tabs. It was last rebooted about 5 days ago which is about the right timing. I'll reset it after my plex quietens down and retry

c11umw commented 1 year ago

Well damn... Router reboot + HA reboot. Wait 10 minutes and the integration is back.

Bizarre that it affected only 1 address. Not sure why that happened

sxdjt commented 1 year ago

One of the cross-beams went out of skew on the treadle, or maybe mynocks chewing on the power cables most likely.

c11umw commented 1 year ago

... bloody gremlins were at it :D