mirror of
https://github.com/home-assistant/core.git
synced 2025-07-08 13:57:10 +00:00
Only report invalid numeric value for sensors once (#87010)
This commit is contained in:
parent
35b82db8b0
commit
4dba9c09fc
@ -599,21 +599,22 @@ class SensorEntity(Entity):
|
|||||||
f"({type(value)})"
|
f"({type(value)})"
|
||||||
) from err
|
) from err
|
||||||
# This should raise in Home Assistant Core 2023.4
|
# This should raise in Home Assistant Core 2023.4
|
||||||
self._invalid_numeric_value_reported = True
|
if not self._invalid_numeric_value_reported:
|
||||||
report_issue = self._suggest_report_issue()
|
self._invalid_numeric_value_reported = True
|
||||||
_LOGGER.warning(
|
report_issue = self._suggest_report_issue()
|
||||||
"Sensor %s has device class %s, state class %s and unit %s "
|
_LOGGER.warning(
|
||||||
"thus indicating it has a numeric value; however, it has the "
|
"Sensor %s has device class %s, state class %s and unit %s "
|
||||||
"non-numeric value: %s (%s); Please update your configuration "
|
"thus indicating it has a numeric value; however, it has the "
|
||||||
"if your entity is manually configured, otherwise %s",
|
"non-numeric value: %s (%s); Please update your configuration "
|
||||||
self.entity_id,
|
"if your entity is manually configured, otherwise %s",
|
||||||
device_class,
|
self.entity_id,
|
||||||
state_class,
|
device_class,
|
||||||
unit_of_measurement,
|
state_class,
|
||||||
value,
|
unit_of_measurement,
|
||||||
type(value),
|
value,
|
||||||
report_issue,
|
type(value),
|
||||||
)
|
report_issue,
|
||||||
|
)
|
||||||
return value
|
return value
|
||||||
else:
|
else:
|
||||||
numerical_value = value
|
numerical_value = value
|
||||||
|
Loading…
x
Reference in New Issue
Block a user