diff --git a/homeassistant/components/sensor/recorder.py b/homeassistant/components/sensor/recorder.py index 0096879b34b..78c5719510a 100644 --- a/homeassistant/components/sensor/recorder.py +++ b/homeassistant/components/sensor/recorder.py @@ -394,7 +394,7 @@ def _suggest_report_issue(hass: HomeAssistant, entity_id: str) -> str: def warn_dip( hass: HomeAssistant, entity_id: str, state: State, previous_fstate: float ) -> None: - """Log a warning once if a sensor with state_class_total has a decreasing value. + """Log a warning once if a sensor with state class TOTAL_INCREASING has a decreasing value. The log will be suppressed until two dips have been seen to prevent warning due to rounding issues with databases storing the state as a single precision float, which @@ -415,12 +415,13 @@ def warn_dip( return _LOGGER.warning( ( - "Entity %s %shas state class total_increasing, but its state is not" + "Entity %s %shas state class %s, but its state is not" " strictly increasing. Triggered by state %s (previous state: %s) with" " last_updated set to %s. Please %s" ), entity_id, f"from integration {domain} " if domain else "", + SensorStateClass.TOTAL_INCREASING, state.state, previous_fstate, state.last_updated.isoformat(), @@ -429,7 +430,7 @@ def warn_dip( def warn_negative(hass: HomeAssistant, entity_id: str, state: State) -> None: - """Log a warning once if a sensor with state_class_total has a negative value.""" + """Log a warning once if a sensor with state class TOTAL_INCREASING has a negative value.""" if WARN_NEGATIVE not in hass.data: hass.data[WARN_NEGATIVE] = set() if entity_id not in hass.data[WARN_NEGATIVE]: @@ -438,11 +439,12 @@ def warn_negative(hass: HomeAssistant, entity_id: str, state: State) -> None: domain = entity_info["domain"] if entity_info else None _LOGGER.warning( ( - "Entity %s %shas state class total_increasing, but its state is " + "Entity %s %shas state class %s, but its state is " "negative. Triggered by state %s with last_updated set to %s. Please %s" ), entity_id, f"from integration {domain} " if domain else "", + SensorStateClass.TOTAL_INCREASING, state.state, state.last_updated.isoformat(), _suggest_report_issue(hass, entity_id),