Temperature Charting Question

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.


Do this:

Number:Temperature Sensor_OfficeTemperature “Office [JS(tempConvert.js):%s °C]” (gSensorTemperature) { mqtt="&lt;[mosquitto:sensor/temperatureoffice:state:default" }

Sitemap file line:

Text item=Sensor_OfficeTemperature label=“Office Temperature [%.1f °F]” icon=“temperature”

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?

Use and persist another item that converts to F
I don’t don’t know of any way to convert “inside” a chart

Ok, that makes sense but I’m not sure how to persist an item that performs the conversion.

Create another JS transform and convert in F in there. Then you have 2 items:

Number:Temperature Sensor_OfficeTemperatureC “Office [JS(tempConvertC.js):%s °C]” (gSensorTemperature) { mqtt="&lt;[mosquitto:sensor/temperatureoffice:state:default" }
Number:Temperature Sensor_OfficeTemperatureF “Office [JS(tempConvertF.js):%s °F]” (gSensorTemperature) { mqtt="&lt;[mosquitto:sensor/temperatureoffice:state:default" }