jfdoube / homebridge-sinope

7 stars 5 forks source link

Unhandled rejection TypeError / new neviweb version #5

Open radavidescu opened 4 years ago

radavidescu commented 4 years ago

looks like the new neviweb update broke homebridge plugin compatibility. getting the below error in the logs now: info: Outgoing GET https://neviweb.com/api/gateway Unhandled rejection TypeError: Cannot read property 'id' of undefined at prop (/usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:3399:19) at /usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:466:28 at f1 (/usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:446:27) at /usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:296:22 at /usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:48:27 at request.then.gateway (/usr/local/lib/node_modules/homebridge-sinope/src/kit/accessory.factory.js:17:22) at tryCatcher (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/promise.js:569:18) at Promise._settlePromise0 (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/promise.js:614:10) at Promise._settlePromises (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/promise.js:693:18) at Async._drainQueue (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/async.js:133:16) at Async._drainQueues (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/async.js:143:10) at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/async.js:17:14) at runCallback (timers.js:756:18) at tryOnImmediate (timers.js:717:5)

jfdoube commented 4 years ago

I had an email they are release iOS native app. Not sure if that will include Siri shortcut, but that could solve lost of concerns.

On Wed, Aug 21, 2019 at 10:49 AM radavidescu notifications@github.com wrote:

looks like the new neviweb update broke homebridge plugin compatibility. getting the below error in the logs now: info: Outgoing GET https://neviweb.com/api/gateway Unhandled rejection TypeError: Cannot read property 'id' of undefined at prop (/usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:3399:19) at /usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:466:28 at f1 (/usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:446:27) at /usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:296:22 at /usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:48:27 at request.then.gateway (/usr/local/lib/node_modules/homebridge-sinope/src/kit/accessory.factory.js:17:22) at tryCatcher (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/promise.js:569:18) at Promise._settlePromise0 (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/promise.js:614:10) at Promise._settlePromises (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/promise.js:693:18) at Async._drainQueue (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/async.js:133:16) at Async._drainQueues (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/async.js:143:10) at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/async.js:17:14) at runCallback (timers.js:756:18) at tryOnImmediate (timers.js:717:5)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jfdoube/homebridge-sinope/issues/5?email_source=notifications&email_token=AAS2APPSWEFIMPKX2FRR2VDQFVIZLA5CNFSM4IOIBJU2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HGRFGLQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAS2APJEMFPG5XG3345ODD3QFVIZLANCNFSM4IOIBJUQ .

-- devOps engineer | Omnichannel Jean-Francois Dubé, ing. / eng.

jfdoube commented 4 years ago

I meant sinope

On Wed, Aug 21, 2019 at 10:53 AM JF Dube notifications@github.com wrote:

I had an email they are release iOS native app. Not sure if that will include Siri shortcut, but that could solve lost of concerns.

On Wed, Aug 21, 2019 at 10:49 AM radavidescu notifications@github.com wrote:

looks like the new neviweb update broke homebridge plugin compatibility. getting the below error in the logs now: info: Outgoing GET https://neviweb.com/api/gateway Unhandled rejection TypeError: Cannot read property 'id' of undefined at prop

(/usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:3399:19) at

/usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:466:28 at f1

(/usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:446:27) at

/usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:296:22 at

/usr/local/lib/node_modules/homebridge-sinope/node_modules/ramda/dist/ramda.js:48:27 at request.then.gateway

(/usr/local/lib/node_modules/homebridge-sinope/src/kit/accessory.factory.js:17:22) at tryCatcher

(/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler

(/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/promise.js:512:31) at Promise._settlePromise

(/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/promise.js:569:18) at Promise._settlePromise0

(/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/promise.js:614:10) at Promise._settlePromises

(/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/promise.js:693:18) at Async._drainQueue

(/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/async.js:133:16) at Async._drainQueues

(/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/async.js:143:10) at Immediate.Async.drainQueues [as _onImmediate]

(/usr/local/lib/node_modules/homebridge-sinope/node_modules/bluebird/js/release/async.js:17:14) at runCallback (timers.js:756:18) at tryOnImmediate (timers.js:717:5)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/jfdoube/homebridge-sinope/issues/5?email_source=notifications&email_token=AAS2APPSWEFIMPKX2FRR2VDQFVIZLA5CNFSM4IOIBJU2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HGRFGLQ , or mute the thread < https://github.com/notifications/unsubscribe-auth/AAS2APJEMFPG5XG3345ODD3QFVIZLANCNFSM4IOIBJUQ

.

-- devOps engineer | Omnichannel Jean-Francois Dubé, ing. / eng.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jfdoube/homebridge-sinope/issues/5?email_source=notifications&email_token=AAS2APIOYFE7CZJQ2OAS36DQFVJE5A5CNFSM4IOIBJU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4Z57AQ#issuecomment-523493250, or mute the thread https://github.com/notifications/unsubscribe-auth/AAS2APMFCODHFRZCACCXEHLQFVJE5ANCNFSM4IOIBJUQ .

-- devOps engineer | Omnichannel Jean-Francois Dubé, ing. / eng.

radavidescu commented 4 years ago

yes they already released the new iOS app. it seems like it's just a wrapper to their new mobile site, which is pretty similar to their old neviweb site, with some different colors and icons and a few other features, but no shortcuts support. They said they might add Alexa support in the future but still not supported in the new version either.

afbenevides commented 4 years ago

HI @jfdoube , I was using you plugin up to now, but since the update can't get it in HomeKit.... Do you know if there is something to do to make it work again with homebridge? I can offer my help if you could orient me in what need to be done. (I'm no programming pro, but motivated)

