NMEA 2000 to HA

Thank you for pointing me to this thread. I’m watching and eventually I’ll contribute to this discussion.

Hi Craigy, Did you manage to decode any of the Masterbus messages? This has been on my list for some time.

hi

i maybe gonna buy that canable.io too …
did you ever got data from it to HA ? i want to read my canbus system too

thnx for sharing!

FYI, there was some discussion of this over on the Cruiser’s Forum:
https://www.cruisersforum.com/forums/f13/new-nmea-2000-and-nmea-0183-board-for-raspberry-pi-238627.html

In that thread there’s a link to an interesting blog:

While not HA-based, this has got to be one of the best setups I’ve seen for working with N2K data. And it seems like a great first step for eventually sharing the data over to HA.

1 Like

thnx for sharing
i dont have an NMEA 2000 , my domotica system (switch+lights) are based on canbus
i want to read out the can to intercept traffic and then do stuff in HA

just looking for an howto

In an other discussion I mentioned my experimentation with the Pican-M Hat.

I will eventually report on the results.

Hi Craig!

I am literally inspired by your story about working with the HMEA200 protocol!
I’m new to all this and just learning.
Now SignalK has a MMQTT plugin for Home Assistant, its JSON is very easy to process in HA.
I managed to connect SignalK to the MQTT broker and receive the information I needed in the HA, but I do not understand how from the HA I can send the information I need to SignalK (((
Could you describe in detail how you managed to send information from the Home Assistant to the MQTT broker so that SignalK could read and process it?
I will be very grateful to you for your time spent on this description, unfortunately I stand still without this knowledge ((
Thank ya lot!

Please give me a lesson on how to achieve this, Home assistant send JSON to MQTT and Signal K can to read and send to NMEA2000!

Hi!
I am also in both worlds, with home assistant and signal k.
Any one managed to get into one single raspberry pi both systems?

Also, I got a cheap AliExpress can module that costs 13€ and it is supported on the open plotter wiki to support NMEA2000 can interface. But haven’t tested it yet!
I’ll leave it here, it is a nice point to start messing

€ 10,69 3% dto. | Módulo de comunicación CAN BUS para Raspberry Pi 3 Modelo B + 3B Plus 4 4B Zero W WH, 3,3 V, MCP2515 RS485

Manual here:

https://openplotter.readthedocs.io/en/latest/can/can_app.html

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 ()’