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”
That is how this works:
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.