cmroche / greeclimate

Python package for controlling Gree based minisplit systems
GNU General Public License v3.0
44 stars 22 forks source link

feat!: Full async networking #90

Closed cmroche closed 4 months ago

cmroche commented 4 months ago

Replaced the old send then receive approach to networking with asyncio.DatagramProtocol based classes

This removed a lot of duplicate network code as discovery was already using this approach, and allows handling on device responses when they are received as opposed to waiting on them explicitly.

BREAKING CHANGE: While interfaces are unchanged, you can no longer expect a device response is already received when push_state_update or bind have returned.

Responses will come through their appropriate handlers once they have been received.

engrbm87 commented 4 months ago

Hell @cmroche , I have been working on making this library fully type hinted. I was about to make a PR for your review then I saw these changes. Can you let me know if this PR is ready to be merged so I can rebase and update my work. Also we need to add support for new Gree Wifi modules running firmware 1.2.1. These use GCM encoding and I think we can incorporate this into the library in the encrypt/decrypt methods (also a new key is used). So my plan was to work on the same only after finishing the type hints.

cmroche commented 4 months ago

Hell @cmroche , I have been working on making this library fully type hinted. I was about to make a PR for your review then I saw these changes. Can you let me know if this PR is ready to be merged so I can rebase and update my work. Also we need to add support for new Gree Wifi modules running firmware 1.2.1. These use GCM encoding and I think we can incorporate this into the library in the encrypt/decrypt methods (also a new key is used). So my plan was to work on the same only after finishing the type hints.

Awesome. Been working slowly to add typehints, so will be greatly appreciated.

codecov[bot] commented 4 months ago

Codecov Report

Attention: Patch coverage is 92.89100% with 15 lines in your changes missing coverage. Please review.

Project coverage is 94.93%. Comparing base (20bd108) to head (70a6de9).

Files Patch % Lines
greeclimate/network.py 93.06% 7 Missing :warning:
greeclimate/device.py 89.65% 6 Missing :warning:
greeclimate/deviceinfo.py 94.11% 1 Missing :warning:
greeclimate/taskable.py 95.65% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #90 +/- ## ========================================== + Coverage 92.27% 94.93% +2.65% ========================================== Files 5 7 +2 Lines 686 651 -35 ========================================== - Hits 633 618 -15 + Misses 53 33 -20 ```

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

github-actions[bot] commented 4 months ago

:tada: This PR is included in version 2.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

cmroche commented 4 months ago

Hell @cmroche , I have been working on making this library fully type hinted. I was about to make a PR for your review then I saw these changes. Can you let me know if this PR is ready to be merged so I can rebase and update my work. Also we need to add support for new Gree Wifi modules running firmware 1.2.1. These use GCM encoding and I think we can incorporate this into the library in the encrypt/decrypt methods (also a new key is used). So my plan was to work on the same only after finishing the type hints.

I am done with the big rework. Next I will look at the GCM encryption this week but changes will be much smaller if you want to still work on the type hinting, perhaps I could get you to test it for me once it's ready as I do not have one of these devices.