joeyhage / homebridge-alexa-smarthome

Connect Alexa devices to HomeKit
MIT License
65 stars 20 forks source link

Outlet Behavior - Incorrect State #13

Closed rcoletti116 closed 10 months ago

rcoletti116 commented 10 months ago

The state of an outlet device in HomeKit often does not match the actual state in Alexa.

  1. Enable Outlet Device
  2. Initial State seems to be correct
  3. Change State (for example from On to Off)
  4. HomeKit device will immediately switch back to On
  5. State will change in Alexa - but now the States in HomeKit & Alexa are mismatched.
  6. Log indicates a GET error.

Expected behavior:

The state of the device should properly sync between the two systems so that both are always correct.

Logs:

Amazon Plug 2 - Get power - HttpError(Error getting smart home device state. Reason: getaddrinfo ENOTFOUND alexa.amazon.com)

Plugin Config:

        {
            "auth": {
                "refreshInterval": 4,
                "proxy": {
                    "clientHost": "10.0.0.75",
                    "port": 8584
                }
            },
            "devices": [
                "Amazon Plug 1",
                "Amazon Plug 2"
            ],
            "amazonDomain": "amazon.com",
            "language": "en-US",
            "debug": true,
            "_bridge": {
                "username": "0E:AA:34:E4:06:EA",
                "port": 38364
            },
            "platform": "HomebridgeAlexaSmartHome"
        }

Screenshots:

Environment:

joeyhage commented 10 months ago

I see you listed hb-service as the operating system but OS would be one of Windows, Mac, Linux, etc.

Are you using docker?

Also, what hardware are you running homebridge on? Raspberry pi, Synology NAS, etc.

getaddrinfo ENOTFOUND is a common NodeJS issue that can occur intermittently depending on what environment NodeJS is running in. If you search that error in the Homebridge subreddit you will find a lot of information about it.

rcoletti116 commented 10 months ago

I'm using Raspberry Pi with the Homebridge Image; no docker. I have seen similar errors related to DNS in the past. I'll check my network activity and see if anything is getting blocked. I can reach alexa.amazon.com no problem, even from the Pi.

rcoletti116 commented 10 months ago

Confirmed it was a DNS issue. The Pi for some reason wasn't resolving the hostname alexa.amazon.com. A restart of the Pi fixed it.