core icon indicating copy to clipboard operation
core copied to clipboard

Verisure

Open niro1987 opened this issue 1 year ago • 10 comments

Breaking change

The Verisure integration needs to be re-authenticated after the update because the integration is build on a new API. Mouse detectors have been removed due to a lack of available testers with these types of devices.

Proposed change

The python-verisure pakcage has been updated to work with the new GraphQL API instead of the old REST API. New Verisure devices like the Danalock Smartlock and cameras with motion detection are only supported in the new API.

Type of change

  • [x] Dependency upgrade
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [ ] New integration (thank you!)
  • [ ] New feature (which adds functionality to an existing integration)
  • [ ] Deprecation (breaking change to happen in the future)
  • [ ] Breaking change (fix/feature causing existing functionality to break)
  • [ ] Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue:
    • fixes #79411
    • fixes #76620
    • fixes #76306
    • fixes #89727
  • Link to documentation pull request: https://github.com/home-assistant/home-assistant.io/pull/26486
  • Link to the compare between versions: https://github.com/persandstrom/python-verisure/compare/version-1...version-2

Checklist

  • [x] The code change is tested and works locally.
  • [x] Local tests pass. Your PR cannot be merged unless tests pass
  • [x] There is no commented out code in this PR.
  • [x] I have followed the development checklist
  • [x] The code has been formatted using Black (black --fast homeassistant tests)
  • [x] Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • [x] The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • [x] New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • [x] For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • [x] Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

niro1987 avatar Mar 07 '23 20:03 niro1987

Hey there @frenck, mind taking a look at this pull request as it has been labeled with an integration (verisure) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of verisure can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign verisure Removes the current integration label and assignees on the pull request, add the integration domain after the command.

home-assistant[bot] avatar Mar 07 '23 20:03 home-assistant[bot]

@niro1987 Awesome work! FWIW, I've just made the changes from your PR to my docker install and the integration works fine again (e.g. reading sensor status from my versure installation, I have not done anything more fancy like locking/unlocking/arming/etc via HA).

@frenck Please note that the Verisure integration stopped working as of this morning due to a Verisure server side change. This PR seems to fix this. Could you please check, approve and add this PR to the next release? Thanks!!!

daxy01 avatar Mar 15 '23 14:03 daxy01

Also tested on my test docker instance. Sensors are there, I can arm and disarm alarm.

Thanks @niro1987

thomasgermain avatar Mar 15 '23 14:03 thomasgermain

@niro1987 Thanks for the fix. Have you considered implementing the guardian sos function btw?

strutings avatar Mar 15 '23 16:03 strutings

I did, but that required a device registration that I have not figured out.

niro1987 avatar Mar 15 '23 16:03 niro1987

@daxy01 Please don't ping for reviews. Thanks 👍

frenck avatar Mar 15 '23 16:03 frenck

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks :+1:

Learn more about our pull request process.

home-assistant[bot] avatar Mar 15 '23 22:03 home-assistant[bot]

I just tested it and login in and status for the lock works fine but unlocking/locking doesn't work. It complains about the lock's code format. I will uninstall it until a new test build is available.

erikmex-root avatar Mar 15 '23 22:03 erikmex-root

@niro1987 Tested your changes with the following result:

  • Arming/Desarming through automation works
  • Sensors seem to be working and showing correct values
  • Smartplugs do NOT respond to switch.turn_on/off. They do however show up correctly in the gui and they also seem to reflect correct state if the physical button on the plug is used

tobias-berg avatar Mar 19 '23 10:03 tobias-berg

I just tested it and login in and status for the lock works fine but unlocking/locking doesn't work. It complains about the lock's code format. I will uninstall it until a new test build is available.

@erikmex-root That is because you have not set a default pin. Go to the integrations page and configure your Verisure entry, set a default PIN and retry. I do agree that the widget is misleading, as entering a pin does nothing for the two button above it, that is outside the scope of this PR.

image

niro1987 avatar Mar 20 '23 15:03 niro1987

@niro1987 This PR works for me as well. Got all my existing entities (alarm panel, locks, binary sensors (doors and ethernet status), humidity, temperature, camera). Great work so far!

I was not asked to re-authenticate.

oyvindwe avatar Mar 21 '23 21:03 oyvindwe

@niro1987 You should not have accepted those suggestions, instead, you should have ran the tools for this in a development environment. Have you checked this time?

frenck avatar Mar 23 '23 20:03 frenck

No, don't have time now. Only have my mobile device available.

niro1987 avatar Mar 23 '23 20:03 niro1987

Please, test PRs before marking them ready for review. We have also documented that, and it is asked for in the PR template.

frenck avatar Mar 23 '23 21:03 frenck

tests passed

niro1987 avatar Mar 24 '23 07:03 niro1987

@frenck CI is not failing on Verisure

niro1987 avatar Mar 24 '23 08:03 niro1987