Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for shark europe devices #16

Merged
merged 2 commits into from
Apr 15, 2022
Merged

Conversation

TheLastFrame
Copy link
Contributor

Hi,
here is my PR for the European device support from the legacy repository.
I tested it again with my Shark RV1000SEU and reconfirmed that the URLs still work with.

@TheLastFrame
Copy link
Contributor Author

When this pull request is merged, could someone please do the needed adjustments (choosing between US & EU to activate the europe boolean) in HA for this?

@JeffResc
Copy link
Owner

Thanks for bringing this over! The code looks good to me, but I am not in Europe and unable to test it. Any additional comments from those able to test it?

When this pull request is merged, could someone please do the needed adjustments (choosing between US & EU to activate the europe boolean) in HA for this?

Yes, this is definitely something we're interested in and can get working on once this is merged.

@funkybunch
Copy link
Collaborator

Should be able to add a region string to the auth & reauth flows in homeassistant/components/sharkiq/strings.json in the HASS repo.

I know there is a way to make it a drop down but I'm not sure off the top of my head. Should be in the docs. Worst case, I know of a couple other integrations that do that so we can always look at what they do.

Then we'll just have to build in detection of that region string to the auth flow and set the parameters accordingly. Nice work @TheLastFrame! I think this will integrate easily.

@funkybunch
Copy link
Collaborator

funkybunch commented Apr 12, 2022

@JeffResc any idea why the tests are failing here? Because the europe parameter is optional it shouldn't break the existing implementation.

Should be fully backwards compatible with no breaking changes.

@funkybunch
Copy link
Collaborator

Resolves #2 upon merge.

@TheLastFrame
Copy link
Contributor Author

TheLastFrame commented Apr 12, 2022

@JeffResc any idea why the tests are failing here? Because the europe parameter is optional it shouldn't break the existing implementation.

Should be fully backwards compatible with no breaking changes.

I never used Code Coverage, but as far as I understood the error message, it tries to check where the init function sets the class variables and doesn't know the europe flag yet, so it created an error. (see lines below marked with E at beginning - the first one should be where the europe flag is located)

_____________________ TestAylaApi.test_init__required_vals _____________________

self = <tests.test_ayla_api.TestAylaApi object at 0x7f5e77464b50>

def test_init__required_vals(self):
    api = AylaApi(
        "myusername@mysite.com", "mypassword", "app_id_123", "appsecret_123"
    )

    assert api._email == "myusername@mysite.com"
    assert api._password == "mypassword"
    assert api._access_token is None
    assert api._refresh_token is None
    assert api._auth_expiration is None
    assert api._is_authed == False
    assert api._app_id == "app_id_123"
    assert api._app_secret == "appsecret_123"
    assert api.websession is None
E       assert (None,) is None
E        +  where (None,) = <sharkiq.ayla_api.AylaApi object at 0x7f5e77[40] 
(https://github.com/JeffResc/sharkiq/runs/5993555819?check_suite_focus=true#step:5:40)d2d0>.websession

tests/test_ayla_api.py:[43](https://github.com/JeffResc/sharkiq/runs/5993555819?check_suite_focus=true#step:5:43): AssertionError

Looks like the tests need to be updated for this.

Repository owner deleted a comment from sourcery-ai bot Apr 14, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #16 (bf7b064) into main (e091c36) will increase coverage by 0.42%.
The diff coverage is 38.46%.

@@            Coverage Diff             @@
##             main      #16      +/-   ##
==========================================
+ Coverage   52.41%   52.84%   +0.42%     
==========================================
  Files           5        5              
  Lines         414      422       +8     
==========================================
+ Hits          217      223       +6     
- Misses        197      199       +2     
Flag Coverage Δ
unittests 52.84% <38.46%> (+0.42%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
sharkiq/ayla_api.py 66.19% <26.66%> (+0.01%) ⬆️
sharkiq/sharkiq.py 40.31% <28.57%> (-0.16%) ⬇️
sharkiq/const.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e091c36...bf7b064. Read the comment docs.

@JeffResc
Copy link
Owner

Looks like the tests need to be updated for this.

I was stumped for a bit on this one, but I found a stray comma that was causing the errors. Seems like its good now!

@JeffResc
Copy link
Owner

This looks all set to me, thanks @TheLastFrame!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants