Home Assistant on RPi in a boat, connecting it to my home?

I’ve recently started doing this on my boat, at least partially. It’s work in progress.

What I did is not really about automating anything. It’s mostly about remote monitoring and surveillance. I had planned to install an RPi as an NMEA multiplexer for a while now, so I just slapped HA alongside with it on the Pi (in a venv). Right now HA monitors the batteries (both engine and house bank), shore power voltage and the solar panels. I also monitor the bilge pump (which is activated automatically over the usual floater switch), as well as ambient temperature and humidity levels.

The Pi connects to the outside world using a 4G modem. I got myself a cheap data plan with 60GB monthly, so that’s plenty. That data is also used for other tasks, getting GRIBs, updating charts and general internet browsing. I also have an Iridium Go when outside of 4G coverage, but I won’t let that anywhere near the Pi :grin:

My boat is year round in the water at a marina and it can get pretty damp inside during winter time. I usually have a little portable heater and a dehumidifier for that, which I’d like to both monitor and possibly control through HA as well. But I didn’t get around to do that yet.

Sadly we had some incidents here during the last year, where things got stolen on some boats. This is a very small marina (it’s actually more a small dual use fishing harbour), so there’s very little security around. I’m planning to add a PIR inside the boat and possibly a small camera either inside or outside, which would both connect to HA.

I also added two small tablets for use in the cabins which could access HA, which was fun, but in the end turned out to be pretty useless. HA is pretty much only used for keeping an eye on the boat while I’m not around and sending alerts on my phone if something is not normal.

I thought about connecting HA to the NMEA subsystem at some point. Not for controlling anything, but for gathering statistics and playing around with those. Not sure if I’ll ever get around doing that though, but it sounds like fun.

I’ll be following this thread closely!

The ideal use case is a boat in a marina, with shore power connected, some distance from home. Right off the bat, you want to know if and how often the bilge pumps run, battery voltage, temperature and humidity, and if shore power is connected. And you want these remotely.

Once you get underway, you still want to know about those things, but now you can start thinking about engine gauge information and other data from the NMEA network(s). All that needs to be available over a local WiFi network.

Eventually, it would be nice to get to controlling things like lights and thermostats.

There are lots of different options for building such a system. One huge hurtle is that you’d typically want most components to work on 12VDC, instead of 120/240VAC. And, of course, it’s “dirty” power. it can be 14V and above when charging, and plunge way down when the batteries are running low or when cranking the engine.

It’s a complex network design problem, too. You sometimes have cellular service. Some marinas have WiFi, but it’s often unreliable. Some boats have satellite options, but data is very expensive. You may be accessing it from aboard the boat or from home. You may already have devices like chartplotters and AIS which have their own built-in WiFi capabilities. And your electronic devices share data over NMEA 0183 and/or NMEA 2000 networks.

There’s also the issue of the parasitic power drain from all these devices. When anchored or at a mooring, running down the house battery bank is a concern.

Nice to see there are people around working on HA on board.
I’m working on integration of Openplotter, OpenCPN, OpenVPN and HA
on board of my Dutch Traditional Vollenhovense Bol.
It is work in progress. I’ll report here from time to time.

2 Likes

Sounds great! OpenCPN is really nice. It could easily be used as a primary chartplotter and radar display. I would love to go that path, but for the cost of a daylight-readable, weather-resistant touch-screen display and all the associated hardware, I could almost buy a dedicated off-the-shelf unit.

Anyway, never mind the HA stuff, we want pictures of that boat!

OT This is the registration of my ship
More info on my website (just google my name without space)

More on topic. It is not only cost what drives me. It is the flexibility of diy. I’m a very old UNIX man from the start in 1976 in The Netherlands. Using open source, programming in C and Python.

On board of the Bollejan I have a RP4 running Openplotter and OpenCPN and a few RP Zero W gathering data. The LAN runs on a Huawei ES885Ls-93a Mobile WiFi Pro2, which connects to my provider
with a dataplan of 100 GB and eventually more.
On a RP3B+ I have installed Home Assistant and OpenVPN.

That is the situation now. I hope to integrate HA and the K-protocol of Openplotter.
Read the docs.

Maybe there is someone out there to point me in the right direction.

Cheers

She’s beautiful! It is great to see someone taking such great care of an older boat.

It sounds like you are already going in the right direction. There’s been a lot of talk about Signal-K, and I like the idea of an open-source protocol. I think if you’re starting from OpenCPN and OpenPlotter, that’s probably the way to go. For off-the-shelf hardware, however, NMEA is going to be needed.

There was a good discussion about this some time ago:

Thanks Tom. NMEA is easily handled by Signal-K: my GPS data, temperature and depth, AIS data
all NMEA is multiplexed in Signal-K.
I’ll look at the discussion you pointed to

Cheers

My plan is not working. My ISP is blocking all ports on my mobile access point, even port 80 and 443. So vpn is useless. But the Home Assistant Cloud is working.
For a $5 a month subscription I can get to my HA on board from everywhere. That is working great!

Now up to connecting HA with Signal-K and sensors and switches on board of the Bollejan.

Cheers

1 Like

This topic got me some motivation to try out a few more things myself. So I installed a Signal-K server on the Pi (over OpenPlotter) and connected my AIS to it over NMEA0183. Right now I used a simple RS232 to USB converter because I had one lying around, but eventually that will go over the Pi’s UART directly. I managed to create an AP and to retransmit the NMEA phrases over the Wifi. Pretty cool suddenly seeing the other boats around me popping up on Navionics on my tablet :grinning:

Did you manage to connect HA to the Signal-K server ? And do you have any plans on what you would actually use HA for when connected with the NMEA network ?

I mean aside from the obvious technical fun factor, I wonder if there is any real use behind this. Signal-K can be automated directly with scripts or with Node Red. There’s a ton of plugins and webapps for Signal-K (I was seriously surprised by the amount !). Logging works with influxdb and Grafana. So maybe HAs primary use here would indeed be remote surveillance ? Hmm.

1 Like

Watching. I setup an HA instance and have been messing around - my only reason when I return back to liveaboard boat live in the next couple of years (we cruised the caribbean for 3 years on a catamaran). There is so much home assistant can do its mind boggling. I am interested in pulling canbus data in grafana - a useful took for engine monitoring and looking for potential engine issues through data trends. Then there is basic security system and monitoring system for tank levels. I am watching the level of monitoring aboard seawolf on the vendee round the world solo race. They have all rigging and hydrofoil load monitored and pushed up in realtime - display thanks to grafana. Link will only be alive for maybe another month or so but check it out
https://exocet.cloud/grafana/d/bsbc_5MGz/malizia-public-dashboard?orgId=15&from=now-96h&to=now&theme=dark&kiosk&fbclid=IwAR34Yb8buf8yIoWK5aZBRr1V0caOsbFIlPEi9vfnMaU5nL7UZfBtoJC04hM
Also interested in energy monitoring and light control. This guy was pulling data out of his victron into HA and just did a talk about it a couple of weeks ago on the HA conference.
https://broccolibus.com/
There is a signalK nodeRed integration so probably some hooks into HA via this interface. I am noob so just guessing. Was hoping DRzzz’s would start looking at the HA on his RV, this and boating is the next extension of the platform and might even be worthy of its own forum category. Waiting / looking for 12v smart plugs, switches etc for lighting control. Anchor drag alarm to HA on your phone while ashore?

I had started a setup, but I’m now starting from scratch again.
I had Raspbian + Home Assistant manually installed on a RPi, so I could easily SSH in an install other services as well. But I found that there is more than enough to do aboard a boat, I don’t want to have to manage the RPi OS as well. So I went with the image install, which makes HA run like an appliance instead. So much easier to manage, but anything you’d want to add that’s not a feature of HA you will have to run in a Docker image.
A bit more hassle, but I guess much more stable and reliable.

I found that between the trips to the boat (I don’t live there) I kinda forgot what I was doing the last time, so I need a more “plug and play” approach for Home Assistant.

I have another thread here regarding installing GPSD and setting up a service so I can send data to MarineTraffic (I don’t have a AIS transmitter). This is mostly “just for fun” as it doesn’t really do anything else than log my trips.
Anyways - using Home Assistant as an appliance means that this has to be manually installed in Docker, which again means I have to get more acquainted with both Docker and GPSD. I’ll see if I can get this working in the near future. I kinda want to make an AIO Docker image that takes a GPS and mail setup and then automatically sends to MarineTraffic.
Or maybe a better way - GPSD in a separate docker + a mail sending service.

I made some comments on your other thread. Trying not to drift too far here.

I’m still trying to design my overall architecture for HA aboard. There’s an obvious path to running something like OpenCPN on a RPi onboard. There’s a lot of active development there, and it’s all set up to integrate navigation functions. In other words, you have chartplotter, anchor alarm, GPS location, AIS, radar, depth, engine monitoring, environment, location tracking and a bunch of other functions there already. Or you can buy an off-the-shelf, ruggedized, waterproof, sunlight-readable MFD which does all this in a single, plug-and-play appliance. Much as I love OpenCPN and tinkering, it’s really hard to justify for something as critical as a primary navigation instrument. Maybe as a backup in the skipper’s cabin for use while off watch.

Then there’s the fun stuff like controlling lighting, cameras, temperature and door sensors, etc. And quasi-critical stuff like monitoring bilge pumps, burglar alarms or remote monitoring. I think this is where a dedicated RPi for HA would be great.

Using a site like MarineTraffic for tracking, by sending simulated AIS data to it, is in the “fun” category, IMHO. It’s useless for navigation because of the latency and the fact that it’s only as good as your WiFi connection to the back-end server. Given that the cost of real AIS transceivers has become reasonable (relative to other boat gear) I really don’t see that as worth the effort. If you’re getting underway near any busy port, AIS is moving into the realm of essential safety equipment nowadays.

I do have an AIS receiver on my VHF, which again will be connected to my Raymarine MFD.

I am separating the two systems, the NMEA network and Raymarine system will be the essential nav system, mostly because of reliability.

But my HA setup will always be active. An anchor alarm would be nice on the HA system though!
I’m also thinking of Y-wiring switches to a relay, so that I can control them by wifi. But I always want the switch panel to override - if it is switched on, wifi can’t switch off etc.

Bilge pump monitoring and remote monitoring/alarm is what I’m aiming for with the RPi/HA setup.

So MarineTraffic - yes’s just a “fun” setup for making it possible to track the boat through 4G/5G, even though it won’t appear for others with an AIS receiver.
AIS transceivers with dedicated antenna here are approx $800, and an autopilot is $1200, so I won’t be prioritizing transmitting AIS just yet.

Agreed, I have a RP3 B+ running HA on board as “Boat Assistant”. Using a Nabu Casa subscription as an inbetween. So I can put on/off my heating system, run my webcam from my bedroom, switch on/off the cabin lights, etc. This i only a start!! IMG_20201018_225638|666x500
Is this fun or so?

The coming season I will have a RPi 4 8G with a Pican-M Hat running the navigational part with OpenPlotter, OpenCPN. In the center the Signal-K server. Jigsawing
The AIS transponder data, GPS data and other will all be handled by the NMEA 2000-Signal K connection. The RPi 4 and the housing comes from Freva: See the shop

The same Raspberry Pi will be the center of Internet. I have a Pepwave BR1 MK2 router with dual sim (KPN unlimited data and T-mobile idem), a MicroTik Groove A 52 ac for wifi connections in harbours and as a backup my good old Huawei ES885SLs-93a with a Vodafone sim card. Redundancy!

I’m still learning. I hope to get the Pepwave doing port forwarding to OpenVPN on the RPi.

2 Likes

Sorry. Wrong picture. Please ignore!

I like the philosophy here. I left some old, but still working, gear alone on its own NMEA 0183 network when I added newer NMEA 2000 stuff. But I also took the opportunity to cross-connect some where it would be helpful. You can never have too much information, or too many ways to access it, at the helm. As long as you remember that looking out the window is more important than all of it.

I think some folks forget this with their home HA setups. Manual control should always be available. As for letting HA override, I might want to be able to shut off some things remotely, but I like the idea of having others that can’t be.

I’m starting to feel that an AIS transceiver is not really a luxury any more if you’re doing any kind of cruising on coastal waters or rivers. They aren’t cheap, but that’s true of so many much less critical boating-related products.

An autopilot is a huge benefit in some waters, not so much in others. But again, the effort to hobble together a DIY autopilot, along with the reliability hit you take, leaves very little justification for the cost differential. Even if you can save a bit with open-source software, you still have a lot of hardware to install.

The HA setup will be on power at all times, but I’m also installing Axon AX-520 for each battery. These are each operated by a dual throw momentary switch, which means that I can easily attach relays to each side, meaning that as long as I can make Home Assistant only momentarily activate the relay, I will be able to turn on/off battery banks remotely, or even automate it based on other conditions (turning on battery or lights when I’m near the boat f.ex.)

I don’t want to mess too much with it though. Lets say the GPS stops working and Home Assistant thinks my phone and the boat are at two different locations, and then automatically switch off the battery banks while being underway…
Weighing convenience and reliability suddenly matters a lot when you’re moving 5 tons at 30 knots.

Very good point. Most boating gear, including chartplotters and AIS, appear grossly overpriced. But when you look at it from a life safety perspective, sometimes you can justify buying reliable, purpose-built hardware.

I’m not familiar with the dual throw momentary switch setup you mention. I understand what a double-throw switch is, and what a momentary switch is, but I don’t get how that would help you swap battery banks remotely. You mention a relay, but of course that would be another power drain, one way or the other. I’ve run boats with battery isolators which separate the banks when the voltage drops below charging voltage, but that doesn’t sound like what you’re after.

These days, solar panels are cheap enough that you should never worry about batteries going flat because of a few electronics left on to monitor the boat. You didn’t mention solar, so I figured I’d throw that in.

To me, the approach should be KISS. Proven, simple, reliable, mechanical components for key functions like bilge pumps and electrical systems. Off-the-shelf components for safety and navigation systems. And have a ball playing with DIY solutions for monitoring, remote control, etc.

AX-520 has a solid state relay/switch, it only needs a tiny amount of power to enable/disable, which is where the momentary switch comes in. It basically means that you can turn on the main breakers from the dash in your boat (or anywhere else you place the buttons).

The relays would be controlled by Home Assistant, only on/off 1-2 seconds, using no power. In other words, they are just mimicking the momentary switches.

The AX-520 uses no power while switched on or off, only a few mA for the actual switching.

Cool! I would have called it bistable switch. But glad to know such a thing exists!