Commit Graph

19 Commits (72c383ffbab352e845da165777646ce08ec91353)

Author SHA1 Message Date
SchiZzA 72c383ffba
fix(health): reflect Ecowitt as a protocol in the diagnostics summary
The health model only knew "wu"/"wslink", so with an Ecowitt setup the
active_protocol / integration_status fell back to "PWS/WU" even while Ecowitt data
was flowing.

- Replace _protocol_name() with _configured_protocol() which returns
  wu / wslink / ecowitt (legacy endpoint takes precedence; ecowitt-only -> ecowitt).
- _refresh_summary: treat "ecowitt" as a real accepted protocol (active_protocol and
  online_<proto> now track it); the WU-vs-WSLink mismatch -> degraded check is scoped
  to the legacy pair so coexisting Ecowitt is never falsely degraded.
- Add the "ecowitt" / "online_ecowitt" entity states to strings/en/cs.

310 passing, 100% coverage; ruff + basedpyright clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 21:47:05 +02:00
SchiZzA 1fe4d6da45
fix(security)+i18n: stop health-attribute leak, mask secrets in logs, sync translations
Security (from the deep audit):
- S1: health "integration_health" sensor no longer dumps the full snapshot in
  extra_state_attributes (readable by any HA user). public_health_snapshot()
  strips internal network details (source IP, internal URLs, raw add-on status);
  full data stays on the authenticated endpoint and admin-only diagnostics.
- S2: anonymize() now masks the Ecowitt passkey/PASSKEY.
- S3: Windy station id masked before logging the dataset.
- S4: diagnostics redacts internal network fields (source IP, URLs, raw_status).

i18n (Q1/Q2):
- Sync strings.json + en.json with the actual flow: add wslink_port_setup step,
  the ecowitt/pocasi/wslink_port_setup menu entries, the pocasi_* and
  windy_key_required error keys, the stale_sensors_detected issue; fix wrong data
  keys (WSLINK->wslink + legacy_enabled, POCASI_CZ_SEND_INTERVAL->POCASI_SEND_INTERVAL,
  pocasi_enabled_checkbox->pocasi_enabled_chcekbox); translate the English ecowitt
  options step (was Czech); de-duplicate the legacy-battery issue description.
- Q2: rename wbgt_index -> wbgt_temp to match the entity translation_key.
- cs.json: add windy_key_required and fix the pocasi data/data_description keys.

Tests: 300 passing, 100% coverage maintained; basedpyright clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-21 18:08:34 +02:00
SchiZzA 0142c5412b
fix: coordinator reuse, route dispatcher, binary sensor translations & test suite alignment
- Reuse existing `WeatherDataUpdateCoordinator` instance across reloads instead of
  creating a new one; routes keep pointing to the same coordinator, so entities
  stay subscribed and updates never silently drop
- `update_listener` now skips full reload when only `SENSORS_TO_LOAD` changes
  (auto-discovery); avoids the "frozen UI" window caused by temporary platform unload
- Replaced direct `route._handler` mutation with a proper `Routes` dispatcher;
  all aiohttp routes are registered once and an internal dispatcher decides which
  handler is active — safe to switch at runtime without touching the router
- Fixed `self.config_entry` / `self.config` inconsistency in coordinator

- `BatteryBinarySensor` now carries correct `device_info` (same identifiers as
  `WeatherSensor`) → single device card in UI instead of two
- Translations for binary sensors must live under `entity.binary_sensor.*`,
  not `entity.sensor.*`

