SWS-12500-custom-component/tests
SchiZzA 0e5a8ce10c
fix(wslink): compute heat and wind chill index when the station omits them
The WU/PWS platform derives both indices from temperature, humidity and wind
(value_from_data_fn=heat_index / chill_index), but the WSLink descriptions only
read the station's own t1heat / t1chill via value_fn=to_float. Stations that do
not report those fields still got both entities, because
_auto_enable_derived_sensors creates them as soon as the raw inputs arrive, so
they stayed Unavailable forever.

Add wslink_heat_index / wslink_chill_index: prefer the station's reading, compute
it otherwise. The conversions are the subtle part. The WSLink payload is metric
and both entities are declared in Celsius, while the NWS formulas are defined for
Fahrenheit, and chill_index converts the temperature but not the wind speed even
though its formula needs mph. So the temperature goes C -> F in, the wind m/s ->
mph, and the result F -> C back out. For the reported payload (6.2 C, 40 %,
30.6 m/s) that is -1.94 C; leaving the wind in m/s would have reported 0.34 C.

The native unit stays Celsius on purpose: switching it to Fahrenheit to match the
WU platform would misread the values of stations that do send t1heat / t1chill.

Also guard on missing temperature/humidity/wind before delegating, so a payload
without those fields no longer logs an error on every push.
2026-07-26 01:20:56 +02:00
..
conftest.py Add HCHO / VOC air-quality sensors (T9 module) 2026-05-11 23:55:36 +02:00
test_battery_classification.py fix(sws12500): harden credential validation, URL fallback and push timeouts 2026-07-26 00:39:15 +02:00
test_binary_battery.py feat(device): merge all entities into one shared device with station-type model 2026-07-25 21:47:53 +02:00
test_config_flow.py fix(sws12500): harden credential validation, URL fallback and push timeouts 2026-07-26 00:39:15 +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 no-mistakes(review): Migrate Pocasi option key, fix typos and Windy status 2026-07-25 22:12:55 +02:00
test_integration_lifecycle.py chore(quality): manifest keys, ConfigEntryNotReady, remove dead sqlite code 2026-07-25 21:47:52 +02:00
test_pocasi_push.py fix(sws12500): harden credential validation, URL fallback and push timeouts 2026-07-26 00:39:15 +02:00
test_received_data.py fix(security): harden forwarders, cap native ecowitt entities, reject empty creds 2026-07-25 21:47:52 +02:00
test_received_ecowitt.py fix: address remaining review findings across forwarders and utils 2026-07-25 21:47:54 +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 test: reach 100% coverage of custom_components/sws12500 2026-07-25 21:47:51 +02:00
test_sensor_platform.py fix(correctness): reload-window guards, rate-limit races, ecowitt flush, dt_util 2026-07-25 21:47:52 +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 fix: address remaining review findings across forwarders and utils 2026-07-25 21:47:54 +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: address remaining review findings across forwarders and utils 2026-07-25 21:47:54 +02:00
test_windy_push.py fix(sws12500): harden credential validation, URL fallback and push timeouts 2026-07-26 00:39:15 +02:00
test_wslink_derived_indices.py fix(wslink): compute heat and wind chill index when the station omits them 2026-07-26 01:20:56 +02:00