Hi, I have not been using Home Assistant for long and have been enjoying using esphome to make my own sensors. I have a BME680 sensor and have used the example at https://esphome.io/cookbook/bme280_environment.html to help me to learn the programming as I am new to yaml and c++.
The example calculates “absolute humidity” using the following equation:
return (6.112 * powf(2.718281828, (17.67 * id(bme280_temperature).state) / (id(bme280_temperature).state + 243.5)) * id(bme280_humidity).state * mw) / ((273.15 + id(bme280_temperature).state) * r); // in grams/m^3
so I have adapted the variable names a bit in my project, and I want to have the “dew point” calculated using the equation at https://planetcalc.com/248/.
I am having a problem because the compiler errors on the log function:
src/main.cpp:639:46: error: invalid operands of types 'esphome::template_::TemplateSensor*' and 'float' to binary 'operator+' return ( (b *(dpinter + logf (rh->state)) )/( a - (dpinter + logf (rh->state)) ) );
I have been told I should include the math.h library but am not sure how.
Can some please tell me how to do this - I assume I have to download it from somewhere?
I can provide more info if needed, but have tried to keep the posting short.
Thanks in advance, Robert