- Fixed all tests broken by new `register_path(hass, coordinator, coordinator_h, entry)` signature
- Updated `_RouterStub` to accept `name=` kwargs and return objects with `.method`
- Added `async post()` to `_RequestStub` stubs
- Aligned `Routes` tests with new `method:path` dispatch key format and `show_enabled()` output
- Replaced `WindyApiKeyError` with `WindyPasswordMissing` to match actual exceptions
- Updated `_FakeResponse` to use HTTP status codes instead of response text strings
- Patched `persistent_notification.create` in Windy push tests to avoid `SimpleNamespace` errors
2026-06-01 17:01:40 +02:00
SchiZzA 211965dd52
Ecowitt support
Update setiing (config_flow and translations) for Ecowitt settings.
Also updated utils.py to accept None for value.
2026-05-27 21:27:13 +02:00
SchiZzA 1fec8313d4
Refactor SWS12500 integration for push-based updates
- Add detailed architecture overview in __init__.py
- Introduce shared runtime keys in data.py to avoid key conflicts
- Implement dual route dispatcher for webhook endpoint selection
- Enhance sensor platform for dynamic sensor addition without reloads
- Rename battery level "unknown" to "drained" with updated icons
- Improve utils.py with centralized helpers for remapping and discovery
- Update translations and strings for consistency
2026-01-27 09:21:27 +01:00
SchiZzA 0679f1e559
Fix typos, fix await in windy_func 2025-11-16 19:18:29 +01:00
SchiZzA 92eadbb4e2
Typo update 2025-11-16 14:09:16 +01:00
SchiZzA 040f70c027
Adds translation keys.
Updated cs.json, en.json, strings,json
2025-11-16 13:38:11 +01:00
schizza af19358ac7 Adds battery state translations
Adds translations for the battery state of the outside sensor to both the English and Czech language files.

This change provides more descriptive and user-friendly information about the battery status.
2025-08-28 10:41:44 +02:00
Ferron Nijland a07af5a4fd Add outside battery sensor and related translations 2025-08-28 10:41:44 +02:00
schizza 8e97fc7404 Different values displayed on station/cloud and HA - Total rainfall
Fixes #62

Fixes rainfall unit inconsistency

Updates daily rain sensor to use consistent measurement units and corrects device class and suggested unit.

Fixes #62

Adds database path constant and data migration function

Defines DATABASE_PATH constant for database file location
Introduces migrate_data function to update unit of measurement in long statistics.

Adds sensor migration feature

Introduces a migration step for sensor statistics
Updates schema and translations to support migration
Fixes data migration from mm/d to mm
2025-03-15 15:10:49 +01:00
schizza a3dc4f9986 Improves configuration defaults and UI descriptions
Sets default values for optional fields in configuration flow
Enhances descriptions and titles in UI for better clarity
Updates translations
2025-02-18 19:40:46 +01:00
schizza 808fad1d97 webhook refactor,
Refactoring webhook switching.
Added routing management to automaticly update coordinator to avoid restarting HA on configuration change or on new sensor discovery.
2025-02-15 18:16:54 +01:00
schizza d580c21055 Just cleanup.
Cleanup to satisfy HASSfest.
2024-04-19 15:46:13 +02:00
schizza ac7284770a New sensor fo Azimut now supported.
- A new constant `WIND_AZIMUT` is added to allow creating a wind direction sensor that returns a text value from `UnitOfDir` instead of just a numeric degree value.

- The wind direction sensor entity now optionally creates both a numeric wind direction sensor using `WIND_DIR` and a text-based azimuth sensor using `WIND_AZIMUT`. If the numeric one is enabled, the text one will also be added.

So in summary, these changes improve the usability of wind data by adding a more human-readable text version alongside the existing numeric version.
2024-04-18 20:54:57 +02:00
schizza 70bfd56268 Ability to add newly discovered sensors.
* Add discovered sensors to loading queue.
* Notify users that we have new sensors and we need to restart Home Assistant
2024-04-17 13:12:47 +02:00
schizza 5eba5a073d Translation support
Ability to translate component.
2024-03-11 20:19:04 +01:00
schizza 19f7baf7d7 Initial config and ConfigFlow update.
Minor changes to configuration flow.
2024-03-09 15:19:21 +01:00
schizza b0c7c72645 First code commit.
First release of code.
2024-03-08 20:18:04 +01:00