Summary
This release streamlines the transition to the v2 API and improves the overall usability of the library. Key updates include:
- Preparations for easier implementation of the v2-only functionality.
- Previous releases required separate handling for v1 and v2 APIs (e.g., v1.data.total_energy_kwh vs v2.measurement.energy_kwh). This release fully aligns with the v2 API, with all models moved to the v2 schema. When v1 is used, data points are automatically remapped to the v2 format for consistency.
Example
import HomeWizardEnergy
api: HomeWizardEnergy
if HomeWizardEnergy.has_v2_api("ip_address"):
api = HomeWizardEnergyV2("ip_address", token="<auth_token>")
else:
api = HomeWizardEnergyV1("ip_address")
combined = await api.combined()
print(combined) # Same for both versions, content depends on feature set of the device
What's Changed
- Add helper to test if device has v2 API by @DCSBL in #435
- Add helper to get hostname validation string from model and serial id by @DCSBL in #436
- Use pylint ^3.3.3 by @DCSBL in #439
- Move pylint requirement to dev-dependencies by @DCSBL in #440
- Add preliminary support for HWE-BAT by @DCSBL in #438
- Move Device model to root and re-arrange Product by @DCSBL in #441
- Merge v1 and v2 models, use mashumaro for JSON parsing by @DCSBL in #447
- Move LOGGER to const.py by @DCSBL in #448
- Remove Product model and simplify model name conversion by @DCSBL in #449
- Streamline request method in v1 to match v2 by @DCSBL in #450
- Use StateUpdate and SystemUpdate models to set state and system in v1 by @DCSBL in #451
- Add HomeWizardEnergy base class which is implemented in v1 and v2 by @DCSBL in #452
- Reduce backoff retries to 3 by @DCSBL in #454
- Add CombinedModels model and 'fetch-all' method by @DCSBL in #453
- Remove API version check, as v1 API will never update by @DCSBL in #455
- Check before executing unsupported action by @DCSBL in #456
- Add HomeWizardEnergy to root init by @DCSBL in #457
- Rename support_identify to supports_identify, (notice the 's') by @DCSBL in #458
- Measurement in CombinedModels is not Optional, as all devices have support for Measurement API by @DCSBL in #459
- Use native arguments for set-functions and route led_brightness to state for v1 API by @DCSBL in #460
- Remove unused release-drafter by @DCSBL in #461
- Move responsibility of fixing legacy model values to Model itself by @DCSBL in #462
- Bring back full test coverage in
models.py
by @DCSBL in #463 - Move Exceptions fixtures to correct folder by @DCSBL in #464
- Remove handing of non-200 in v1 state/system calls, already handled by _request by @DCSBL in #465
- Cache 'device' model in device() method by @DCSBL in #466
- Use 'native' caching of device in combined method by @DCSBL in #467
- Add tests for cached state identify unsupported check by @DCSBL in #468
- Test for clienterror exception in v2 by @DCSBL in #470
- Remove check of HTTP_NO_CONTENT as there are no 'No Content' replies in v1 by @DCSBL in #469
- Loosen orjson dependency requirement by @DCSBL in #471
- Adjust has_v2_api so test does not trigger 'Was never awaited' error by @DCSBL in #472
- Fix ExternalDeviceType not deserialised correctly by @DCSBL in #473
- Do not remap same keys in v1 to v2 remap by @DCSBL in #474
- Use custom ssl config for injected clientsession by @DCSBL in #475
- Reapply hotfix 'invalid tariff' by @DCSBL in #476
- Update README by @DCSBL in #477
- Print native string value instead Enum when using ExternalDevice.DeviceType value by @DCSBL in #478
- Fix: use total_power_export_t1_kwh instead import as replacement for total_power_export_kwh by @DCSBL in #479
Dependencies
- Bump aiohttp from 3.11.2 to 3.11.8 by @dependabot in #431
- Bump ruff from 0.7.1 to 0.8.1 by @dependabot in #433
- Bump pre-commit-hooks from 4.6.0 to 5.0.0 by @dependabot in #418
- Bump codecov/codecov-action from 4.6.0 to 5.0.7 by @dependabot in #434
- Bump pre-commit from 3.8.0 to 4.0.1 by @dependabot in #432
- Bump pytest-cov from 5.0.0 to 6.0.0 by @dependabot in #420
- Bump codecov/codecov-action from 5.0.7 to 5.1.2 by @dependabot in #442
- Bump ruff from 0.8.1 to 0.8.4 by @dependabot in #443
- Bump pytest-asyncio from 0.24.0 to 0.25.0 by @dependabot in #444
- Bump poetry from 1.8.4 to 1.8.5 in /.github/workflows by @dependabot in #446
- Bump async-timeout from 4.0.3 to 5.0.1 by @dependabot in #445
Full Changelog: v7.0.1...v8.0.0