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.

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Filter incoming PGNs ?
#11
(08-08-2018, 03:53 PM)Opie91 Wrote:
(08-08-2018, 01:16 AM)Alpenskipper Wrote: @e-sailing: Sorry for my late reply and thanks a lot for your comment.
I guess I have to wait for a simpler solution for filtering incoming PGNs, your approach is to complicated for me.

It would be great to be able to filter incoming PGNs in the same way, outgoing PGNs are selectable.

Agree 100%?

I wanted to add my thoughts on this. I totally agree - this would be a great feature.  In most N2K devices, you can select which sources to use for each type of data - and the filter here would help with that.

For example, in my boat, I have at least one device which, for some unknown reason, constantly sends out an incorrect magnetic variation - and it's not even a GPS device!  So I'd like to just ignore that PGN from that particular source. Also, I have a chartplotter with a built-in GPS, plus my main GPS antenna about 2-3 feet behind it on the stern rail. I want OP to only pay attention to the main GPS antenna, so would again like to be able to choose sources by the combination of PGN and source.

Thanks!
  Reply
#12
There is a chance to filter SignalK sentence before they go into the server.(See http://forum.openmarine.net/showthread.php?tid=1102)
You have to install @signalk/signalk-node-red from signalk appstore.
You can filter on signalk path only. Every sentence with this path can be checked for source or pgn. If you don't return it to signalk it is lost (filtered).
Here is an example node-red code. (I used a canboatjs connection on page CAN)
Code:
[
    {
        "id": "63799a2.775bb64",
        "type": "signalk-input-handler",
        "z": "760efda9.3f811c",
        "name": "sk input handler node",
        "context": "vessels.self",
        "path": "propulsion.starboard.revolutions",
        "source": "",
        "x": 220,
        "y": 280,
        "wires": [
            [
                "1e6133a6.098bc4",
                "7ccbdd7b.926294",
                "bcc6e32.f5c032"
            ]
        ]
    },
    {
        "id": "1e6133a6.098bc4",
        "type": "debug",
        "z": "760efda9.3f811c",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "x": 510,
        "y": 240,
        "wires": []
    },
    {
        "id": "5007678c.821ee8",
        "type": "signalk-input-handler-next",
        "z": "760efda9.3f811c",
        "name": "",
        "x": 780,
        "y": 340,
        "wires": []
    },
    {
        "id": "7ccbdd7b.926294",
        "type": "function",
        "z": "760efda9.3f811c",
        "name": "Filter",
        "func": "if (msg.source.src==\"49\"){\nreturn msg;\n}",
        "outputs": 1,
        "noerr": 0,
        "x": 480,
        "y": 380,
        "wires": [
            [
                "5007678c.821ee8"
            ]
        ]
    },
    {
        "id": "bcc6e32.f5c032",
        "type": "debug",
        "z": "760efda9.3f811c",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "source.src",
        "x": 760,
        "y": 280,
        "wires": []
    }
]
  Reply
#13
Thank you both for the help! Ill check it out and report back.
  Reply
#14
e-sailing,

Thank you for taking the time to point this out again. It just wasn't sinking in. I'm just OK with figuring this out but did get it to work and it is doing great.

Here is what I did, please correct me if wrong (Mostly what you told me to do):

1. Installed the @signalk/signalk-node-red from signalk appstore
2. Enabled the app in the SignalK dashboard by checking the "active" box for NodeRed in the server>plugin-config tab. Make sure you hit the apply (have to scroll down).
3. Restart the SignalK server.
4. Open the @signalk/signalk-node-red in the "Webapps" tab of the SignalK server. This will take you to http://localhost:3000/plugins/signalk-node-red/redAdmin/# (It is a different Node Red page from where the stock Openplotter flows are)
5. Put your flow in here and deploy.

I filtered out several "environment.outside.pressure" paths from my NMEA2000 CAN-USB converter. Just wanted the one from the BME280 (On all the time).

I had to change the source label some reason, the BME280 label comes thru as "$source" for some reason (probably a good one).

Code:
[{"id":"7f6e6463.7ed6fc","type":"signalk-input-handler","z":"8f3e382e.5210e8","name":"environment.outside.pressure filter","context":"vessels.self","path":"environment.outside.pressure","source":"","x":160,"y":140,"wires":[["eaa4fbba.54aec8","dc6d33ba.9622d","b6d7efca.a1df3"]]},{"id":"eaa4fbba.54aec8","type":"debug","z":"8f3e382e.5210e8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":410,"y":100,"wires":[]},{"id":"386c9d64.f15872","type":"signalk-input-handler-next","z":"8f3e382e.5210e8","name":"Return only BME280","x":660,"y":200,"wires":[]},{"id":"b6d7efca.a1df3","type":"function","z":"8f3e382e.5210e8","name":"Filter","func":"if (msg.$source==\"OPsensors.I2C.BME280\"){\nreturn msg;\n}","outputs":1,"noerr":0,"x":380,"y":240,"wires":[["386c9d64.f15872","d42d7ba5.9400d8"]]},{"id":"dc6d33ba.9622d","type":"debug","z":"8f3e382e.5210e8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"$source","x":650,"y":140,"wires":[]},{"id":"d42d7ba5.9400d8","type":"debug","z":"8f3e382e.5210e8","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":690,"y":300,"wires":[]}]
  Reply
#15
One more question:

It appears you have to start the node-red in the signalK server every time you restart openplotter. Is that correct? If so is there a way to get it to run automatically?
  Reply
#16
What exactly do you mean by ’restarting’? The Node-RED plugin should remain enabled and active over RPi restarts.



Sent from my iPhone using Tapatalk
  Reply
#17
After some further messing with it, The node read did remain enabled as you suggest.

What is peculiar is that I have to run the same flow for every sensor with the BME280 label. Not a big deal, but I'm sure its something I forgot of don't understand completely.

Thanks for the help!
  Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)