| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Light strips expose a `segment` component that sets how much of the strip is physically installed, shown as "Light Strip Length" in the Tapo app. It was advertised in component_nego but had no module, so the setting was unavailable. The device reports the value via get_device_segment and accepts set_device_segment. A run is addressed in 10cm segments up to 5m, giving a maximum of 50. That maximum is not discoverable: it is absent from sys_info, get_device_info and the component descriptor, and larger values are only rejected with PARAMS_ERROR, so it is defined as a constant. Products shipping multiple spools drive every run from this single value, so the limit is per-run rather than per-model. All six existing strip fixtures (L920-5 and L930-5, both regions) report 50, and a physical L920 was verified at 47 segments against a 4.7m run.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## master #1744 +/- ##
==========================================
+ Coverage 93.29% 93.30% +0.01%
==========================================
Files 157 158 +1
Lines 9932 9951 +19
Branches 1022 1023 +1
==========================================
+ Hits 9266 9285 +19
Misses 471 471
Partials 195 195 ☔ View full report in Codecov by Harness.
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
A light strip can be cut shorter than it ships, and the device has to be told how much of it is actually there so effects and colours span the right distance. The Tapo app exposes this as "Light Strip Length". python-kasa has no way to read or change it, so the setting is missing from Home Assistant. This PR adds it as a number.
Under the hood, strips advertise a segment component for this, but there is no module for it, even though six fixtures already in the repo carry the data.
Notes
Test plan
Beyond the fixtures, the module was exercised against a physical L920: the feature registers with the expected range and category, set_segments() round-trips, and out-of-range values are rejected before reaching the device.
One caveat if you want to reproduce that on hardware. Running the suite with --ip reconnects for every parametrisation, so a test parametrised across six fixtures fires 42 handshakes in under a minute. These strips allow 15 failed logins before a timed lockout, after which even discover returns ACCOUNT_ERROR(-2101) until it expires. Worth knowing before pointing --ip at a light strip.
Relation to #1702
No functional overlap. #1702 adds segment_effect, the per-segment custom effects applied with apply_segment_effect_rule. This is segment, the strip length read and written with get_device_segment / set_device_segment. Different components, different methods.
They do collide trivially: both insert an import after from .reportmode import ReportMode in kasa/smart/modules/__init__.py, where segment sorts before segmenteffect. I will rebase behind whichever lands first.
The two module names end up adjacent, Segment next to SegmentEffect. Both mirror their component names, which follows the existing convention, but say the word if you would rather this were something like StripLength.