bdraco / yalexs

Python API for Yale Access (formerly August) Smart Lock and Doorbell
MIT License
40 stars 19 forks source link

Add more activity types #87

Closed Olen closed 1 year ago

Olen commented 1 year ago

This adds support for manual lock/unlock and unlock using rfid-tags:

Example activities:

Manual lock

<LockOperationActivity action=manual_lock activity_type=ActivityType.LOCK_OPERATION activity_start_time=2023-09-20 22:28:17 device_name=None operated_by=Manual Lock operated_remote=False operated_keypad=False operated_tag=False operated_manual=True operated_autorelock=False operator_image_url=https://d3osa7xy9vsc0q.cloudfront.net/app/ActivityFeedIcons/manual_lock@3x.png operator_thumbnail_url=https://d3osa7xy9vsc0q.cloudfront.net/app/ActivityFeedIcons/manual_lock@3x.png>

Notice operated_manual=True

Manual unlock

<LockOperationActivity action=manual_unlock activity_type=ActivityType.LOCK_OPERATION activity_start_time=2023-09-20 22:27:55 device_name=None operated_by=Manual Unlock operated_remote=False operated_keypad=False operated_tag=False operated_manual=True operated_autorelock=False operator_image_url=https://d3osa7xy9vsc0q.cloudfront.net/app/ActivityFeedIcons/manual_unlock@3x.png operator_thumbnail_url=https://d3osa7xy9vsc0q.cloudfront.net/app/ActivityFeedIcons/manual_unlock@3x.png>

Notice operated_manual=True

Tag unlock

<LockOperationActivity action=rf_unlock activity_type=ActivityType.LOCK_OPERATION activity_start_time=2023-09-20 22:28:09 device_name=None operated_by=My Name operated_remote=False operated_keypad=False operated_tag=True operated_manual=False operated_autorelock=False operator_image_url=https://d3osa7xy9vsc0q.cloudfront.net/app/ActivityFeedIcons/rf_unlock@3x.png operator_thumbnail_url=https://d3osa7xy9vsc0q.cloudfront.net/app/ActivityFeedIcons/rf_unlock@3x.png>

Notice operated_tag=True

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.05% :tada:

Comparison is base (4ea45b2) 95.56% compared to head (299d40c) 95.62%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #87 +/- ## ========================================== + Coverage 95.56% 95.62% +0.05% ========================================== Files 29 29 Lines 3316 3357 +41 ========================================== + Hits 3169 3210 +41 Misses 147 147 ``` | [Flag](https://app.codecov.io/gh/bdraco/yalexs/pull/87/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=J.+Nick+Koston) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/bdraco/yalexs/pull/87/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=J.+Nick+Koston) | `95.62% <100.00%> (+0.05%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=J.+Nick+Koston#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files Changed](https://app.codecov.io/gh/bdraco/yalexs/pull/87?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=J.+Nick+Koston) | Coverage Δ | | |---|---|---| | [tests/test\_activity.py](https://app.codecov.io/gh/bdraco/yalexs/pull/87?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=J.+Nick+Koston#diff-dGVzdHMvdGVzdF9hY3Rpdml0eS5weQ==) | `100.00% <100.00%> (ø)` | | | [yalexs/activity.py](https://app.codecov.io/gh/bdraco/yalexs/pull/87?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=J.+Nick+Koston#diff-eWFsZXhzL2FjdGl2aXR5LnB5) | `96.68% <100.00%> (+0.11%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

bdraco commented 1 year ago

You should be able to augment https://github.com/bdraco/yalexs/blob/4ea45b2fc6af504f0a086c1e9a889eb2f30c56d3/tests/test_activity.py#L272 but I think we need a new one for tags

Olen commented 1 year ago

Fix #86

Did not add BT-methods as I don't use them, and they break yalexs-bt in HA when I test them.