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.

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.

1 Like

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.

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.