How to calculate Heat Index using an SQL function in MariaDB

As a bonus on the back of my posts about how to log temperature from your ThermoPro 350S with you RaspberryPi or in Linux and it's follow up of how to add the Heat Index calculation into the the mix using python I've also now got a calculation for MariaDB for you.

It took a little time for me between working out how to log the data and writing the Heat Index code by which time I'd amassed a fair few records which were sitting in my SQL database without the additional metric, so a couple of months down the line I've got round to writing the code to update my logs with the Heat Index.

Grab the code from my Gist here or copy from below:

Now all you have to do it to run the code in MariaDB and it will create a function you can call whenever you like. You can test it by running the following code which will calc the Heat Index at a temperature of 25 deg C and relative humidity of 55%:

SELECT CalcHeatIndex(22.5,50)

should return a result of

22.1111

Tags : thermopro tp350s tp357 linux datalog

Subscribe to newsletter

Search Posts

Back to top