SWS-12500-custom-component/tests
SchiZzA 624de521c4
feat(wslink): implement every sensor the WSLink API v0.6 defines
Coverage went from 54 of 107 upload parameters to all 107, adding roughly 34
entities. New families: Type5 lightning, Type6 water leak (CH1-7), Type8
particulate matter, Type10 CO2 and Type11 CO, plus the parameters missing from
existing families - absolute pressure, feels-like temperature, the 10-minute
average wind speed, and the per-channel probe type.

Device classes follow Home Assistant's own list (PM25, PM10, AQI, CO2, CO,
DISTANCE, ATMOSPHERIC_PRESSURE, WIND_SPEED, and binary MOISTURE for leaks), so
the readings work with statistics and unit conversion without template helpers.

Batteries were the trap. The API annotates two incompatible conventions -
"(Normal=1, Low battery=0)" and "(0~5) remark: 5 is full" - and mixing them up is
silent, because a level battery read as a flag reports "not low" for every level
above empty. Eight new binary batteries (t5lsbat, t6c1-7bat) and three new level
batteries (t8bat, t10bat, t11bat) are classified from the document, and
tests/test_wslink_api_coverage.py pins each one to the wording it came from.

Water leak and battery use opposite conventions in the same family (leak 1 means
wet, battery 0 means low), so `on_value` moved into the description and one
entity class now serves both instead of two that differ by a comparison.

`t1cn` was in the API but wired to nothing, so a disconnected outdoor probe kept
publishing its last readings. Gating it required fixing the gate first: an absent
connection flag was treated as "disconnected", which would have blanked
temperature, wind and rain outright on any firmware that omits `t1cn`. Absence is
now treated as no information, and only an explicit non-1 drops the readings.

The probe type (`t234cXtp`) decides whether a channel's humidity reading is air
humidity or soil moisture, which are different device classes. It is resolved
once, when the entity is created, because Home Assistant records the device class
in the entity registry; swapping the physical probe means reinstalling.

Two parameters are handled with a documented caveat: `inbat` is the only battery
whose scale the API does not state and stays a 0/1 flag, and `t5lst` has no unit
(the vendor example uses 9999) so it is read as minutes with 9999 meaning
"nothing recorded".

Also replaces the now-stale TODO block in const.py - it listed exactly these
sensors as unimplemented - and documents the complete coverage in the README.
2026-07-26 15:20:07 +02:00
..
conftest.py Add HCHO / VOC air-quality sensors (T9 module) 2026-05-11 23:55:36 +02:00
test_battery_classification.py feat(wslink): implement every sensor the WSLink API v0.6 defines 2026-07-26 15:20:07 +02:00
test_binary_battery.py feat(wslink): implement every sensor the WSLink API v0.6 defines 2026-07-26 15:20:07 +02:00
test_config_flow.py fix(review): Disable stale routes and validate credentials 2026-07-26 12:03:36 +02:00
test_conflicts.py Add tests for legacy/Ecowitt protocol conflict 2026-07-25 21:47:54 +02:00
test_const.py no-mistakes(review): Migrate Pocasi option key, fix typos and Windy status 2026-07-25 22:12:55 +02:00
test_data.py fix: block enabling legacy and Ecowitt protocols together 2026-07-25 21:47:53 +02:00
test_diagnostics.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_ecowitt_bridge.py Add tests for legacy/Ecowitt protocol conflict 2026-07-25 21:47:54 +02:00
test_health.py fix: Prevent addon probe from failing config entry 2026-07-25 21:47:53 +02:00
test_init.py fix(document): Refresh runtime route docs 2026-07-26 12:03:37 +02:00
test_integration_lifecycle.py fix(review): Disable stale routes and validate credentials 2026-07-26 12:03:36 +02:00
test_pocasi_ecowitt.py fix(review): stop counting timeouts, notify on disable, drop WSLink indoor 2026-07-26 13:25:39 +02:00
test_pocasi_push.py fix(review): stop counting timeouts, notify on disable, drop WSLink indoor 2026-07-26 13:25:39 +02:00
test_received_data.py feat(sws12500): forward Ecowitt payloads to Windy and Pocasi Meteo 2026-07-26 11:50:11 +02:00
test_received_ecowitt.py feat(sws12500): forward Ecowitt payloads to Windy and Pocasi Meteo 2026-07-26 11:50:11 +02:00
test_routes.py Make routes method-aware and update related tests 2026-07-25 21:47:47 +02:00
test_routes_more.py feat(wslink): implement every sensor the WSLink API v0.6 defines 2026-07-26 15:20:07 +02:00
test_sensor_platform.py feat(wslink): implement every sensor the WSLink API v0.6 defines 2026-07-26 15:20:07 +02:00
test_sensors_common.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_sensors_weather.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_sensors_wslink.py fix(correctness): reload-window guards, rate-limit races, ecowitt flush, dt_util 2026-07-25 21:47:52 +02:00
test_staleness_legacy.py test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_strings.py no-mistakes(document): Update README for Ecowitt, Windy and diagnostics changes 2026-07-25 22:37:28 +02:00
test_t9_air_quality.py feat(wslink): implement every sensor the WSLink API v0.6 defines 2026-07-26 15:20:07 +02:00
test_translations_cs.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_translations_en.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_utils.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_utils_conv.py fix(security)+i18n: stop health-attribute leak, mask secrets in logs, sync translations 2026-07-25 21:47:52 +02:00
test_utils_more.py fix: address remaining review findings across forwarders and utils 2026-07-25 21:47:54 +02:00
test_weather_sensor_entity.py feat(device): merge all entities into one shared device with station-type model 2026-07-25 21:47:53 +02:00
test_windy_func.py Add health diagnostic sensor and extensive tests for sws12500 2026-07-25 21:45:08 +02:00
test_windy_more.py fix(review): clamp heat index, unify Windy uv, bound forward timeouts 2026-07-26 13:13:05 +02:00
test_windy_push.py fix(review): stop counting timeouts, notify on disable, drop WSLink indoor 2026-07-26 13:25:39 +02:00
test_wslink_api_coverage.py feat(wslink): implement every sensor the WSLink API v0.6 defines 2026-07-26 15:20:07 +02:00
test_wslink_derived_indices.py fix(review): clamp heat index, unify Windy uv, bound forward timeouts 2026-07-26 13:13:05 +02:00