NMEA 2000 to HA

Yes, I did it on one RPI4B, but itā€™s better to spread it to different RPI for greater stability, itā€™s time-tested.

1 Like

Hi @craigy

The beauty of this solution is you can send MQTT back into SignalK paths and openplotter can then send these back out on the NMEA bus as NMEA PGNā€™s. So Home Assistant can actually influence NMEA2000 data on proprietary devices.
Blockquote

Iā€™m also curious how it can be made :slight_smile:

I sent the guy at seabits.com a link to HA in an effort to get him excited about this platform.

and you can create a pgn like fuel consumption based on rpms, for example!

This OS has all the components preinstalled

SignalK, Homeassistant, NodeRed, etc

what about a simple way to take GPS data in the form of a National Marine Electronics Association (NMEA) text stream so my HA in the Overlanding Prius can have GPS from the M2000 5G mobile device? Even better if HA could rebroadcast to other devices/applications like my head unit thats android and on the same wifi network?

Hi Craigy,

Reply on a old post but still a very interesting one. I was trying to get things up and running. I used the plugin SignalK ā†’ MQTT home assistant bridge. This appears to connect with my home assistant as in mentions in the MQTT log.
Only this is that i dont see any data. On the SignalK side i used a slef path which is active and has data .

In HA i dont see any sensor or something added in the MQTT area.
Any suggestions

Thanks

Happy it all helps :slight_smile:

Thereā€™s a lot of moving parts, the SignalK plugin only pulls data if running on the OpenPlotter and cannot access the SignalK data if it is on device (when I set it up that was the case, maybe changed since).

I got around this, by using NodeRed on the OpenPlotter. With the Hone Assistant palette installed. Then force HA to create sensors from OpenPlotter with the SignalK data.

Another option is to manually create the sensors for MQTT topic on the Hone Assistant. The reason they donā€™t automatically appear is because SignalK MQTT data isnā€™t formed to the auto-discovery JSON format that HA expects for auto creation of sensors. This was how I did it originally, but most values were like m3 instead of L and so on. This is why I used NodeRed because I could convert the values create the HA sensors and debug all in the same interface.

You can subscribe to MQTT # topic and check that the SignalK data is appearing in MQTT it will show all topics on the server.

1 Like

Hey @TheeBeginner ,

There are two SignalK plugins to interact with MQTT. Thereā€™s the signalk-mqtt-gw, which is the oldest one and itā€™s been unmaintained for some time now. This is the one that @craigy mentioned in previous posts, and it allows for a simple integration between SignalK and MQTT.

Now thereā€™s another plugin, signalk-mqtt-bridge which I created recently because the original gateway plugin was lacking some key functionality that I needed. The new plugin allows for a more dynamic integration with MQTT, allowing subscribers to select which data they want in MQTT, and also allows for data to flow back into SignalK from MQTT, including sending PUT requests.

From your message I assume youā€™re referring to this second plugin. If so, you need to understand and use the Keepalive mechanism in order to get some data flowing into the broker. Itā€™s explained in the README here. In short, you need to post a keepalive message into MQTT every ~30 seconds with the topics that you want SignalK to publish. For example, this Home Assistant automation would instruct SignalK to publish all deltas from vessels.self.* to MQTT:

alias: SignalK keepalive
description: ""
trigger:
  - platform: time_pattern
    seconds: "30"
condition: []
action:
  - service: mqtt.publish
    data:
      topic: R/signalk/4881db477e55/keepalive
      payload: '["vessels/self/#"]'
mode: single

Where 4881db477e55 is the last part of the SignalK autogenerated UUID or your MMSI if configured. Youā€™ll need to update that to your own ID.

The fact that there isnā€™t sensor auto-discovery still applies, so youā€™ll still need to define all MQTT sensors in Home Assistant, as @craigy said.

1 Like

@iuri

I am trying to get signalk-mqtt-bridge working for a signalk - node-red connection.

In signalk it will send the initial keep alive message that I can then see in MQTT_Explorer. So I know that the plugin is configured and talking to the mqtt broker. In node-red Im sending an mqtt message with R/signalk/f005dc8c4fcd/keepalive as the topic and empty payload. This also shows in the MQTT_Explorer. But no deltas are getting published to mqtt broker. When I look at the signalk logs Iā€™m getting the following error: Can you advise what I may be doing incorrectly? Iā€™d really like to get this working, its exactly what I am looking for. It would allow me to get all my NMEA and Victron data in a consistant way into node_red for processing and feeding Home Assistant as my frontend. Im using on a live-aboard sailboat.