afbenevides commented 4 years ago

I found this link with SmartThings integration with HomeKit via a homebridge plugin fro SmartThings:

https://www.reddit.com/r/HomeKit/comments/92vm2m/smartthings_integration_into_homekit/

and her another one saying that sinope was working with SmartThings:

https://community.smartthings.com/t/sinope-and-latest-neviweb-no-longer-working-with-smartthings/171409/15

But still a direct sinope to homebridge would be better.

There is a link to sinope SmartThings repo:

https://github.com/sinopetechnologies/smartThings

Will have to look at that and see what was modified compared to the version after the new neviweb

palourde commented 4 years ago

For reference, I just spent 2 hours working on a pull request that should support the new Neviweb interface: https://github.com/jfdoube/homebridge-sinope/pull/6.

I'm pretty sure there's still some bugs lying around so I'll be testing this patch locally but feel free to install it and try it out!

afbenevides commented 4 years ago

Nice @palourde thanks! I will test that for sure!

radavidescu commented 4 years ago

installed this from @palourde new/neviweb branch and it seems to work great. I'll close this issue once it gets merged back into master, but so far it looks great 🥇

palourde commented 4 years ago

FYI, I've been running the patch since last night and it stopped working during the night; Apple Home indicates it received no response from the thermostats but I didn't see any error in the logs and homebridge is still running. I'll need to investigate that!

jfdoube commented 4 years ago

I'll test it as well

radavidescu commented 4 years ago

after testing it for longer i notice it works for a bit and after a while I get this error in the logs: info: Outgoing GET https://neviweb.com/api/device/38798/attribute Unhandled rejection TypeError: Cannot read property 'value' of undefined at getDevice.then.device (/Users/MyUserName/homebridge-sinope/src/kit/characteristics/temperature.characteristic.js:76:59) at tryCatcher (/Users/MyUserName/homebridge-sinope/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/Users/MyUserName/homebridge-sinope/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/Users/MyUserName/homebridge-sinope/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/Users/MyUserName/homebridge-sinope/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/Users/MyUserName/homebridge-sinope/node_modules/bluebird/js/release/promise.js:729:18) at _drainQueueStep (/Users/MyUserName/homebridge-sinope/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/Users/MyUserName/homebridge-sinope/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/Users/MyUserName/homebridge-sinope/node_modules/bluebird/js/release/async.js:102:5) at Immediate.Async.drainQueues [as _onImmediate] (/Users/MyUserName/homebridge-sinope/node_modules/bluebird/js/release/async.js:15:14) at runCallback (timers.js:756:18) at tryOnImmediate (timers.js:717:5) at processImmediate [as _immediateCallback] (timers.js:697:5)

palourde commented 4 years ago

I've spent a bit of time yesterday on improving error catching and logging and I finally have a better idea of what's going on. I'm still not catching a thrown error but at least I know that it's simply because the session becomes expired and the login request provide returns the error code USRSESSEXP as the authData, instead of the expected user details:

[11/7/2019, 9:01:44 AM] [Sinope] { error: { code: 'USRSESSEXP' } }
[11/7/2019, 9:01:44 AM] [Sinope] could not get the temperature: TypeError: Cannot read property 'value' of undefined
    at /Users/palourde/src/homebridge-sinope/src/kit/characteristics/temperature.characteristic.js:84:59
    [...]
Accessory [HomeBridge] Got Characteristic "Current Temperature" value: undefined +5ms

I think we simply need to add some logic around the usage of the session ID so if it becomes expired, we re-authenticate.

palourde commented 4 years ago

Quick update: I finally had some free time to pick up this work. It's mostly working now, the access token is renewed before it expires but I still need to fix some stuff and clean it up. Hopefully I'll be able to update the PR in the next few days!

radavidescu commented 3 years ago

I know it's been a while but winter approaches and figured it would be nice to have this working again :) any updates since January?

palourde commented 3 years ago

I kind of gave up on this bugfix; some dependencies of this project were simply impossible to upgrade, and when possible, there were too many breaking changes.

However, I decided to start from scratch using homebridge-plugin-template and redo a complete refactoring. The result now lives in https://github.com/palourde/homebridge-sinope. It's now published on npm and I've been running it successfully for the past few days. Feel free to give it a try.

@jfdoube Let me know if you'd be interested in a PR with that, or whatever suits you better.