node-alarm-dot-com / homebridge-node-alarm-dot-com

Alarm.com plugin for Homebridge using Node.js
MIT License
58 stars 23 forks source link

404 Error when too many sensors #62

Closed siglumous closed 1 year ago

siglumous commented 3 years ago

Getting a 404 error, which I suspect is caused by a too-long URL. My system has 96 devices, resulting in a very long GET statement. Here is the error message received:

[3/10/2021, 06:55:16] [Security System] Error: GET https://www.alarm.com/web/api/devices/sensors?ids%5B%5D=100167024-95&ids%5B%5D=100167024-91&ids%5B%5D=100167024-81&ids%5B%5D=100167024-80&ids%5B%5D=100167024-79&ids%5B%5D=100167024-16&ids%5B%5D=100167024-17&ids%5B%5D=100167024-18&ids%5B%5D=100167024-19&ids%5B%5D=100167024-20&ids%5B%5D=100167024-21&ids%5B%5D=100167024-5&ids%5B%5D=100167024-77&ids%5B%5D=100167024-78&ids%5B%5D=100167024-96&ids%5B%5D=100167024-4&ids%5B%5D=100167024-73&ids%5B%5D=100167024-39&ids%5B%5D=100167024-40&ids%5B%5D=100167024-41&ids%5B%5D=100167024-42&ids%5B%5D=100167024-43&ids%5B%5D=100167024-44&ids%5B%5D=100167024-75&ids%5B%5D=100167024-84&ids%5B%5D=100167024-49&ids%5B%5D=100167024-1&ids%5B%5D=100167024-76&ids%5B%5D=100167024-8&ids%5B%5D=100167024-9&ids%5B%5D=100167024-10&ids%5B%5D=100167024-11&ids%5B%5D=100167024-12&ids%5B%5D=100167024-13&ids%5B%5D=100167024-14&ids%5B%5D=100167024-15&ids%5B%5D=100167024-3&ids%5B%5D=100167024-72&ids%5B%5D=100167024-87&ids%5B%5D=100167024-32&ids%5B%5D=100167024-33&ids%5B%5D=100167024-34&ids%5B%5D=100167024-35&ids%5B%5D=100167024-36&ids%5B%5D=100167024-37&ids%5B%5D=100167024-38&ids%5B%5D=100167024-68&ids%5B%5D=100167024-7&ids%5B%5D=100167024-83&ids%5B%5D=100167024-65&ids%5B%5D=100167024-67&ids%5B%5D=100167024-58&ids%5B%5D=100167024-66&ids%5B%5D=100167024-55&ids%5B%5D=100167024-57&ids%5B%5D=100167024-2&ids%5B%5D=100167024-45&ids%5B%5D=100167024-70&ids%5B%5D=100167024-23&ids%5B%5D=100167024-24&ids%5B%5D=100167024-25&ids%5B%5D=100167024-26&ids%5B%5D=100167024-27&ids%5B%5D=100167024-28&ids%5B%5D=100167024-69&ids%5B%5D=100167024-85&ids%5B%5D=100167024-22&ids%5B%5D=100167024-90&ids%5B%5D=100167024-86&ids%5B%5D=100167024-71&ids%5B%5D=100167024-74&ids%5B%5D=100167024-29&ids%5B%5D=100167024-30&ids%5B%5D=100167024-31&ids%5B%5D=100167024-64&ids%5B%5D=100167024-54&ids%5B%5D=100167024-63&ids%5B%5D=100167024-89&ids%5B%5D=100167024-53&ids%5B%5D=100167024-93&ids%5B%5D=100167024-6&ids%5B%5D=100167024-82&ids%5B%5D=100167024-62&ids%5B%5D=100167024-92&ids%5B%5D=100167024-88&ids%5B%5D=100167024-51&ids%5B%5D=100167024-60&ids%5B%5D=100167024-56&ids%5B%5D=100167024-61&ids%5B%5D=100167024-50&ids%5B%5D=100167024-59&ids%5B%5D=100167024-52&ids%5B%5D=100167024-94&ids%5B%5D=100167024-46&ids%5B%5D=100167024-47 failed: 404 at /usr/local/lib/node_modules/homebridge-node-alarm-dot-com/node_modules/node-alarm-dot-com/dist/index.js:470:15 at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:93:5) at async Promise.all (index 1) at async Promise.all (index 0)

happyzorro commented 3 years ago

I am getting similar errors that started to pop up a couple of days ago. Sometimes they are similar to siglumous error above and every few minutes I get the one below.

Error: POST https://www.alarm.com/web/Default.aspx failed: request to https://www.alarm.com/web/Default.aspx failed, reason: read ECONNRESET at C:\Users\Administrator\AppData\Roaming\npm\node_modules\homebridge-node-alarm-dot-com\node_modules\node-alarm-dot-com\dist\index.js:83:19 at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:97:5)

dw333wv commented 3 years ago

Same here:

Error: GET https://www.alarm.com/web/api/systems/systems/4483115 failed: request to https://www.alarm.com/web/api/systems/systems/4483115 failed, reason: read ECONNRESET at /usr/local/lib/node_modules/homebridge-node-alarm-dot-com/node_modules/node-alarm-dot-com/dist/index.js:466:15 at processTicksAndRejections (internal/process/task_queues.js:93:5)

siglumous commented 3 years ago

these sound like different errors from the original and shouldn't be considered part of this issue thread. a 404 error typically means page not found. my guess is that is the correct error message, but I'm trying to understand why. My first guess was that the URL formed is too long. Another guess is that sensor 48 in my system has been disabled at the panel due to an issue with the physical sensor itself. I don't see that sensor number in the list created by the URL. It's clear that homebridge-node-alarm-dot-com logs in successfully, it must do some sort of poll/pull of the sensors (the IDs are formed correctly) but then encounters something it is not expecting. Hoping someone can debug or suggest workaround. Thanks,

siglumous commented 3 years ago

Hi, I'm still having the same errors as I initially posted. It's not the same as the ECONNECT errors that others weighed in with. I get the 404 error that I originally posted. Could this have anything to do with having so many sensors (96)? I started adding them all to the ignoredDevices list, including the ones that are listed in the error message, but I still get the same error message. My guess is the the initial GET communicates with the the alarm.com service and pulls all registered sensors...then filters them out so that the ignoredDevices isn't helpful. Hoping to get some help troubleshooting if anyone can assist. Thanks,

DMBlakeley commented 3 years ago

What version are you using, v1.7.1 or v1.7.2-beta.9? Although the beta version supports 2 factor authorization it can be used without. Benefit is that cached sensors are handled correctly and reduces communication with Alarm.com startup accordingly. May address the 404 error in the process.

I have submitted a pull request for a sampling error in beta-9 but has not been acknowledged by the author as of yet.

siglumous commented 3 years ago

Multiple.

I am a "new" user of this accessory, although I've been using HomeBridge for about 5 years. I originally installed alarm-dot-com using 1.7.1 a few months ago and I got the 404 error that is shown in my original post. After reading about the ECONNECT errors everyone was having (I didn't have that error message), I went to 1.7.2-beta--and received the same 404 error. I recently read on the ECONNECT MEGATHREAD about downgrading, so went down to 1.6.5--again, same 404 error message. That's when I decided to re-activate this issue.

I only mention the 96 sensors since when I activated the system with AlarmGrid, they were kinda surprised by the number of sensors my system had. So I have it in my head that 96 is alot. Perhaps it's not. I had read that a 404 error can be thrown by some servers when the GET is too long...and I made the connection that the URL that gets formed for a 96-sensor system may be too long and therefore be the issue.

Would it be worth trying to disable some of the sensors at the panel as a way to reduce the size of the initial GET URL?

siglumous commented 3 years ago

Thanks @DMBlakeley.

I just deleted the last 11 zones at the panel, so now there are 85 zones. Unfortunately I get the same error message:

