core icon indicating copy to clipboard operation
core copied to clipboard

Verisure - Add last trip time attribute to Verisure binary sensors

Open skrynklarn opened this issue 2 years ago • 1 comments

Proposed change

Since Versiure only updates every 1 minut a binary sensors (door or window) could have been opened and closed between the reading and state will not update. Adding a attribute to the entity and get the latest change of time from Verisure. This time can then later be used to for example check have the door been open during the last 1 minute to know that something happen.

Type of change

  • [ ] Dependency upgrade
  • [ ] Bugfix (non-breaking change which fixes an issue)
  • [ ] New integration (thank you!)
  • [X] 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

It was tested with Verisure with the changes in #89318 since right now Verisure integration don't work at all.

  • This PR is related to issue: #89318

Checklist

  • [X] The code change is tested and works locally.
  • [ ] 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] I have followed the perfect PR recommendations
  • [ ] The code has been formatted using Black (black --fast homeassistant tests)
  • [ ] 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:

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

To help with the load of incoming pull requests:

skrynklarn avatar Mar 19 '23 12:03 skrynklarn

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 19 '23 12:03 home-assistant[bot]

Marking this PR draft until #89318 is merged and this PR rebased.

frenck avatar Mar 20 '23 19:03 frenck

Would be nice, if there would be a way to add state changes to the history in HA, not just realtime ones.

niro1987 avatar Mar 22 '23 13:03 niro1987

Would be nice, if there would be a way to add state changes to the history in HA, not just realtime ones.

You can see history in the mobile app for Verisure so might be possible to do it, if the library can supply that info. Maybe a question to @persandstrom. And if it is allowed to add history states in HA. But all that I think should be in another PR instead.

skrynklarn avatar Mar 22 '23 16:03 skrynklarn

Would be nice, if there would be a way to add state changes to the history in HA, not just realtime ones.

There is no use in that. The state engine only care about the current state.

frenck avatar Mar 26 '23 20:03 frenck

There is no use in that. The state engine only care about the current state.

The state engine, yes. The use case is for analytical purposes.

niro1987 avatar Mar 26 '23 20:03 niro1987

The state engine, yes. The use case is for analytical purposes.

That isn't a case Home Assistant supports, so not a concern for this PR (and thus integration).

frenck avatar Mar 26 '23 20: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 26 '23 21:03 home-assistant[bot]