Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"no response" after installing homebridge 1.3.0 #15

Open
pponce opened this issue Feb 20, 2021 · 42 comments
Open

"no response" after installing homebridge 1.3.0 #15

pponce opened this issue Feb 20, 2021 · 42 comments

Comments

@pponce
Copy link

pponce commented Feb 20, 2021

All zones showing "no response" after install of homebridge 1.3.0

@stevehoek
Copy link

Same here... hoping the dev is still maintaining this, else will have to pin to an older version of Homebridge until someone can fix it

@irctrakz
Copy link

[homebridge-rachio-platform] This plugin generated a warning from the characteristic 'Active': Unhandled error thrown inside read handler for characteristic: Error: characteristic value expected number and received object at Characteristic.validateUserInput (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1929:17) at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1490:24 at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:9:18 at Characteristic.<anonymous> (/homebridge/node_modules/homebridge-rachio-platform/index.js:300:13) at Characteristic.emit (events.js:315:20) at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1466:14 at new Promise (<anonymous>) at Characteristic.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1464:12) at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:143:27) at Object.next (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:124:57) at /usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:117:75 at new Promise (<anonymous>) at Object.__awaiter (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:113:16) at Characteristic.handleGetRequest (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Characteristic.js:632:24) at Bridge.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1507:27) at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:143:27) at Object.next (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:124:57) at /usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:117:75 at new Promise (<anonymous>) at Object.__awaiter (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:113:16) at Bridge.Accessory.handleCharacteristicRead (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Accessory.js:1273:24) at _loop_1 (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1449:12) See https://git.io/JtMGR for more info.

@swamplynx
Copy link

Same issue here.

@stevehoek
Copy link

It seems to be working again with the update to Homebridge 1.3.1, likely due to this change:

- Automatically correct bad characteristic values provided by plugins in more cases, this should fix the vast majority of problems users were facing after upgrading to v1.3.0.

However, there are still messages in the log telling that the Rachio plugin is generating warnings around the InUse and Active characteristics "expected a number and received object". So, it would still be nice if @kcharwood could update the code to be fully compliant.

@stevehoek
Copy link

I may have spoke too soon... in less than an hour I used up my 1700 API calls on the Rachio service, so I'm guessing these warnings are causing the plugin to make more requests than normal/necessary. Can anyone else confirm similar behavior?

@pponce
Copy link
Author

pponce commented Mar 1, 2021

I put it this in a disabled block In my config.json for now.
Hope someone with more skills than i can take on fixing this one for homebridge 1.3.0 and up.

@leehendricks
Copy link

Library could use a bit of cleanup/modernization, but this patch should resolve the immediate problem. ☝️

@stevehoek
Copy link

@leehendricks this is great... is there a branch we can use in the interim until @kcharwood can approve the PR? Any tips on how to do that in homebridge would be helpful

@leehendricks
Copy link

Yes, I forked the original:

https://github.com/leehendricks/homebridge-rachio-platform

My master branch has the above fixes.

@pponce
Copy link
Author

pponce commented Mar 16, 2021

@leehendricks i just installed your fork.
I am able to control the sprinklers but I do have an issue.
All my zones show running after a little while even though they are not. I can manually stop and start them and then stop them. But then after a bit they all show as “running”.

@leehendricks
Copy link

@pponce Good catch. Needed to wait on promises to resolve to determine if zones are running. Give it another shot.

The plugin is making a lot of unnecessary Rachio API calls. Feels like a solid refactor would cache the active zone for a given device rather than querying every time.

@stevehoek
Copy link

@leehendricks yes I often hit my limit of 1700/day from Rachio's API

Forgive me, but what is the process to configure Homebridge to use your branch? I am running HB on a Pi using the HB_Pi distro.

@leehendricks
Copy link

@stevehoek Not familiar with running homebridge on a Pi, but you may need to do a little surgery to replace the original index.js with the version from my fork.

On my mac, it's here:

/usr/local/lib/node_modules/homebridge-rachio-platform/index.js

If the original author doesn't respond to the PR, I'll figure out how to register a new homebridge plugin.

@leehendricks
Copy link

Maybe there's an easy way to tell homebridge to pull from

https://github.com/leehendricks/homebridge-rachio-platform

vs.

https://github.com/kcharwood/homebridge-rachio-platform/

?

