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

Upgrade to aiocoap 0.4b3 #274

Merged
merged 6 commits into from
Sep 3, 2020
Merged

Upgrade to aiocoap 0.4b3 #274

merged 6 commits into from
Sep 3, 2020

Conversation

balloob
Copy link
Collaborator

@balloob balloob commented Sep 2, 2020

This upgrades pytradfri to use aiocoap 0.4b3 and migrates credential management to the new approach.

I don't have a Tradfri gateway here so I only got as far as that aiocoap was able to find the credentials. Was not able to verify.

Fixes #185

Can be tested using:

python3 examples/example_async.py <IP> -K <KEY ON BOTTOM OF GATEWAY>

This is a breaking change. Async API Factory now needs to be set using await APIFActory.init(…)

pytradfri/command.py Show resolved Hide resolved
pytradfri/api/aiocoap_api.py Outdated Show resolved Hide resolved
examples/example_socket_async.py Outdated Show resolved Hide resolved
examples/example_pair.py Outdated Show resolved Hide resolved
examples/example_cover_async.py Outdated Show resolved Hide resolved
examples/example_color.py Outdated Show resolved Hide resolved
examples/example_async.py Outdated Show resolved Hide resolved
@balloob
Copy link
Collaborator Author

balloob commented Sep 2, 2020

The other flake8 errors will be squashed once we migrate this repo to black once this is merged.

@ludeeus
Copy link

ludeeus commented Sep 2, 2020

Both initial and secondary (without key) seems to work as expected 👍 with my limited test (connect)

container# python examples/example_async.py 192.168.2.100 -K XXXXXXXXXXXXX
[]
No lights found!
[<65542 - TRADFRI blind (FYRTUR block-out roller blind)>]
Waiting for observation to end (2 mins)
Try altering any light in the app, and watch the events!
container# python examples/example_async.py 192.168.2.100
[]
No lights found!
[<65542 - TRADFRI blind (FYRTUR block-out roller blind)>]
Waiting for observation to end (2 mins)
Try altering any light in the app, and watch the events!

I don't actually have something paired to it for further testing (the blinds are elsewhere now)

async def _get_protocol(self):
"""Get the protocol for the request."""
if self._protocol is None:
self._protocol = asyncio.Task(Context.create_client_context(
loop=self._loop))
self._protocol = asyncio.create_task(Context.create_client_context())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line too long (81 > 79 characters)

@balloob balloob merged commit 304a9ac into master Sep 3, 2020
@balloob balloob deleted the upgrade-aiocoap branch September 3, 2020 06:49
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.

Support for multiple gateways wanted | user in issue willing to donate for a dev to buy a second gateway
4 participants