ā€˜Jan 16 09:58:40 TypeError: path.replaceAll is not a function at signalkPathToMqttTopic (/home/pi/.signalk/node_modules/signalk-mqtt-bridge/index.js:323:17) at handleDelta (/home/pi/.signalk/node_modules/signalk-mqtt-bridge/index.js:177:36) at /usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:1048:16 at /usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:463:23 at processAfters (/usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:359:11) at Object.inTransaction (/usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:439:9) at Dispatcher.push (/usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:1214:24) at Dispatcher.handleEvent (/usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:1267:17) at Bus.sink (/usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:242:17) at Bus.push (/usr/local/lib/node_modules/signalk-server/node_modules/baconjs/dist/Bacon.js:2371:21) at StreamBundle.push (/usr/local/lib/node_modules/signalk-server/lib/streambundle.js:68:19) at StreamBundle. (/usr/local/lib/node_modules/signalk-server/lib/streambundle.js:36:22) at Array.forEach () at processIems (/usr/local/lib/node_modules/signalk-server/lib/streambundle.js:35:19) at StreamBundle. (/usr/local/lib/node_modules/signalk-server/lib/streambundle.js:55:21) at Array.forEach ()ā€™

Thatā€™s an odd error :thinking: It would seem that SignalK is publishing a delta without a path or with a path property thatā€™s not a stringā€¦ Iā€™ve never seen that.

To avoid deviating from the current topic of this discussion, Iā€™d suggest you open an issue in the Github repository of the plugin, so it can be checked further.

Information that you could attach to the Github issue:

  • Which version of NodeJs and SingalK are you using?
  • Are you seeing anything else in the logs?
  • Can you think of any data being processed in SignalK that would produce a delta without a path?

@iuri

Thanks - I have opened the issue at Github

Hi Guys,

Havent had time to read every message but I came across this library from Timo.

Check the nmea2k library, i used this for some diy sensors to get them displayed on the Axiom.

I have gotten this set-up to work with the help of this post of the author of plugin signalk-mqtt-bridge (thanks a lot for that! :slight_smile: ). Here is the description of the neccessary set-up to connect SignalK with Home Assistant:

1 Like

I have NOde Red running on both Cerbo GX signal k and node red server, and node red in home assistant, on same LAN, can you help how the two communicate?

@iuri
Hi I canā€™t get any topic in Home Assistant (I tried with another plugin the mqtt assistant and that works, but topics are separated by dots and having hard time with it).


  - platform: time_pattern
    seconds: /30
  condition: []
  action:
  - service: mqtt.publish
    data:
      qos: 0
      retain: false
      topic: R/signalk/247385xxx/keepalive
      payload: '["vessels/self/#"]'
  mode: single

in MQTT explorer (in HA) the topic ikeepalive s there, but no response from signal k

In signalk plugin configuration
SignalK will use system id 247385xxx, to interact with MQTT


Jan 18 09:24:45 2024-01-18T09:24:45.836Z signalk-mqtt-bridge Plugin stopped
Jan 18 09:24:45 2024-01-18T09:24:45.841Z signalk-mqtt-bridge Plugin starting
Jan 18 09:24:45 POST /skServer/plugins/signalk-mqtt-bridge/config 200 12.947 ms - 50
Jan 18 09:24:46 2024-01-18T09:24:46.016Z signalk-mqtt-bridge MQTT connection closed
Jan 18 09:24:46 2024-01-18T09:24:46.024Z signalk-mqtt-bridge MQTT connected
Jan 18 09:24:48 GET /skServer/debugKeys 304 7.639 ms -

In MQTT explorer you should also see the keepalive advertisement message from SignalK, it should start with an N/ prefix (not R/). Thatā€™s also a good way to check which system id signalk is using.

From the looks of it, it might be that SignalK is not recognizing the system id youā€™re using as its own, and itā€™s ignoring your keepalive message.

Also, if youā€™ve enabled debug logs for the SignalK plugin, it should log any messages received through MQTT and the outcome of them. So you should see your keepalive messages logged there.

You could also try to manually send the keepalive message from MQTT explorer directly, to see if the problem is in the HA automation or in SignalK (or MQTT).

1 Like

Some more options for integrating Home Assistant and NMEA2k here, via Victron - some overlapping with things already suggested in this topic

1 Like

Thanks very useful

I have NMEA to HA integrations. I also develop Boat specific Home Assistant Integrations.

This is a summary video:

And the Channel:

Smart Boating

1 Like

Latest BBN Marine OS 2024-04-20 FULL now includes these NMEA 2000 integrations as well as NMEA 0183 TCP. Run the homeassistant-install.sh from add-ons reboot once after configuration of HomeAssistant is complete and you will be able to find these integrations in Settings/Add Integration in HomeAssistant web UI.