@stevehoek
Copy link

@leehendricks thanks for the help... It worked for me to do this from my node_modules folder

npm install https://github.com/leehendricks/homebridge-rachio-platform.git#fixCharacteristicValues

@leehendricks
Copy link

@stevehoek Ah, nice! Wasn't sure how homebridge would handle the conflict with multiple plugins with the same name. Did you have to remove the original?

@stevehoek
Copy link

@leehendricks nope!

if you have any time to put even a quick and dirty cache in to reduce API calls, I think that would let us get alot more mileage out of this plugin if the original author is no longer involved...

@leehendricks
Copy link

Already working on a refactor branch. Shhh...don't tell my Day Job Boss, LOL.

@pponce
Copy link
Author

pponce commented Mar 16, 2021

testing now and will report back on the "running" issue.
FYI: to install i just run
npm install -g leehendricks/homebridge-rachio-platform

@pponce
Copy link
Author

pponce commented Mar 17, 2021

@leehendricks so i re-installed but had the same "running" issue.
was there a specific branch I needed to install to test the change?

@pponce
Copy link
Author

pponce commented Mar 17, 2021

scratch that.
trying this now.
npm install -g leehendricks/homebridge-rachio-platform#fixCharacteristicValues

@pponce
Copy link
Author

pponce commented Mar 17, 2021

works well. thanks for working on this for the community!

@leehendricks
Copy link

@stevehoek Quick and dirty cache:

npm install -g leehendricks/homebridge-rachio-platform#cacheActiveZones

@swamplynx
Copy link

Sorry, I must be a total dolt. Do I need to remove the old plugin when trying to install this branch? I'm getting the following error:

pi@RaspberryPi:~ $ sudo npm install -g leehendricks/homebridge-rachio-platform#cacheActiveZones
npm ERR! code 128
npm ERR! command failed
npm ERR! command git ls-remote ssh://[email protected]/leehendricks/homebridge-rachio-platform.git
npm ERR! /bin/bash: /root/.bashrc: Permission denied
npm ERR! Warning: Permanently added the RSA host key for IP address '140.82.112.4' to the list of known hosts.
npm ERR! [email protected]: Permission denied (publickey).
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-03-17T14_28_38_102Z-debug.log

@leehendricks
Copy link

@swamplynx You could try it fully qualified like @stevehoek did:

@leehendricks thanks for the help... It worked for me to do this from my node_modules folder

npm install https://github.com/leehendricks/homebridge-rachio-platform.git#cacheActiveZones

@stevehoek
Copy link

@stevehoek Quick and dirty cache:

npm install -g leehendricks/homebridge-rachio-platform#cacheActiveZones

@leehendricks that is great, thank you for taking time for this away from the day gig :)
I have installed it and will see what comes tomorrow. I have already hit my 1700 API call limit somehow. I'm in Michigan and I'm not even watering right now! Maybe because I keep a tab open with Homebridge all the time?

I notice you say it caches "active" zones... does that mean ones that are enabled in HomeKit, or active meaning actively watering? Because if it is the latter it probably won't help me...

@leehendricks
Copy link

"Active zones" is a bit of misnomer. Really only applies if you have more than one Rachio tied to your API key. For 99% of folks, there will be one zone active.

Previously the plugin was making API calls to Rachio every time homekit wanted to know the state of all zones. (2 calls for each zone.) Now I determine the active zone upon initialization, cache it, and update the cache whenever the active zone changes.

@leehendricks
Copy link

I bet homekit periodically asks for the state of your devices if you have a tab (or the Home app) open all the time. Let's say you have 10 enabled zones. That would be 20 API calls. Total calls for the day dependent on how often homekit asks for state.

@pponce
Copy link
Author

pponce commented Mar 17, 2021

@stevehoek how do you check on how many api calls you have used?

@stevehoek
Copy link

@pponce I received an error message in the Homebridge console stating that I had surpassed my daily API limit of 1700, but I know of no other way to check how man API calls my token was used for in any given period of time. Most web service providers would have a way to do this, but I'm doubtful Rachio offers such insight.

[17/03/2021, 13:49:23] [Rachio Controller] Failed to refresh devices. Error: 1700 daily calls rate limit exceeded. [429] GET https://api.rach.io/1/public/person/info at Request._callback (/usr/local/lib/node_modules/homebridge-rachio-platform/node_modules/rachio/lib/datastore/DataStore.js:25:21)

