A couple days ago i played around with a SI7021 on my ESP8266 and recognized that the temperature output of the used Library  was given as an integer, so without a comma or dot for the separation of the decimal places. Like 2495 instead of 24,95°C. Not really problematic, but for using the numbers with MQTT it was relevant to convert it to the proper type which was “Float”

Solution

That is how this works:

1
2
3
float tempfloat;
int tempint = 2495;
tempfloat = (float) tempint / 100.0;

Take care to add a decimal place to the division. The Usage of (float) executes the casting which changes the type of the variable content.

Sources