ptz0n / homebridge-verisure

 Platform plugin for Homebridge allowing to manage and control Verisure devices.
https://www.npmjs.com/package/homebridge-verisure
MIT License
66 stars 15 forks source link

⭐️ Verisure deprecated REST API: Error at startup #150

Closed Stianker1 closed 1 year ago

Stianker1 commented 1 year ago

Summary of the problem; Verisure have changed the hostnames to their API.


I noticed that i have trouble with getting the verisure child bridge up and running. it loops the error message you can see down below. i tried to start it without child bridge, but that just looped homebridge in to a restart. it worked fine yesterday.

[15/03/2023, 09:55:35] [homebridge-verisure] Restarting Process...
[15/03/2023, 09:55:35] [Ebeco] Sensor config: floor
[15/03/2023, 09:55:36] [homebridge-verisure] Launched child bridge with PID 17299
[15/03/2023, 09:55:36] Registering platform 'homebridge-verisure.verisure'
[15/03/2023, 09:55:36] [homebridge-verisure] Loaded homebridge-verisure v1.16.0 child bridge successfully
[15/03/2023, 09:55:36] Loaded 0 cached accessories from cachedAccessories.0E96B5C2DDC6.

/var/lib/homebridge/node_modules/homebridge-verisure/node_modules/axios/lib/core/createError.js:16
  var error = new Error(message);
              ^
Error: Request failed with status code 404
    at createError (/var/lib/homebridge/node_modules/homebridge-verisure/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/var/lib/homebridge/node_modules/homebridge-verisure/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/var/lib/homebridge/node_modules/homebridge-verisure/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
[15/03/2023, 09:55:36] [homebridge-verisure] Child bridge process ended
[15/03/2023, 09:55:36] [homebridge-verisure] Process Ended. Code: 1, Signal: null
helangen commented 1 year ago

I have the same error since yesterday. Maybe Verisure updated something. Running HB v1.6.0, Node.js 18.15, Verisure 1.16 as a child bridge

ptz0n commented 1 year ago

Yes, Verisure seem to have updated the hostnames. Please have a look at:

helangen commented 1 year ago

Will you update the plugin, or do we have to do something on our side?

ptz0n commented 1 year ago

I’m updating the plugin, but don’t have time right now. Please submit a PR and I’ll be happy to review and merge it 👍🏼

mikaelisaxon commented 1 year ago

Same issue here. Any ETA?

ptz0n commented 1 year ago

Contributions are most welcome, either in form of code or https://www.paypal.com/paypalme/ptz0n - to help prioritise ♥️

barthoefs commented 1 year ago

Same issue here :(

Dababa26 commented 1 year ago

Pareil aussi… problème depuis ce matin!!! Une solution en vue? Merci

ZEEN0j commented 1 year ago

Contributions are most welcome, either in form of code or https://www.paypal.com/paypalme/ptz0n - to help prioritise ♥️

Sent a small contribution. Please fix this

helangen commented 1 year ago

Sent a small contribution also. Thanks for your work.

hjuhlin commented 1 year ago

Sounds like there is much work to be done to make it work 😢 But others are working on getting it fixed in HA.

782DBD8D-3DE2-43FB-8CA3-DBE4C7C55565

digidolphin commented 1 year ago

Sent a contribution. I hope you can fix it.

Dababa26 commented 1 year ago

???

ZEEN0j commented 1 year ago

Any sort of ETA?

ptz0n commented 1 year ago

Contributions recieved ❤️ I have working auth and calls to the new GraphQL endpoint.

olofbokedal commented 1 year ago

Thanks for great work with the plug-in and for keeping it updated even when there are breaking changes!

Money for falafel and beer sent.

mwouda commented 1 year ago

i'm getting the same error: For now i disabled the plugin until you have a fix. Thx for great work

3/17/2023, 10:48:01 AM] Error: Request failed with status code 404
    at createError (/homebridge/node_modules/homebridge-verisure/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/homebridge/node_modules/homebridge-verisure/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/homebridge/node_modules/homebridge-verisure/node_modules/axios/lib/adapters/http.js:269:11)
    at IncomingMessage.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)
[3/17/2023, 10:48:01 AM] Got SIGTERM, shutting down Homebridge...
[3/17/2023, 10:48:01 AM] AssertionError [ERR_ASSERTION]: Cannot generate setupURI on an accessory that isn't published yet!
    at Bridge.Accessory.setupURI (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:994:11)
    at Server.setServerStatus (/homebridge/node_modules/homebridge/src/server.ts:155:45)
    at Server.teardown (/homebridge/node_modules/homebridge/src/server.ts:199:10)
    at signalHandler (/homebridge/node_modules/homebridge/src/cli.ts:93:12)
    at process.emit (node:events:513:28)
    at process.emit (/homebridge/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)
