Bug 2: binary_sensor.rain_expected triggers on radar noise, contradicting rain_starts_at
Description
RainWarnerRainExpectedSensor.is_on in binary_sensor.py uses:
python
return any(v > 0.0 for v in forecast.values())
This flips to True on any nonzero forecast value, including trace amounts well below the radar noise floor (e.g. 0.02 mm/h). Meanwhile, RainWarnerCoordinator._find_rain_start() in coordinator.py correctly filters out anything below PRECIP_THRESHOLD_MEASURABLE (0.1 mm/h), per its own docstring ("trace amounts below that are radar noise").
The result: binary_sensor.rain_expected can be on ("Regen erwartet" / rain expected) while sensor.rain_starts_at is simultaneously unknown, since _find_rain_start() found nothing above the noise threshold. These two entities are shown together on dashboards (e.g. the bundled rain-warner-card) and visibly contradict each other — "rain expected" with no start time, while the radar shows nothing nearby.
Fix
Use the same threshold constant already defined in const.py and used elsewhere in the codebase:
python
from .const import DOMAIN, PRECIP_THRESHOLD_MEASURABLE
python
return any(v >= PRECIP_THRESHOLD_MEASURABLE for v in forecast.values())
Found and fixed both issues locally with the help of an AI assistant (Claude) while debugging why the radar map wasn't rendering and why the dashboard showed conflicting rain state. Happy to open a PR with both changes if that's preferred over a patch here — just let me know.
Bug 2: binary_sensor.rain_expected triggers on radar noise, contradicting rain_starts_at
Description
RainWarnerRainExpectedSensor.is_on in binary_sensor.py uses:
python
return any(v > 0.0 for v in forecast.values())
This flips to True on any nonzero forecast value, including trace amounts well below the radar noise floor (e.g. 0.02 mm/h). Meanwhile, RainWarnerCoordinator._find_rain_start() in coordinator.py correctly filters out anything below PRECIP_THRESHOLD_MEASURABLE (0.1 mm/h), per its own docstring ("trace amounts below that are radar noise").
The result: binary_sensor.rain_expected can be on ("Regen erwartet" / rain expected) while sensor.rain_starts_at is simultaneously unknown, since _find_rain_start() found nothing above the noise threshold. These two entities are shown together on dashboards (e.g. the bundled rain-warner-card) and visibly contradict each other — "rain expected" with no start time, while the radar shows nothing nearby.
Fix
Use the same threshold constant already defined in const.py and used elsewhere in the codebase:
python
from .const import DOMAIN, PRECIP_THRESHOLD_MEASURABLE
python
return any(v >= PRECIP_THRESHOLD_MEASURABLE for v in forecast.values())
Found and fixed both issues locally with the help of an AI assistant (Claude) while debugging why the radar map wasn't rendering and why the dashboard showed conflicting rain state. Happy to open a PR with both changes if that's preferred over a patch here — just let me know.