jabesq-org / pyatmo

Simple API to access Netatmo weather station data from any python script (for Netatmo information, see www.netatmo.com)
MIT License
27 stars 29 forks source link

Energy support, NLE support #503

Closed tmenguy closed 3 months ago

tmenguy commented 3 months ago

Use of the getmeasure API to compute energy (with power adjustment), support for multiple homes selection

Summary by Sourcery

This pull request introduces energy computation using the getmeasure API with power adjustment and supports multiple home selections. It includes significant refactoring of energy-related classes and mixins, enhances historical data processing, and improves error handling. New tests have been added to ensure the robustness of these features.

sourcery-ai[bot] commented 3 months ago

Reviewer's Guide by Sourcery

This pull request introduces support for energy computation using the getmeasure API with power adjustment and adds support for multiple home selections. The changes include significant modifications to the energy and history data handling, as well as updates to the module classes to support these new features.

File-Level Changes

Files Changes
src/pyatmo/modules/module.py
src/pyatmo/modules/base_class.py
src/pyatmo/modules/legrand.py
Refactored module classes to support new energy and history data handling, including the introduction of new mixins and methods.
tests/test_energy.py
tests/test_home.py
tests/conftest.py
tests/common.py
Updated and added tests to align with the new energy data structure and multi-home support.
src/pyatmo/account.py
src/pyatmo/home.py
Enhanced account and home classes to support multiple homes and improved error handling.
src/pyatmo/auth.py
src/pyatmo/exceptions.py
Added new exception classes and implemented error handling for API throttling and home reachability.
fixtures/getmeasure_sum_energy_buy_from_grid,sum_energy_buy_from_grid$0,sum_energy_buy_from_grid$1,sum_energy_buy_from_grid$2_12_34_56_00_00_a1_4c_da.json
fixtures/getmeasure_sum_energy_buy_from_grid,sum_energy_buy_from_grid$0,sum_energy_buy_from_grid$1,sum_energy_buy_from_grid$2_98_76_54_32_10_00_00_69.json
fixtures/home_multi_status_error_disconnected.json
Added new fixtures for testing energy measure types and multi-home support.

Tips - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.
tmenguy commented 3 months ago

great! we made it :) thx for the reviews and time on it