I have a couple of ESP8266s reporting temperature in Celcius around my house via MQTT.
Using the following Item file line and Sitemap line I can display the temperatures fine in Fahrenheit on a sitemap.
Item file line:
Number Sensor_OfficeTemperature “Office [JS(tempConvert.js):%s F]” (gSensorTemperature) { mqtt="<[mosquitto:sensor/temperatureoffice:state:default" }
Sitemap file line:
Text item=Sensor_OfficeTemperature label=“Office Temperature” icon=“temperature”
Works perfectly.
I’ve now added rrd4j persistence and can capture data over time and display it on a sitemap using graphs. Perfect except that the data stored in the rrd4j database is in Celcius (raw ESP8266 transmittions being stored prior to any JS conversion routine) and I can’t figure out how to convert the temperatures prior to being displayed on the graphs.
Options other than change the ESP8266 code to convert Celcius to Fahrenheit? I would prefer to stay in Celcius at the source (ESP8266) for other reasons.
Vincent,
Thank you for the reply but that doesn’t answer my question. the Item and Sitemap code I posted works fine for capturing Celcius, converting and displaying the single number as Farenheit. I’m now persisting the Celcius values and want to convert them for display on a graph.
Other than converting at the transmission source (the ESP8266) what options do I have? Convert prior to rrd4j saving or convert within the graph sitemap function?