fronzbot / blinkpy

A Python library for the Blink Camera system
MIT License
525 stars 111 forks source link

Pin issues #941

Closed jrhunger closed 3 weeks ago

jrhunger commented 1 month ago

Description:

Implementing fixes discussed in #917 log.

  1. populate self.user_id from login_data of response to avoid the below errors after entering PIN:
    Did not receive valid response from server. Error: 'valid'
    Unable to access https://rest-u056.immedia-semi.com/networks after token refresh.
  2. Check for homescreen is None before trying to populate owls and lotus from it, to avoid Unable to retrieve cameras from response error after entering PIN on initial auth.

I have tested that these changes work with a flow similar to that in blinkapp:

They don't currently pass the tox tests and i think it is because i'm referencing the user_id of the login_data response and that isn't in the mock test response. I'm happy to work on getting the tox tests to pass but would appreciate pointers from someone who is more familiar with the test framework.

Related issue (if applicable): fixes #917

Checklist:

fronzbot commented 1 month ago

Just commenting to let you know I saw this and will hopefully get to it soon. The failing test should be easy to fix, but I want to pull down your PR and fix it locally to verify it first.

codecov[bot] commented 3 weeks ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.7%. Comparing base (c9f49bb) to head (d60076c). Report is 22 commits behind head on dev.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #941 +/- ## ===================================== Coverage 99.7% 99.7% ===================================== Files 8 8 Lines 1489 1490 +1 ===================================== + Hits 1486 1487 +1 Misses 3 3 ``` | [Flag](https://app.codecov.io/gh/fronzbot/blinkpy/pull/941/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Kevin+Fronczak) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/fronzbot/blinkpy/pull/941/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Kevin+Fronczak) | `?` | | 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=Kevin+Fronczak#carryforward-flags-in-the-pull-request-comment) to find out more.

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

jrhunger commented 3 weeks ago

Thanks for the guidance. All tests are passing now.

fronzbot commented 3 weeks ago

Thanks! 👍

mback2k commented 3 weeks ago

I think this fix is incomplete, as now owls and lotus cameras are missing after first authentication. I think get_homescreen is called to early as discussed in https://github.com/fronzbot/blinkpy/issues/917#issuecomment-2138427343 .