Print expected device class units in error log (#86125)

This commit is contained in:
Joakim Plate 2023-01-25 20:45:50 +01:00 committed by GitHub
parent 74ae351ac0
commit 1b97a51b5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -665,6 +665,7 @@ class SensorEntity(Entity):
(
"Entity %s (%s) is using native unit of measurement '%s' which "
"is not a valid unit for the device class ('%s') it is using; "
"expected one of %s; "
"Please update your configuration if your entity is manually "
"configured, otherwise %s"
),
@ -672,6 +673,7 @@ class SensorEntity(Entity):
type(self),
native_unit_of_measurement,
device_class,
[str(unit) if unit else "no unit of measurement" for unit in units],
report_issue,
)