Dababa26 commented 1 year ago

Comment évolue le travail? Une mise à jour est prévue? Bien à vous

d3linma commented 1 year ago

Thanks for your work and a great plug-in! I also donated, would very much like a fix for this bug

ptz0n commented 1 year ago

Progress update; the client module v5.0.0 is now released with support for new auth and GraphQL. Good night all!

dance

ZEEN0j commented 1 year ago

Will you be pushing an update for the plug in that needs to be installed?

ptz0n commented 1 year ago

@ZEEN0j Yes, the plugin needs to be updated once the new version is released. Hopefully with only one minor breaking change.

ZEEN0j commented 1 year ago

Awesome. Very much appreciated

helangen commented 1 year ago

Thanks for your hard work

torandreroland commented 1 year ago

Thank you for your hard work on updating node-verisure, @ptz0n! Looking forward to the subsequent update of this plugin as well.

chave commented 1 year ago

I saw my system stop reacting to my automation, check the error and go here. What an incredible community and thank you for your hard work.

ptz0n commented 1 year ago

Update, done so far:


It's truly heartwarming to see all your contributions. I created this plugin for my own use and would not have imagined the amount of installations, support with ideas, bug reports, code and donations.

You guys are awesome!

ptz0n commented 1 year ago

Are you ready? Teaser:

Screen Shot 2023-03-19 at 10 58 14

Door lock accessory is the last one. Might need some help because I don't have that device type in my installation.

ZEEN0j commented 1 year ago

I have a yale doorman lock with Verisure module. What do you need?

helangen commented 1 year ago

Me too. Let me know if we assist.

ptz0n commented 1 year ago

Ready for testing. Please help out and report any issues directly in #152. Focus on door lock accessories as I'm not able to test these in my installation. Lock, unlock, enable/disable auto lock and change volume.

Update the plugin globally

$ npm install -g homebridge-verisure@2.0.0-rc.4

… or run it from a working dir

$ git clone https://github.com/ptz0n/homebridge-verisure.git
$ cd homebridge-verisure
$ git checkout graphql
$ npm install
$ npm start

For configuration, see updated README.md. Until released, please use:

$ ./path/to/updated/homebridge-verisure/bin/verisure
Stianker1 commented 1 year ago

I tried both things and it still ends up like before. I dont know if im doing something wrong! Thank you for your hard work 😊

ZEEN0j commented 1 year ago

Haven’t been able to install it yet (probably an issue on my end).

hoobs@hoobs:~$ $ npm install -g git://github.com/ptz0n/homebridge-verisure#graphql
-bash: $: command not found
hoobs@hoobs:~$ sudo npm install -g git://github.com/ptz0n/homebridge-verisure#graphql
sudo: unable to resolve host hoobs: Name or service not known
npm ERR! code 128
npm ERR! An unknown git error occurred
npm ERR! command git --no-replace-objects ls-remote ssh://git@github.com/ptz0n/homebridge-verisure.git
npm ERR! git@github.com: 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.
bjornand1 commented 1 year ago

Million thanks for working on this!

I am now able to avoid having the plugin crash Homebridge, but none of the devices show up under accessories. And when I restart Homebridge, Verisure sends me a one-time code via SMS, which seems a bit strange.

I have followed the instructions in Readme, obtained the token using npx homebridge-verisure.

In the log, I get this (red) line:

[3/19/2023, 5:14:07 PM] [Verisure] MFA is enabled for user. Please see README.

Cm0ller commented 1 year ago

Same problem as @bjornand1 here. Thanks for the updates!

torandreroland commented 1 year ago

Thanks for providing this test version and again for your hard and excellent work!

I have a setup with a Yale Doorman V2N lock, a security system, a smart plug, three contact sensors, a siren and various smoke detectors. Everything is working except for the switch-services for auto-lock and audio level (the lock service itself is OK). Both of them are unresponsive and I think there is a problem with getting the state of one of the characteristics.

Also, I struggled a bit with the two-factor authentication. But I got the correct cookies after rerunning the cli-tool verisure in /bin. It may be good to clarify how to actual get the various cookies (since the prior version only required one token) when migrating to the graphql-api, including updating remnant mentions of token in the README.

