Mqtt autodiscovery sensor freezes IU displays string like data instead of int

Hi
I have a co2, tvoc, temperature and humidity thing that I record the data from and transfers them into 4 different sensors. I do this in node red with via the mqtt autodiscovery functionality.
when I try to load state history loveace seems to freeze completely.

the data from developer tools displays:

[sensor.co2] 959
friendly_name: CO2

I create it sensor with the follwoing commands:
topic = homeassistant/sensor/CO2/config
Msg = { “name”: “CO2”, “state_topic”: “homeassistant/sensors/CO2/state”}

To me it seems like HASSIO is interpeting my data as strings not intergers/floats e.g. when I could my sensor state was displayed like this:

number with different colors like and not graphs, like I see then looking at temperatur data from other sources.

Can anybody help me debug this?

First step in debugging : show the actual mqtt messages.

Great that you will help!

okay, the payload send is: 566 (a number)
To the topic: homeassistant/sensors/CO2/state
Please note this is a number not a string.

I needed to add a “unit_of_measurement” and then HA intereped it as a number, my very simple definition is:

{ “name”: “TVOC”, “state_topic”: “homeassistant/sensors/TVOC/state”, “unit_of_measurement”: “lx”}