pschroeder89 / homebridge-levoit-humidifiers

Levoit Humidifiers Plugin for Apple HomeKit via Homebridge
Apache License 2.0
70 stars 9 forks source link

Error: getaddrinfo ENOTFOUND smartapi.vesync.com #18

Closed fetzu closed 2 years ago

fetzu commented 2 years ago

Describe The Bug: When setting up the plugin in a dockerized Homebridge instance (freshly pulled oznu/homebridge:latest), the humidifier is not reachable (because the API itself seems unreachable).

Interestingly, the homebridge instance managed to reach VeSync's API at least once, and the device showed up in Homebridge (but without the ability to control). The logs (below), show that the API (smartapi.vesync.com) is not reachable.

Not sure if it matters, but:

  1. Pinging (through the homebridge instance's /bin/sh) shows that:
  1. Doing the same from another random docker instance or from the host machine (Synology NAS) itself resolves all three hosts (including the API).

  2. Running an nslookup from the homebridge container's console works and returns:

Non-authoritative answer:
smartapi.vesync.com     canonical name = vesyncappapi-1834200178.us-east-1.elb.amazonaws.com

To Reproduce:

Simply (re)start the homebridge instance with the homebridge-levoit-humidifiers plugin enabled and let it run for a while.

Expected behavior:

Homebridge manages to connect to VeSync's API and control the devices

Logs:

[3/5/2022, 12:20:02 PM] [CHILDHUBNAME] [DEBUG]: [START SESSION] Starting auth session...
[3/5/2022, 12:20:02 PM] [CHILDHUBNAME] [DEBUG]: [LOGIN] Logging in...
[3/5/2022, 12:20:02 PM] Homebridge v1.4.0 (HAP v0.10.0) (CHILDHUBNAME) is running on port NNNNN.
Error: getaddrinfo ENOTFOUND smartapi.vesync.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26)
[3/5/2022, 12:20:02 PM] [CHILDHUBNAME] Child bridge process ended
[3/5/2022, 12:20:02 PM] [CHILDHUBNAME] Process Ended. Code: 1, Signal: null
[3/5/2022, 12:20:09 PM] [CHILDHUBNAME] Restarting Process...
[3/5/2022, 12:20:10 PM] [CHILDHUBNAME] Launched child bridge with PID 3933
[3/5/2022, 12:20:10 PM] Registering platform 'homebridge-levoit-humidifiers.LevoitHumidifiers'
[3/5/2022, 12:20:10 PM] [CHILDHUBNAME] Loaded homebridge-levoit-humidifiers v1.6.0 child bridge successfully
[3/5/2022, 12:20:10 PM] [CHILDHUBNAME] [DEBUG]: [PLATFORM] Debug mode enabled
[3/5/2022, 12:20:10 PM] [CHILDHUBNAME] Connecting to the servers...
[3/5/2022, 12:20:10 PM] [CHILDHUBNAME] [DEBUG]: [START SESSION] Starting auth session...
[3/5/2022, 12:20:10 PM] [CHILDHUBNAME] [DEBUG]: [LOGIN] Logging in...
[3/5/2022, 12:20:10 PM] Homebridge v1.4.0 (HAP v0.10.0) (CHILDHUBNAME) is running on port NNNNN.
Error: getaddrinfo ENOTFOUND smartapi.vesync.com
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:71:26)
[3/5/2022, 12:20:10 PM] [CHILDHUBNAME] Child bridge process ended
[3/5/2022, 12:20:10 PM] [CHILDHUBNAME] Process Ended. Code: 1, Signal: null
[3/5/2022, 12:20:17 PM] [CHILDHUBNAME] Restarting Process...
[3/5/2022, 12:20:18 PM] [CHILDHUBNAME] Launched child bridge with PID 3944
[3/5/2022, 12:20:18 PM] Registering platform 'homebridge-levoit-humidifiers.LevoitHumidifiers'
[3/5/2022, 12:20:18 PM] [CHILDHUBNAME] Loaded homebridge-levoit-humidifiers v1.6.0 child bridge successfully
[3/5/2022, 12:20:18 PM] [CHILDHUBNAME] [DEBUG]: [PLATFORM] Debug mode enabled
[3/5/2022, 12:20:18 PM] [CHILDHUBNAME] Connecting to the servers...
[3/5/2022, 12:20:18 PM] [CHILDHUBNAME] [DEBUG]: [START SESSION] Starting auth session...
[3/5/2022, 12:20:18 PM] [CHILDHUBNAME] [DEBUG]: [LOGIN] Logging in...
[3/5/2022, 12:20:18 PM] Homebridge v1.4.0 (HAP v0.10.0) (CHILDHUBNAME) is running on port NNNNN.
[3/5/2022, 12:20:19 PM] [CHILDHUBNAME] [DEBUG]: [LOGIN] The authentication success
[3/5/2022, 12:20:19 PM] [CHILDHUBNAME] Discovering devices...
[3/5/2022, 12:20:19 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICES] Device List -> JSON: [{#Device data in JSON shown here, looks OK.#}]
[3/5/2022, 12:20:19 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:20:20 PM] [CHILDHUBNAME] Adding new accessory: ACCESSORYNAME
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:05 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:06 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:06 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:06 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:06 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:06 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:06 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:06 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:06 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:06 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com
[3/5/2022, 12:30:06 PM] [CHILDHUBNAME] [DEBUG]: [GET DEVICE INFO] Getting device info...
[3/5/2022, 12:30:06 PM] [CHILDHUBNAME] getaddrinfo ENOTFOUND smartapi.vesync.com

NOTE: The first part (up to The authentication success) repeats for approximately 15 minutes. Truncated for space. The following part also repeats ad infinitum.

Plugin Config:

        {
            "name": "CHILDHUBNAME",
            "email": "@",
            "password": "hunter2",
            "platform": "LevoitHumidifiers",
            "enableDebugMode": true,
            "_bridge": {
                "username": "00:XX:XX:XX:XX:00",
                "port": 11111
            }
        }

Screenshots:

Environment:

Thanks in advance for your support :).

fetzu commented 2 years ago

Additional info: the moment VeSync's API is finally reachable (for a single call apparently) is not always the time (time from start); it sometimes happens within two minutes and sometimes takes 20+ minutes.

fetzu commented 2 years ago

I took some more time to troubleshoot this, and the error was due to some exotic DNS config on my network; specifying custom DNS servers for the container fixed the issue and the plugin is able to connect and maintain its connection.

Closing this now.