Open msavage6 opened 8 months ago
@msavage6 I just published a new version, v2.0.1, that I hope will fix this issue. Please let me know if you get things working once you upgrade. Thanks!
Thanks for the quick reply.
I performed the update and restarted HB, unfortunately still seeing the same error:
[10/11/2023, 10:44:22 AM] [homebridge-alexa-smarthome] Found all 8 devices in plugin settings. [10/11/2023, 10:44:22 AM] [homebridge-alexa-smarthome] Updating device states [10/11/2023, 10:44:38 AM] [homebridge-alexa-smarthome] After initialization - HttpError(Error getting smart home device state. Reason: Timeout)
I'm seeing the same issue after a fresh install of homebridge and the plugin v2.0.1 - I'm running ~45 devices
[10/15/2023, 7:26:00 AM] [HomebridgeAlexaSmartHome] Updating device states [10/15/2023, 7:26:15 AM] [HomebridgeAlexaSmartHome] After initialization - HttpError(Error getting smart home device state. Reason: Timeout)
@joeyhage I noticed this issue while debugging https://github.com/joeyhage/homebridge-alexa-smarthome/issues/63 and noticed that queries to the state endpoint on my homebridge can take up to 25 seconds. The problem I noticed is that if the original query errors out, all subsequent queries are submitted with a blank payload (no devices in body, just an empty list).
I'm not super proficient in javascript so I patched my install of alexa-remote2 to have a 30 second base timeout and it's been working ever since. I might take another crack at it but thought I'd pass this on!
PS: the same query from my phone takes like 400ms so there is something strange going on besides the retry logic.
@dltacube Can you share your patch?
I changed flags.timeout || 10000
to 30000
on the line above.
I am having a similar issue. I was able to install the plugin on my HOOBS device and authenticate through Amazon successfully. The logs show the cookie was untrained an updated. But when the bridge restarts and tries to connect to Alex, it fails to do so. I have not been able to get the devices from Alexa.
11/23/2023, 7:56:47 AMAlexa Smarthome BridgeHomebridgeAlexaSmartHomeAlexa login cookie updated. Storing cookie in file: /var/lib/hoobs/alexasmarthomebridge/persist/.homebridge-alexa-smarthome 11/23/2023, 7:56:57 AMAlexa Smarthome Bridge starting 11/23/2023, 7:57:10 AMAlexa Smarthome BridgeLoaded plugin 'homebridge-alexa-smarthome' 11/23/2023, 7:57:10 AMAlexa Smarthome BridgeLoading 1 platforms... 11/23/2023, 7:57:12 AMAlexa Smarthome BridgeBridge is running on port 51896. 11/23/2023, 7:57:12 AMAlexa Smarthome BridgeHomebridgeAlexaSmartHomeERRORFailed to initialize connection to Alexa. - You can try to get the cookie manually by opening http://hoobs.local:9000/ with your browser. 11/23/2023, 7:57:12 AMAlexa Smarthome BridgeHomebridgeAlexaSmartHomeERRORAfter initialization - HttpError(Error getting smart home devices. Reason: Cookie invalid, Renew unsuccessful)
I am having a similar issue. I was able to install the plugin on my HOOBS device and authenticate through Amazon successfully. The logs show the cookie was untrained an updated. But when the bridge restarts and tries to connect to Alex, it fails to do so. I have not been able to get the devices from Alexa.
11/23/2023, 7:56:47 AMAlexa Smarthome BridgeHomebridgeAlexaSmartHomeAlexa login cookie updated. Storing cookie in file: /var/lib/hoobs/alexasmarthomebridge/persist/.homebridge-alexa-smarthome 11/23/2023, 7:56:57 AMAlexa Smarthome Bridge starting 11/23/2023, 7:57:10 AMAlexa Smarthome BridgeLoaded plugin 'homebridge-alexa-smarthome' 11/23/2023, 7:57:10 AMAlexa Smarthome BridgeLoading 1 platforms... 11/23/2023, 7:57:12 AMAlexa Smarthome BridgeBridge is running on port 51896. 11/23/2023, 7:57:12 AMAlexa Smarthome BridgeHomebridgeAlexaSmartHomeERRORFailed to initialize connection to Alexa. - You can try to get the cookie manually by opening http://hoobs.local:9000/ with your browser. 11/23/2023, 7:57:12 AMAlexa Smarthome BridgeHomebridgeAlexaSmartHomeERRORAfter initialization - HttpError(Error getting smart home devices. Reason: Cookie invalid, Renew unsuccessful)
it's exactly the same for me...
This is a shot in the dark, but why not try deleting that cookie, and redoing the initial authentication? The cookie path is in the log, and you can delete by logging into HOOBS and then going to the Terminal in the three dots menu upper-right. Default login is hoobs, password hoobsadmin.
any update on this? i am seeing the same issue and would love to get this to work
@lpleahy what issue are you experiencing? And are you a HOOBS user? I will be able to help you better if you open a new issue and fill out the issue template. Thanks!
For those experiencing the "HttpError(Error getting smart home devices. Reason: Cookie invalid, Renew unsuccessful)" issue, if you are running HOOBS, what version of HOOBS, Homebridge, and Node.js are you using?
I am successfully using homebridge-alexa-smarthome on HOOBS 4.3 on a Raspberry Pi, but I noticed today that my Node.js is stuck at 16.20.2 (21 is current), and my Homebridge is stuck at 1.6 (1.7 is current). It may be that those running up-to-date HOOBS/Homebridge/Node installations will experience this error, while "lucky" me, stuck with an older version, am not.
You can find the versions on the HOOBS dashboard (log into HOOBS with a browser), on the right side.
Hi @joeyhage, thank you for getting back to me and sorry for the delay in following-up.
I am not a HOOBS user, I am using homebridge directly on a raspberry pi. I am seeing the same error that was initially reported in this issue:
[homebridge-alexa-smarthome] After initialization - HttpError(Error getting smart home device state. Reason: Timeout)
I haven't been able to take the time to test this myself yet, but I noticed from this commit that it fixes the call to querySmarthomeDevices
, but I believe it misses some other calls that may be failing for the timeout. Given that @dltacube was able to fix this by patching this line in alexa-remote2
I imagine there are other https calls being made in alexa-api-wrapper.tx
that are not properly plumbing the timeout override through.
I could be missing something, but as an example, this code can accept a maxTimeout
field that is used as part of the flags for the httpsGet
call but it is not set here (note that this would be set to 60_000
with the patch that was set by @dltacube as it covers everything that ultimately invokes the httpsGet
method).
LMK if you'd like me to submit a new issue instead, but I believe this same issue is not fully fixed given the behavior I am experiencing.
Sorry to be a bother, I was just wondering if you were able to take a look at this yet. If not, I can set this up myself locally and try to figure out a fix.
I was able to find a fix, at least for my own version of the issue. Between the new Homebridge installation in which I'd never previously had this issue, I'd majorly reconfigured my network. I'm not sure which device had a fault, but I found that Homebridge started sending successful requests to Amazon whilst I was removing old devices via Alexa iOS. This included a deprecated Eero router, unplugged devices, and devices I no longer use.
I'm not sure if this helps as well, but during my network reconfiguration, I was trying to move all my IoT devices onto a separate wifi VLAN network. I had trouble with this in the beginning and learned I had to go to Amazon Device Preferences(NA/US) and disable "Frustration-free setup" under "Saved Network Passwords" to manually set the correct network during device setup.
homebridge-alexa-smarthome is now working as expected. I'm able to provide anything else in case anyone's interested in my solution.
System Information Running Homebridge 1.7.0 (docker homebridge/homebridge:latest) via compose (Ubuntu Jammy Jellyfish (22.04.3 LTS)) node.js v20.11.0
@kesumin can you please share your solution.
I was able to successfully install the plugin and authenticate with Amazon, or so I thought. I am able to dictate which devices I want to add as accessories and when turning on debug logs as you can see, Homebridge notes all 8 devices are matched, however that is followed by the error: After initialization - HttpError(Error getting smart home device state. Reason: Timeout)
As a result, I can add the child bridge in HomeKit, but no accessories are available to add afterwards.
In the below debug logs I have removed the full listing of Alexa devices detected as there are 92, to reduce clutter,.
Logs:
Plugin Config:
Screenshots:
Environment: