mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Add link into statistics unit mismatch warning (#62217)
This commit is contained in:
parent
857c9e3836
commit
50188e06ac
@ -140,6 +140,8 @@ WARN_NEGATIVE = "sensor_warn_total_increasing_negative"
|
|||||||
# Keep track of entities for which a warning about unsupported unit has been logged
|
# Keep track of entities for which a warning about unsupported unit has been logged
|
||||||
WARN_UNSUPPORTED_UNIT = "sensor_warn_unsupported_unit"
|
WARN_UNSUPPORTED_UNIT = "sensor_warn_unsupported_unit"
|
||||||
WARN_UNSTABLE_UNIT = "sensor_warn_unstable_unit"
|
WARN_UNSTABLE_UNIT = "sensor_warn_unstable_unit"
|
||||||
|
# Link to dev statistics where issues around LTS can be fixed
|
||||||
|
LINK_DEV_STATISTICS = "https://my.home-assistant.io/redirect/developer_statistics"
|
||||||
|
|
||||||
|
|
||||||
def _get_sensor_states(hass: HomeAssistant) -> list[State]:
|
def _get_sensor_states(hass: HomeAssistant) -> list[State]:
|
||||||
@ -244,10 +246,12 @@ def _normalize_states(
|
|||||||
)
|
)
|
||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"The unit of %s is changing, got multiple %s, generation of long term "
|
"The unit of %s is changing, got multiple %s, generation of long term "
|
||||||
"statistics will be suppressed unless the unit is stable%s",
|
"statistics will be suppressed unless the unit is stable%s. "
|
||||||
|
"Go to %s to fix this",
|
||||||
entity_id,
|
entity_id,
|
||||||
all_units,
|
all_units,
|
||||||
extra,
|
extra,
|
||||||
|
LINK_DEV_STATISTICS,
|
||||||
)
|
)
|
||||||
return None, []
|
return None, []
|
||||||
unit = fstates[0][1].attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
unit = fstates[0][1].attributes.get(ATTR_UNIT_OF_MEASUREMENT)
|
||||||
@ -488,12 +492,14 @@ def _compile_statistics( # noqa: C901
|
|||||||
_LOGGER.warning(
|
_LOGGER.warning(
|
||||||
"The %sunit of %s (%s) does not match the unit of already "
|
"The %sunit of %s (%s) does not match the unit of already "
|
||||||
"compiled statistics (%s). Generation of long term statistics "
|
"compiled statistics (%s). Generation of long term statistics "
|
||||||
"will be suppressed unless the unit changes back to %s",
|
"will be suppressed unless the unit changes back to %s. "
|
||||||
|
"Go to %s to fix this",
|
||||||
"normalized " if device_class in DEVICE_CLASS_UNITS else "",
|
"normalized " if device_class in DEVICE_CLASS_UNITS else "",
|
||||||
entity_id,
|
entity_id,
|
||||||
unit,
|
unit,
|
||||||
old_metadata[1]["unit_of_measurement"],
|
old_metadata[1]["unit_of_measurement"],
|
||||||
old_metadata[1]["unit_of_measurement"],
|
old_metadata[1]["unit_of_measurement"],
|
||||||
|
LINK_DEV_STATISTICS,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user