OpenMarine
Changing units in Signal K - Printable Version

+- OpenMarine (https://forum.openmarine.net)
+-- Forum: OpenPlotter (https://forum.openmarine.net/forumdisplay.php?fid=1)
+--- Forum: How do I...? (https://forum.openmarine.net/forumdisplay.php?fid=3)
+--- Thread: Changing units in Signal K (/showthread.php?tid=5381)



Changing units in Signal K - SoakinJoe - 2024-05-06

I am migrating to OP4 on the RPi 5 with MacArthur HAT and I2C BME280 for temp, pressure and Humidity. I use KIP to plot the data to display the info like Matt Bailey does (great videos BTW Smile ).

On the "old RPi 4 " I am using Influx DB and Grafana I had no problems manipulating the data to give me hPa rather than Pa for the pressure. With the updates to Influx and Grafana I just can't get my head around how to do this, as all the friendly features seem to have been replaced by scripts.

Now I am a little technical, but not that technical, and I have been going round and round with Influx and Grafana for a while now, so I thought that the easiest way would simply to change the Signal K or BMP280 units from Pa to hPa. But I just cannot find how to do it (there is talk of changing the scripts in .JSON but I have to admit that is a little beyond me!).

I tried changing the scaling factor of the BME280 in the I2C menu of OP4, but that has no effect.

Can any of you clever folks out there help me please?

Thanks


RE: Changing units in Signal K - PaddyB - 2024-05-06

(2024-05-06, 01:01 PM)SoakinJoe Wrote: Can any of you clever folks out there help me please?

Thanks

not so clever as persistent  Big Grin Big Grin

Assuming you are now on influx V2, flux ain't immediately obvious, but eventually I found the map function. Signalk works in SI units so probably best to do any unit changes last. Here's my pressure flux, you can change the name as well >>

from(bucket: "boatyDb")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: ® => r["_measurement"] == "environment.outside.pressure")
  |> map(fn: ® => ({ _value:r._value / 100.0, _time:r._time, _field:"Pressure" }))
  |> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)
  |> yield(name: "mean")


RE: Changing units in Signal K - SoakinJoe - 2024-05-06

Works perfectly, not sure I would have got there on my own.

Thanks very much


RE: Changing units in Signal K - PaddyB - 2024-05-06

(2024-05-06, 05:16 PM)SoakinJoe Wrote: Works perfectly, not sure I would have got there on my own.

Thanks very much

Took me a while!  Big Grin

One tip is to use the influxdb web portal on port 8086 then click the data explorer little graph icon  and use it to create the flux script & copy/paste into grafana


RE: Changing units in Signal K - SoakinJoe - 2024-05-08

(2024-05-06, 06:25 PM)PaddyB Wrote:
(2024-05-06, 05:16 PM)SoakinJoe Wrote: Works perfectly, not sure I would have got there on my own.

Thanks very much

Took me a while!  Big Grin

One tip is to use the influxdb web portal on port 8086 then click the data explorer little graph icon  and use it to create the flux script & copy/paste into grafana

I would never have found that Smile


RE: Changing units in Signal K - Screenshot - 2024-05-10

Using influxdb and grafana, I'm trying to chart the boat's position on a map (no problem) but I am unable to apply a color gradient relative to the speed of the boat/power consumption... If anyone has something like this working, could they please share ? Thanks !