UNHANDLED ERROR: Error: GET https://www.alarm.com/web/api/devices/sensors?ids%5B%5D=100167024-95&ids%5B%5D=100167024-91&ids%5B%5D=100167024-81&ids%5B%5D=100167024-80&ids%5B%5D=100167024-79&ids%5B%5D=100167024-16&ids%5B%5D=100167024-17&ids%5B%5D=100167024-18&ids%5B%5D=100167024-19&ids%5B%5D=100167024-20&ids%5B%5D=100167024-21&ids%5B%5D=100167024-5&ids%5B%5D=100167024-77&ids%5B%5D=100167024-78&ids%5B%5D=100167024-4&ids%5B%5D=100167024-73&ids%5B%5D=100167024-39&ids%5B%5D=100167024-40&ids%5B%5D=100167024-41&ids%5B%5D=100167024-42&ids%5B%5D=100167024-43&ids%5B%5D=100167024-44&ids%5B%5D=100167024-75&ids%5B%5D=100167024-84&ids%5B%5D=100167024-49&ids%5B%5D=100167024-96&ids%5B%5D=100167024-1&ids%5B%5D=100167024-76&ids%5B%5D=100167024-8&ids%5B%5D=100167024-9&ids%5B%5D=100167024-10&ids%5B%5D=100167024-11&ids%5B%5D=100167024-12&ids%5B%5D=100167024-13&ids%5B%5D=100167024-14&ids%5B%5D=100167024-15&ids%5B%5D=100167024-3&ids%5B%5D=100167024-72&ids%5B%5D=100167024-87&ids%5B%5D=100167024-32&ids%5B%5D=100167024-33&ids%5B%5D=100167024-34&ids%5B%5D=100167024-35&ids%5B%5D=100167024-36&ids%5B%5D=100167024-37&ids%5B%5D=100167024-68&ids%5B%5D=100167024-7&ids%5B%5D=100167024-83&ids%5B%5D=100167024-65&ids%5B%5D=100167024-67&ids%5B%5D=100167024-58&ids%5B%5D=100167024-66&ids%5B%5D=100167024-55&ids%5B%5D=100167024-57&ids%5B%5D=100167024-2&ids%5B%5D=100167024-45&ids%5B%5D=100167024-70&ids%5B%5D=100167024-23&ids%5B%5D=100167024-24&ids%5B%5D=100167024-25&ids%5B%5D=100167024-26&ids%5B%5D=100167024-27&ids%5B%5D=100167024-28&ids%5B%5D=100167024-69&ids%5B%5D=100167024-85&ids%5B%5D=100167024-22&ids%5B%5D=100167024-90&ids%5B%5D=100167024-86&ids%5B%5D=100167024-71&ids%5B%5D=100167024-74&ids%5B%5D=100167024-29&ids%5B%5D=100167024-30&ids%5B%5D=100167024-31&ids%5B%5D=100167024-64&ids%5B%5D=100167024-54&ids%5B%5D=100167024-63&ids%5B%5D=100167024-89&ids%5B%5D=100167024-53&ids%5B%5D=100167024-93&ids%5B%5D=100167024-6&ids%5B%5D=100167024-82&ids%5B%5D=100167024-62&ids%5B%5D=100167024-92&ids%5B%5D=100167024-88&ids%5B%5D=100167024-51&ids%5B%5D=100167024-60&ids%5B%5D=100167024-56&ids%5B%5D=100167024-61&ids%5B%5D=100167024-50&ids%5B%5D=100167024-59&ids%5B%5D=100167024-52&ids%5B%5D=100167024-94&ids%5B%5D=100167024-46&ids%5B%5D=100167024-47&ids%5B%5D=100167024-48 failed: 404 at get (/usr/local/lib/node_modules/homebridge-node-alarm-dot-com/node_modules/node-alarm-dot-com/dist/index.js:463:15) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:95:5) at authenticatedGet (/usr/local/lib/node_modules/homebridge-node-alarm-dot-com/node_modules/node-alarm-dot-com/dist/index.js:421:17) at Object.getCurrentState (/usr/local/lib/node_modules/homebridge-node-alarm-dot-com/node_modules/node-alarm-dot-com/dist/index.js:144:35) at async Promise.all (index 0) at ADCPlatform.listDevices (/usr/local/lib/node_modules/homebridge-node-alarm-dot-com/src/index.ts:305:26)

It feels like it can't handle creating a GET that's longer than that shown. It chokes on/about the 48th zone. Is there a max length to the URL formed?

siglumous commented 3 years ago

Scratch that. I rebooted the Pi and now am getting further. Hang on...

siglumous commented 3 years ago

Yup, that did it! To recap: I deleted 11 (96 down to 85) sensors in my panel. Now (after a Pi reboot) the accessory loads correctly (and shows up in my Home app). I am getting some messages in the Homebridge log that a number of the sensors/accessories are being ignored. They seem to be windows, but will review documentation to learn about what sensors are supported.

Thanks a bunch. It sounds like there's a potential fix in an upcoming release (multiple calls) which will enable me to re-enable the 11 sensors I deleted, so I'll wait for that.

Here's the output from the log file/console (edited): [20/08/2021, 15:48:24] [Security System] Logged into Alarm.com as vxxxxx@gmail.com [20/08/2021, 15:48:42] [Security System] Received 1 partitions from Alarm.com [20/08/2021, 15:48:42] [Security System] Restoring accessory with ID xxxxx-127 [20/08/2021, 15:48:42] [Security System] Received 83 sensors from Alarm.com [20/08/2021, 15:48:42] [Security System] Restoring accessory with ID xxxxx-81 [20/08/2021, 15:48:42] [Security System] Ignored sensor Covered Terrace Window 2 (xxxxx-40)

and so on, with various sensors with different IDs "restored" and other sensors ignored.

DMBlakeley commented 3 years ago

Glad to hear that you were able to get up and running. As an FYI, I have generally found that a second reboot of the pi especially after setting devices to ignore is required. The first removes the device from the cache and then the second is a clean reboot.

Hopefully @chase9 will be able to add some batch code that will allow you to use all of your sensors. As of the end of the month I will not longer have access to Alarm.com due to a move.

siglumous commented 2 years ago

just checking in to see if this fix may be in the works and if i should be "waiting patiently" for it? many thanks.

snapst3r commented 2 years ago

I have the same GET 404 errors and a >90 sensor system -- bumping the thread for any updates

siglumous commented 2 years ago

Hoping this will be resolved in an upcoming release. Any thoughts @chase9 ? Many thanks.

chase9 commented 2 years ago

This issue should be resolved in the latest beta (1.8.1-beta.2), please test and let me know.

siglumous commented 1 year ago

Chase9--apologies for not checking in sooner. Just saw your update today, downloaded the 1.8.1-beta.2 version and am happy to say it all works!!! thanks much for everything. now I need to put some logical names to my sensors so I know which sensor is what. THANKS again.

chase9 commented 1 year ago

So glad to hear that it worked!