FHEM > English Corner

Scaling data in svg plot. ( unit conversion )


I have a bme280 tenp/pressure/humidity sensor reporting via MQTT. I graph them with gplot. Sofar, so good. The problem is pressure is reported in Pascals. I could modify the code that reads the me, but I'm hoping there is a way to app,y a scale to each reading as the gis made. made. For example multiplying Pascals by 0.00296 gives in hes of mercury, or dividingb by100 gives hPa,

You can use the fourth parameter in a plot data entry to specify a function, which is applied to each data point. For example, if your plot line reads

--- Code: ---#FileLog 4:pressure:0:

--- Ende Code ---

you can divide each pressure value by 100 like this:

--- Code: ---#FileLog 4:pressure:0:($fld[3]*0.01)

--- Ende Code ---

The function field is also present in the SVG-Editor, it is the last text-input field in the row.
Note: $fld[ x ] is a perl array, the index starts with 0.

perfect! thank you, I knew it would be somewhat obvious once i knew the answer.  :)    oh and sorry about duplicating this. I don't see that I can delete the other one.   :(


[0] Themen-Index

Zur normalen Ansicht wechseln