Lastly, I also struggled with getting the updated version installed in my docker environment (somehow it would only install to the npm cache, which was easy enough to move once I understood where it got installed). It would be a lot easier to install this test-version if you pushed it as a beta version to NPM, as it would be available using the "install alternate version"-functionality in homebridge-config-ui-x

ptz0n commented 1 year ago

Indeed. You need to run:

$ ./path/to/homebridge-verisure/bin/verisure

This will eventually output a list of cookies to put in your config, instead of token like before.

ptz0n commented 1 year ago

@bjornand1 You need a property called cookies in your config. token is deprecated. Please see my comment above.

bjornand1 commented 1 year ago

Hmm, still not really getting there. In Terminal, I have navigated to the verisure folder in bin, but which command do I run there to get the cookes?

helangen commented 1 year ago

Hmm, still not really getting there. In Terminal, I have navigated to the verisure folder in bin, but which command do I run there to get the cookes?

./verisure

helangen commented 1 year ago

Just updated and got cookies. Testing now. Will send feedback

bjornand1 commented 1 year ago

Thanks, @helangen, but I just get no such file or directory

helangen commented 1 year ago

So I get this from the log. No locks or alarms showing, only sensors and detectors.

[3/19/2023, 7:08:02 PM] [Verisure] Hjemme Smoke detector (Stue): Getting current temperature value.
[3/19/2023, 7:08:02 PM] [Verisure] Hjemme Smoke detector (Stue): Getting current humidity value.
[3/19/2023, 7:08:02 PM] [Verisure] Hjemme Smoke detector (Master bedroom): Getting current temperature value.
[3/19/2023, 7:08:02 PM] [Verisure] Hjemme Smoke detector (Master bedroom): Getting current humidity value.
[3/19/2023, 7:08:02 PM] [Verisure] Hjemme SIREN (Kjøkken): Getting current temperature value.
[3/19/2023, 7:08:02 PM] [Verisure] Hjemme Smoke detector (Hall): Getting current temperature value.
[3/19/2023, 7:08:02 PM] [Verisure] Hjemme Smoke detector (Hall): Getting current humidity value.
[3/19/2023, 7:08:02 PM] [Verisure] Hjemme Smoke detector (Hall 2 etg): Getting current temperature value.
[3/19/2023, 7:08:02 PM] [Verisure] Hjemme Smoke detector (Hall 2 etg): Getting current humidity value.
[3/19/2023, 7:08:02 PM] [Verisure] Hjemme VoiceBox (Hall): Getting current temperature value.
[3/19/2023, 7:08:02 PM] [Verisure] Hjemme Smoke detector (Kjeller): Getting current temperature value.
[3/19/2023, 7:08:02 PM] [Verisure] Hjemme Smoke detector (Kjeller): Getting current humidity value.
[3/19/2023, 7:08:02 PM] [Verisure] Hjemme HOMEPAD (Hall 2 etg): Getting current temperature value.
helangen commented 1 year ago

Thanks, @helangen, but I just get no such file or directory

What's the output of the directory your in? My install is here:

/var/lib/homebridge/node_modules/homebridge-verisure/bin

So you either run ./verisure if you are in this directory or you can run

/var/lib/homebridge/node_modules/homebridge-verisure/bin/verisure

from any directory.

bjornand1 commented 1 year ago

Getting it now!

helangen commented 1 year ago

I just saw that the RC v2.0 was pushed. Trying to install that now

Update: Assuming this is the same release as above. Still no locks or buttons for alarms in Homekit.

ptz0n commented 1 year ago

FYI: 2.0.0-rc.0 don't have any updates other than README. Wanted to make it easier to install via Config UI, as mentioned above.

Hopefully have a fix for getting and setting door lock configuration later tonight.

helangen commented 1 year ago

FYI: 2.0.0-rc.0 don't have any updates other than README. Wanted to make it easier to install via Config UI, as mentioned above.

Hopefully have a fix for getting and setting door lock configuration later tonight.

And the alarm state I assume? I don't have that either, but saw that @torandreroland had it. I have two of the same V2N locks.

UPDATE:

My bad. Removed too much of the config. Got both doors and alarm state back. Will try it out.

bjornand1 commented 1 year ago

Hmm, now the command runs, but I still get a token, not a cookie...

helangen commented 1 year ago

Hmm, now the command runs, but I still get a token, not a cookie...

You should get a whole configuration like this. I removed the email and tokens/cookies.

✔ What is your one-time code? · xxxxxx

Your config is ready.

{ "platform": "verisure", "name": "Verisure", "email": "redacted", "cookies": [ "vid=redacted", "vsaccess=redacted", "vs-refresh=redacted" ]