This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
copy data points and convert format in signalk
#1
Hi

I have mapped two I2C data points to:
self.environment.inside.rpi.temperature
self.environment.inside.rpi.pressure
using the * replacement from I2C app.

The data is visible from signalk data viewer in Kelvin and Pascal, neither of them available from OpenCPN dashboard.
I expect OpenCPN dashboard is looking for outside data, is this correct?

How do I make copies of these data points in signalk?
I would like to copy to
self.environment.inside.mainCabin.temperature
self.environment.outside.pressure
presented in the more useful formats Celcius and mbar.

In signalk data viewer when i click on the copy symbol (one rectangle overlayed on another rectangle, like two sheets of paper) the path briefly fades then back to normal and nothing else happens.

cheers
Frode
Reply
#2
Not sure I understand what you are trying to do.

If you just want to apply a linear transform (i.e: -273.15 to convert K to C), you can use some plugin, like calibration and create a basic rule:

   

If you actually want to duplicate the path, i don't know of any signalK plugin that can do that but you can create a node-red flow to achieve it.

However, make sure you're sending metadata (at least units) from I2C. If you don't, that might explain why software consuming this path don't know how to convert it:

   
Reply
#3
(2022-03-09, 10:28 AM)MigGat Wrote: Not sure I understand what you are trying to do.

If you just want to apply a linear transform (i.e: -273.15 to convert K to C), you can use some plugin, like calibration and create a basic rule:



If you actually want to duplicate the path, i don't know of any signalK plugin that can do that but you can create a node-red flow to achieve it.

However, make sure you're sending metadata (at least units) from I2C. If you don't, that might explain why software consuming this path don't know how to convert it:

you could dive into the plugIns java-script code and add the UNITs there:

https://github.com/nmostovoy/signalk-ras...2c0979aff2
Reply
#4
(2022-03-03, 02:40 PM)cortinaman Wrote: Hi

I have mapped two I2C data points to:
self.environment.inside.rpi.temperature
self.environment.inside.rpi.pressure
using the * replacement from I2C app.

The data is visible from signalk data viewer in Kelvin and Pascal, neither of them available from OpenCPN dashboard.
I expect OpenCPN dashboard is looking for outside data, is this correct?



How do I make copies of these data points in signalk?
I would like to copy to
self.environment.inside.mainCabin.temperature
self.environment.outside.pressure
presented in the more useful formats Celcius and mbar.

In signalk data viewer when i click on the copy symbol (one rectangle overlayed on another rectangle, like two sheets of paper) the path briefly fades then back to normal and nothing else happens.

cheers
Frode

The dashboard in opencpn is looking to nmea0183 data. My openpcn crashes if set to receive siganlk data on port 3000 which I haven't looked at yet so it just gets nmea0183 data from port 10110. istr dashboard tactics will read signalk data as well. . The signalk-nmea app will convert pressure (needs to be standard pressure delta of 'environment.outside.pressure')  to nmea0183 which the dashboards can read. 

"In signalk data viewer when i click on the copy symbol (one rectangle overlayed on another rectangle, like two sheets of paper) the path briefly fades then back to normal and nothing else happens."
Something else does happen, but not much.. clicking the icon just copies the path.
Reply
#5
By the way, if you actually need to duplicate the path for some reason here is a flow example for node-red. I haven't discovered node-red until very recently, but found out is a great way to solve this kind of simple situations.

Just import this flow:

Code:
[{"id":"67efd12d84e22394","type":"tab","label":"Flow 3","disabled":false,"info":"","env":[]},{"id":"53f7eaac49abd002","type":"signalk-input-handler","z":"67efd12d84e22394","name":"","context":"vessels.self","path":"environment.rpi.cpu.temperature","source":"signalk-raspberry-pi-monitoring","x":230,"y":320,"wires":[["12c123a8338d64fe","f152c88ba2a12b63"]]},{"id":"12c123a8338d64fe","type":"signalk-input-handler-next","z":"67efd12d84e22394","name":"","x":870,"y":320,"wires":[]},{"id":"095d1123a1c2bd23","type":"signalk-send-pathvalue","z":"67efd12d84e22394","name":"","source":"node-red","meta":"{\"units\": \"C\"}","x":870,"y":420,"wires":[]},{"id":"f152c88ba2a12b63","type":"function","z":"67efd12d84e22394","name":"","func":"msg.payload -= 273.15;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":420,"wires":[["3e967c3a7e022e15"]]},{"id":"3e967c3a7e022e15","type":"change","z":"67efd12d84e22394","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"environment.rpi.cpu.temperature.converted","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":630,"y":420,"wires":[["095d1123a1c2bd23"]]}]

Should look like this in node-red (remember top edit the nodes to specify your source/path):

   

And you should get something like this:

   
Reply
#6
(2022-03-10, 09:14 AM)MigGat Wrote: By the way, if you actually need to duplicate the path for some reason here is a flow example for node-red. I haven't discovered node-red until very recently, but found out is a g
Should look like this in node-red (remember top edit the nodes to specify your source/path):

Couple thoughts......... signalk is designed to use SI units, so usually not a very good idea to change units to something else, KIP dash etc will change the actual display units for you, inside signalk the data units should stay as SI units. . 
https://signalk.org/specification/1.5.0/...model.html

Quote:The values are always SI units, and always the same units for the same key. Therefore, speedOverGround is always meters per second, never knots, km/hr, or miles/hr. This means you never have to send units with data, the units are specific for a key, and defined in the data schema. A simplified version of the JSON schema with the units is available in Keys Reference in Appendix A. The units are also always specified in the values’ metadata which is available via the REST API in the meta.units property. Besides the units property, meta provides a lot of other useful information for consumers of the data.

Also usually better to leave the source path unchanged, if you want to view deltas created in node red then just put that in the source of the input - 
[Image: ywmCRdE.png]
Otherwise you shouldn't really need to bother with source. 
And you can define topics etc in your function node,
msg.topic = "my.new.path";
Or even easier, use a change node  Cool
Can anyone think of anything node-red can't do  Big Grin
Reply
#7
Thanks PaddyB! I was trying to help with my limited knowledge, but as i said, I didn't know about node-red until very recently Big Grin
In any case, the idea was just to let @cortinaman know that node-red exists, and that "these kind of things" can be achieved with the tool Smile
Reply
#8
Thank you all, I will try some of this over the weekend.

I was not aware OpenCPN dashboard was looking for 0183 data. In opencpn I only have the default signalk connection on port 3000 and some data are transmitted. But I do notice opencpn shutting down from time to time as mentioned in one of the posts over. I will set up the 0183 plugin in signalk and take it from there.

I will also have to look into node red, I have been avoiding this so far as it seems a bit complicated.
Reply
#9
(2022-03-11, 09:39 AM)cortinaman Wrote: Thank you all, I will try some of this over the weekend.

I was not aware OpenCPN dashboard was looking for 0183 data. In opencpn I only have the default signalk connection on port 3000 and some data are transmitted. But I do notice opencpn shutting down from time to time as mentioned in one of the posts over. I will set up the 0183 plugin in signalk and take it from there.

I will also have to look into node red, I have been avoiding this so far as it seems a bit complicated.

I've had opencpn 5.6 crashing with signalk data as the only input but yet to investigate why, so just use nmea0183 data for now. Enough for my setup, feeds the logbook & dashTactics plugins. ISTR in a manual somewhere having  both signalk & nmea0183 data connections active at the same time is a bad thing... 

Node red is worth a play, seems a bit daunting  but not as complicated as it looks at first, though *really* powerful.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)