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
Change data path...
#1
Hi everyone.

I'm receiving "relativeHumidity" from a Ruuvi Tag through the RuuviTag plugin. It sends the humidity path as "environment.outside.relativeHumidity" and I want this info in "environment.outside.humidity" so it can be used by DerivedData plugin to calculate additional information. What's the best way to make this happen (i.e. easiest, most flexible)?

Thanks,

Steve
Reply
#2
Hi Steve, you may want to look into applying node-RED to this challenge. It's one of the signalk plugins.
Reply
#3
(2021-03-13, 07:29 PM)beercansailor Wrote: Hi Steve, you may want to look into applying node-RED to this challenge. It's one of the signalk plugins.

I figured. I’ve been looking at it, but haven’t figured it out yet. 

Thanks. 

Steve
Reply
#4
(2021-03-14, 05:41 AM)SCarns Wrote:
(2021-03-13, 07:29 PM)beercansailor Wrote: Hi Steve, you may want to look into applying node-RED to this challenge. It's one of the signalk plugins.

I figured. I’ve been looking at it, but haven’t figured it out yet. 

Thanks. 

Steve

Try this, first install @signalk/signalk-node-red from the appstore/available if you haven't already. Then open node red by clicking on it in web apps. 
With node red open press control-i, then copy and paste the code below, should look something like this >
[Image: QnQwQAj.png]

Then click the import button and click the deploy button top right and that should be it! 

SO what happens, the node on the left gets the data from environment.outside.relativeHumidity and sends it to the next node which is a function node, the data is passed in "msg.payload", all the function node does is set "msg.topic" to environment.outside.humidity. The last node on the right sends the msg.payload data to the path in msg.topic. 
Hope this works, should do. You can test it by putting this into the data fiddler in the server>
{"updates": [{"values": [{"path": "environment.outside.relativeHumidity", "value": 40.04253}]}]}
[Image: Zd2B4PU.png]

Code:
[
   {
       "id": "b6e07228.375ca",
       "type": "signalk-subscribe",
       "z": "cc33fe4a.e428d",
       "name": "input environment.outside.relativeHumidity",
       "mode": "sendAll",
       "flatten": true,
       "context": "vessels.self",
       "path": "environment.outside.relativeHumidity",
       "source": "",
       "period": 1000,
       "x": 340,
       "y": 440,
       "wires": [
           [
               "efb6a8e7.c8ffe8"
           ]
       ]
   },
   {
       "id": "efb6a8e7.c8ffe8",
       "type": "function",
       "z": "cc33fe4a.e428d",
       "name": "",
       "func": "msg.topic = \"environment.outside.humidity\"\nreturn msg;",
       "outputs": 1,
       "noerr": 0,
       "initialize": "",
       "finalize": "",
       "x": 640,
       "y": 440,
       "wires": [
           [
               "b5fd7236.fe9bc"
           ]
       ]
   },
   {
       "id": "b5fd7236.fe9bc",
       "type": "signalk-send-delta",
       "z": "cc33fe4a.e428d",
       "name": "send environment.outside.humidity",
       "x": 930,
       "y": 440,
       "wires": []
   }
]
Reply
#5
Thanks PaddyB!!!

That is some real help. However, it did not work for me, as there is some sort of error in Node-Red I have to sort out. It took a reinstall to get it to work to begin with, then there was another flow that had an error. I included Debug tags and was able to view that the flow was indeed working, but it wasn't getting inserted back into SK.

In the meantime, I found another Node-Red plugin by Scott Bender called "Path Mapper" that instantly and easily solved the problem. I an just beginning with this Linux/Node-Red/RPi stuff, but am really enjoying it so far, so much so I have a second Pi already that does nothing but OpenCPN, replacing my old Mac Mini and runs off of 12 volt! This is all fun stuff!

Thanks again PaddyB. I appreciate the effort and the lesson!

Steve
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)