Device class None, state class measurement and unit Afzuiging thus indicating it has a numeric value; however, it has the non-numeric value: Automatische (<class 'str'>);

Please assist in the best selection in Node-Red.

Error:

Logger: homeassistant.components.sensor
Source: components/sensor/__init__.py:597
Integration: Sensor (documentation, issues)
First occurred: 09:29:44 (1 occurrences)
Last logged: 09:29:44

Sensor sensor.duco_status_laatst_verstuurd has device class None, state class measurement and unit Afzuiging thus indicating it has a numeric value; however, it has the non-numeric value: Automatische (<class 'str'>); Please update your configuration if your entity is manually configured, otherwise report it to the custom integration author.

Config:

There is no such class as “string” or comparable. I tried state class measurement (before it was blank with same error).
image

The functionality works perfect and the entity displays my desired output. It is just an annoying error message.

I’m getting this exact error as well. Mine also works fine but I try to go through my errors and correct them, but there’s no option for my template sensor to indicate a string value instead of pre-determined measurements.

1 Like

Can i get some professional help here:-)…

now my entity is not available anymore in HA:

Logger: homeassistant.util.logging
Source: util/logging.py:154
First occurred: 11:15:30 (1 occurrences)
Last logged: 11:15:30

Exception in handle_discovery_update when dispatching 'nodered_discovery_updated_nodered-c6b350c5.b8b3c-bf72bbcf.c428': ({'state': 'Automatische', 'attributes': {}, 'type': 'nodered/discovery', 'server_id': 'c6b350c5.b8b3c', 'node_id': 'bf72bbcf.c428', 'config': {'name': 'Duco Status Laatst Verstuurd', 'icon': 'mdi:fan', 'unit_of_measurement': 'Afzuiging', 'state_class': 'measurement'}, 'component': 'sensor', 'id': 23}, <homeassistant.components.websocket_api.connection.ActiveConnection object at 0x7f58e70c76d0>) Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 581, in state numerical_value = float(value) # type:ignore[arg-type] ValueError: could not convert string to float: 'Automatische' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/config/custom_components/nodered/__init__.py", line 189, in handle_discovery_update self.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 585, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 649, in _async_write_ha_state state = self._stringify_state(available) File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 591, in _stringify_state if (state := self.state) is None: File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 583, in state raise ValueError( ValueError: Sensor sensor.duco_status_laatst_verstuurd has device class None, state class measurement unit Afzuiging and suggested precision None thus indicating it has a numeric value; however, it has the non-numeric value: Automatische (<class 'str'>)

help please…

Remove the unit of measurement. Like the error message says, your use of a unit_of_measurement implies that the sensor should be a number, but then your state is Automatische which is not a number.

I know, but this worked for over 2 years…

I use it as a sensor to show the last sent state variable.

E.g.
High speed “sent”
Low speed “sent”

Where “sent” is the unit of measurment.

How can I get that back working?

1 Like

You can’t. Recent versions are strict on unit of measurement usage. Remove the state_class and unit_of_measurement.

Perhaps try a markup card to show it how you want.

1 Like

Thank you.

The only option left is to remove the class and measurement yes…