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

Hi!
I’m a returning HA user, as my home installation was replaced with Athom Homey.
I’d however like to extend my “home automation” to my boat, and use RPi with HA for that purpose.

I was thinking of just routing all info to my home directly, but it might be better to have HA running in the boat, receiving local MQTT sensor data from various sensors I’ll make, and then publish MQTT signals from RPi which can be picked up from Homey.

I’m not exactly sure how I want to do things, but this seems to be the better way to do it. That way even if I run out of data (4G) I can still log everything to HA. I might also be able to publish MQTT less frequently than receiving from sensors etc.

But regarding that - what would be best for securing the setup? For me it makes sense to use VPN rather than port forwarding for increased security. I’m not really using VPN for anything else at home right now, everything is shut. So I was thinking; maybe the VPN server should be in the boat rather than at home? Thoughts?

I have a QNAP NAS at home which might otherwise act as a VPN-server (QVPN or an LXC maybe) and have VPN-client on the boat.

I need it to connect automatically I guess so I’m sure I receive those MQTT packages to my home, and send signals back to the boat (it will mostly be temperature/battery monitoring).

Anyone who can help push me in the right direction here?

Also - Would a Pi Zero W be sufficient? Otherwise I do have some RPi 2 and 3 laying around.

3 Likes

I would seriously consider not to use 4G and take a look at LORA

I have not integrated LORA devices into HA yet, but I have worked with it before in other projects

edit: nevermind, I don’t think you can connect 2 HA’s through Lora yet…

The recommendations are for a pi 2 at the minimum, though probably best with a pi 3.
How do you use your boat ?
Is it tied up at the bottom of your garden, is it on a trailer in your drive, is it in a marina at the end of your street or across town. Does it have mainspower when in Dock ?
With 4G you’ll be buying it it’s own phone (well a 4G modem) and what sort of contract ?
Why not have the installation as a stand alone HA with its own duckdns.?
That way you could sell it as a smart boat
It could send you (your phone) smart notifications (battery is below 30%, I’m sinking etc.)
So you then look at https://myboat.duckdns.org to view your bobbing realm.

Edit: Seriously ? Someone clicked on the above fictitious link ??? :rofl:

AND: are you always in a cellular network area ? or if you are in the boat and out of the area, do you care ?
Having it’s own instance will be a lot more ‘data lean’ than having to constantly update your other instance on a change in wind speed etc.

2 Likes

LMAO… That conjures up images of the Wicked Witch from The Wizard of Oz. “I’m melting! I’m melting!!!”

Yes, I am experimenting with LORA as well. Unfortunately there isn’t a lot of gateways in our city, and none near the marina. I’m trying to get a couple of friends to set up a gateway, as they would almost triple the coverage compared to the current situation.

OK, I’ll see what I have laying around. I think I have both Pi2 and Pi3, and my other current “project” is Octoprint/Astroprint which will need one, hopefully Pi2 will be enough there.

It’s at the marina across town, always connected to shore power. I have a 12V/230V 4G modem I got for free, and a 1GB data subscription that is also free. So atm I’m not paying anything for it.
Yes - One idea is to have the boat as a standalone “smart-boat”, use HA etc, but have it connect to my home through VPN so I can send MQTT messages to Athom Homey/Mosquitto. This is so I can interact with my home directly from the boat sensors.

Or would “Boat -> IFTTT -> Homey” be a better solution, keeping them fully separate, and use web hooks or whatever possible connection through IFTTT. At least that way they’re not connected directly to each other, and I can skip VPN etc.

The idea wasn’t a constant update to my home, but an own instance in the boat updating as often as possible (to itself) and then sending maybe an hourly update to my home (except warnings)

But yes - I’d like voltage monitoring, water level monitoring (if it keeps being high, something’s wrong with the bilge pumps). It might as you said be better to just separate them, and use IFTTT or similar to update f.ex. temperature in the boat so I can view it on the same dashboard at home. I have a normal wall heater connected to 230V mains in the boat, which I’ll be using a sonoff-device (or similar wifi enabled device) to switch on/off, so I can increase the temperature a few hours before I’m heading to the boat.

I will mostly be in a cell network area, the coverage is excellent around here. If I would lose connection will being out, it’s not a big deal.
I might be adding an IP-camera as well, but to begin with I’m testing TP-Link C200 with its own app.

I like the idea having HA on board. Keeping an eye on systems, controlling
the heating system, etcetera.

Anybody else with experience in that direction?

Jaap

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.