Error due to change in default device class

Hi,

I have a template sensor which provides a numer of days if there is leave booked or a text if not.
Up to now it works well because obviously the default device class was epected as string.
But after update to HA 2023.11.3 I receive an error, because the default is expected as number.

ValueError: Sensor sensor.days_to_leave has device class 'None', state class 'None' unit 'Tage' and suggested precision 'None' thus indicating it has a numeric value; however, it has the non-numeric value: 'no leave' (<class 'str'>)

But which device class is to be set in order to force a string as output?

Entities with string outputs can not have a unit of measurement. Just remove that.

1 Like