@stevehoek
Copy link

@leehendricks your branch for caching Active Zones seems to work well for my API call problem. Been running for 36 hours with no issue. Thanks again!

I do see these messages. I've seen them in the past, so I think they are unrelated to your changes. Do any of you guys see this kind of message from time to time?

[18/03/2021, 22:40:57] [Rachio Controller] Webhook Recieved from an unknown external id Homebridge-3ea94f2f-f005-4cc7-91e0-7be28150fe6d
[18/03/2021, 22:40:57] [Rachio Controller] Unhandled event type DEVICE_STATUS

@leehendricks
Copy link

@stevehoek Glad to hear it. Looking at my logs with debug turned on, the state of each zone (watering or not) is queried many times per hour. Cache is way to go here for something that rarely changes.

Didn't touch the webhook logic, but it could probably use another look.

@leehendricks
Copy link

Rachio retains all the webhooks you've ever registered for a given device (i.e., Rachio controller), unless you explicitly delete them. So if you've made any changes to your config (specifically, the name in your Rachio platform section), you can end up with unused, unnecessary webhooks. (I had around 10.) And these lead to those unhandled event warnings. The plugin only needs one webhook per device.

Feels like the solution would be to delete any previous webhooks, but what if you're using them for some other non-Homekit purpose? Maybe that could be a flag in the options (clearPreviousWebhooks), false by default.

@stevehoek
Copy link

@leehendricks that is good info. I'm not sure I ever renamed my Rachio platform, but for sure it has some orphaned hooks by the behavior I'm seeing. An option like that would be useful for sure.
Does it re-use a previous hook from one session to another just by the name being the same?

@leehendricks
Copy link

leehendricks commented Mar 20, 2021

@stevehoek Yes, it was attempting to reuse webhooks with the same name, so I'm not sure why the cruft was building up.

New clear_previous_webhooks option plus a major refactor:

npm install https://github.com/leehendricks/homebridge-rachio-platform.git#cleanupWebhooks

@jasonmuzzy
Copy link

@leehendricks thank you so much for picking this up and getting it working again!

@stevehoek
Copy link

@stevehoek Yes, it was attempting to reuse webhooks with the same name, so I'm not sure why the cruft was building up.

New clear_previous_webhooks option plus a major refactor:

npm install https://github.com/leehendricks/homebridge-rachio-platform.git#cleanupWebhooks

I installed it this morning and set the new flag... will monitor and report back if I notice anything irregular.

Thanks again @leehendricks !

@GeezusChrotch
Copy link

Haven't managed to install this fix on my pi homebridge installation. SSH from Mac. Any tips for the less savvy? Best would be to update via homebridge UI for us dummies. Thanks for the great plugin btw, much appreciated.

@leehendricks
Copy link

@GeezusChrotch Solid GitHub handle. 💯

Registered my forked version of the plugin with npm, so now you should be able to install/update via the normal home bridge channels (Homebridge Config UI X, etc.)

@stevehoek
Copy link

@leehendricks thanks again for the work you did on this. I've been running your fork for awhile now with no issues.
I do see this message occasionally in the log... not sure if it is something new or in the original code:
Unhandled event type DEVICE_STATUS
It does not seem to cause any issues.

@lucanaut
Copy link

lucanaut commented May 4, 2021

Thank you for all the work you put into this. I was able to configure this - however I am seeing a duplicate of the controller and zones (for a total of 16 zones and 2 controllers). I tried clearing the homebridge cached devices in case it was a remnant of the previous attempt at installing the older plug in but the zones reappear. Not sure what I may have done incorrectly :/

@lucanaut
Copy link

lucanaut commented May 4, 2021

Nevermind

Thank you for all the work you put into this. I was able to configure this - however I am seeing a duplicate of the controller and zones (for a total of 16 zones and 2 controllers). I tried clearing the homebridge cached devices in case it was a remnant of the previous attempt at installing the older plug in but the zones reappear. Not sure what I may have done incorrectly :/

Well nevermind - I realized it's not a duplicate...but it's a second unit I have on my account that I plan on installing at my parents' house. Is there a way to ignore it? Eventually I plan on turning it over to them account-wise. But I was hoping to maintain shared access...unless it messes with my Homebridge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants