python-kasa
python-kasa copied to clipboard
Support for on_off_gradually v2+
Currently only v1 of on_off_gradually is supported, and the newer versions are not backwards compatible.
This PR adds support for the newer versions of the component, and implements number
type for Feature
to expose the transition time selection.
This also adds a new supported_version
property to the main module class, we could also add a helper raise_on_unsupported(component_name, minimum_version)
in the future if we encounter more similar cases.
Related to #792
Codecov Report
Attention: Patch coverage is 67.85714%
with 18 lines
in your changes are missing coverage. Please review.
Project coverage is 87.88%. Comparing base (
bc65f96
) to head (e9b6189
).
Files | Patch % | Lines |
---|---|---|
kasa/smart/modules/lighttransitionmodule.py | 67.39% | 13 Missing and 2 partials :warning: |
kasa/feature.py | 50.00% | 2 Missing and 1 partial :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #793 +/- ##
==========================================
- Coverage 88.13% 87.88% -0.25%
==========================================
Files 62 62
Lines 4415 4465 +50
Branches 1117 1134 +17
==========================================
+ Hits 3891 3924 +33
- Misses 441 455 +14
- Partials 83 86 +3
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Looks like there's yet another way for sub-devices to report on this (seen on KS240's child dev info response):
'gradually_on_mode': 1, 'gradually_off_mode': 1,
'fade_on_time': 1, 'fade_off_time': 1,
'max_fade_on_time': 60, 'max_fade_off_time': 60,
The device also reports the component support for the main device, but errors on request.
I think we need some special handling for the "embedded" feature responses, so I think this one here is good to go and we can improve it on later.