milo526 / homebridge-tuya-web

Hoobs and Homebridge plugin for Tuya devices using Home Assistant Tuya Web Api
MIT License
219 stars 95 forks source link

getaddrinfo ENOTFOUND px1.tuyaeu.com #470

Closed MarcusSRussell closed 2 years ago

MarcusSRussell commented 2 years ago

Describe the bug

I am new to this so not sure this is a bug but I have Homebridge running on a MacBook Air (BigSur) and have successfully installed this plugin which works perfectly. However after any restart of the Mac I get this error:

[TuyaWebPlatform] getaddrinfo ENOTFOUND px1.tuyaeu.com

If I restart Homebridge from the GUI it then works fine. I assumed maybe Homebridge is starting before the Mac makes a WiFi connection but I would have expected it to just detect when the wiFi (and thus internet) is connected.

I have not had this occur at any other time than after the Mac is restarted.

Steps To Reproduce Restart Mac No Accessories showing Go to Homebridge UI Inspect log Restart Homebridge from UI No errors in Log All accessories showing

Plugin Version

Plug in version is current (1.1.2) and Homebridge UI is 4.5.1

Homebridge Config

{
    "name": "TuyaWebPlatform",
    "options": {
        "username": "marcus@glebelands.com",
        "password": "REDACTED",
        "countryCode": "44",
        "platform": "tuya",
        "pollingInterval": 1030
    },
    "defaults": [
        {
            "device_type": "form"
        }
    ],
    "scenes": true,
    "platform": "TuyaWebPlatform"
}

Device Config

Additional Context Not sure if I am missing something in the config? Many thanks for your help Marcus

milo526 commented 2 years ago

After you restart your mac but before you restart homebridge; can you control your light or whatever devices you have?

P.s. I removed your password from your post, you might want to update that password and not paste it in a public place 😛

MarcusSRussell commented 2 years ago

I have just restarted about 4 times and yes every time this works OK - I am sure it wasn't as I was seeing the devices in Apple Home as 'updating' but now they are there all the time - beginning to think I. am imagining things!

Oh and thank you for spotting and making safe the school boy error!!

MarcusSRussell commented 2 years ago

Further to my last comment I still kept getting intermittent issues where HomeKit couldn't find the accessories managed by Homebridge unless I rebooted home bridge.

I have now found a workaround which might prove useful for anyone else with this issue which it seems to me is Homebridge Server related and is not due to this plugin.

I have moved the plist file for HomebridgeServer from Library/LaunchDaemons to the Users/loggedonusername/Library/LaunchAgents And all now works well. In this case I have the default user logon at startup so that the services provided by this MacBook restart after a power failure or similar without my intervention. Presumably the small delay incurred by moving it to the user LaunchAgents folder avoids the issue with whatever it is on my system that Homebridge wasn't seeing at start up.

Anyway thanks again for your help @milo526