Caravan automation project suggestions

Chaps

Not sure if this is the correct forum section as I haven't completed (or even begun) this project yet but am looking for suggestions and ideas as to how to proceed.

I have a project in mind which involves automating some of the services in my caravan, although it could be applied to boats motor homes and static caravans alike.

I have a similar system controlling my heating and watering systems in my home which works well and is reliable.

Here is what would be required:

  1. A Raspberry Pi to run an instance of Node Red and MQTT: probably a zero W would suffice here plus I have one already.

  2. Sonoff wireless switches to control power to the space heating and water heating systems and monitor the temperatures with their temperature sensors. I can add these to the current setup relatively easily.

  3. A wifi device that would allow communication between Raspberry pi MQTT broker and Sonoff devices (a WiFi router I guess)

I would power everything from the 12 volt system within the caravan using some 12 volt to whatever voltage required for these devices. As the caravan is permanently connected to 230v hookup, battery discharge will not be a problem except when towing on the road which will only be for relatively short periods.

On paper this seems to be all that I need but it seems a bit clunky having all that kit. I would love some way of removing the WiFi router.

Does anyone have any thoughts or suggestions on this idea. Maybe some thing I haven't even considered or have missed.

Thanks chaps.

The Pi should be able to act as a Wi-Fi router without too many problems. Indeed, you could possibly run a simple router off an ESP32! Wouldn't get much performance either way but that shouldn't really be an issue.

I might get burned for being too picky, but lets pretend someone will share their work with you, on this post :grin:

image

Not sure how your heating is controlled, but I know the protocols for my controller (Truma) don't seem to be available, or at least, I have never seen them online. There is a Remote Control interface for Smartphone usage, but it carries quite a price and only available for newer controllers.

Unless you mean you are just switching the Truma controller on and off. But then the Water heating is also a function within the Truma controller.

I do have a Router (GL.iNet Spitz) which also gives me Mobile Broadband/WiFi Repeater with VPN when in range of a mast.

Mr Walker, my caravan is 16 years old so way before the time of fancy Truma controls. So yes I would just be switching the power on and off to the water heater and space heater with the Sonoff devices.

I have been looking into TotallyInformation's suggestion of making the Raspberry Pi 2 W act as a wifi access point thus doing away with a router. Early days yet but will be experimenting next week.

Thanks chaps.

1 Like

I do this with an old android phone (with no SIM card). I installed node-red and mosquitto on the phone (with termux), and enabled the wifi hotspot on the phone. I use Sonoff devices (with Tasmota) to work the heating.
The dashboard is visible on the phone for monitoring and controlling.
By adding a mobile SIM card node-red could publish to an internet accessible MQTT broker, so you could monitor what is going on from anywhere.

If the mains power is always on then would it be easier to use mains powered PSUs to drive everything?

2 Likes

That sounds very interesting Colin. As it happens I've not long acquired a Huawei phone which has a faulty SIM slot so would be ideal for this project. I will investigate termux and have a go at installing node red and Mosequitto.

Thanks

1 Like

See Running on Android : Node-RED, but also Getting started instructions for Android/Termux may be relevant. Let us know if you try it and agree with that post.

What kind of system ist this?
There are solutions for powering a caravan or boat (on-/offgrid, inkl. battery management), where the controller already provides mqtt/modbus communication capabilities and is capable to run Node-Red already. Like with a Victron GX device (either as part of the inverter or additional device).

Thanks for the heads up homindae but would prefer to use stuff I have lying around.

Colin

Have spent most of the weekend trying to get everything running on an Android phone. I installed Termux, installed Mosquitto in Termux, also installed Node red in termux. Spent ages trying to get everything to communicate. but can't seem to get my Sonoff TH16 to connect via MQTT to the Node red instance running on the mobile phone with it's hot spot enabled. I've tried various combinations of addresses in the sonoffs (Tasmota) MQTT setting page. My hot spot is being reported as having an address of 192.168.43.21 when scanned by another phone. The Mosquitto broker on the phone in Temux reports as connected and MQTT nodes in node red indicate they are connected (I've used 127.0.0.1 for their configuration). I just need to know what to input in the MQTT settings in the Sonoff as I've run out of things and addresses to try. I sure it's some thing simple i'm missing but I'm really close.

Cheers

Do you have some other device (eg laptop) that you can connect to the Termux Access Point ? and then a) try to ping that address b) maybe try to run an MQTT client to connect to it. (eg MQTTexplorer) Is there any firewall in the way ? etc

I've just used a spare desktop with a wireless capability, connected to the hot spot created by the Android phone and Pinged 192.168.43.1 and it returned as successful. Great. I have MQTT explorer running on the PC and have tried to discover the MQTT server running in Termux on the Android phone using the address 192.168.43.1 with no success. It's as if the Mosquitto MQTT broker running in Termux is only using 127.0.0.1 and indeed this is reported when firing up Mosquitto in Termux. I think I some how need to get the Mosquitto in Termux to use 192.168.43.1 before it will work correctly, but that's just my guess and clearly I'm no expert.


This is a screen grab of Mosquitto running in Termux


And here is what Fing reports. It clearly shows the Android hot spot and the Sonoff on the same network

By default mosquito only allows local access - you need to edit mosquito.conf (usually in /etc/ but I've no idea where termux expects it) to add listener 1883 0.0.0.0 (and then restart)

Yes, I was wondering that myself. Will try and find info on the conf file location

Just read that you need root access to the phone, so may give up on using an Android phone and go back to using a Raspberry pi 2 W and set up as an access point on that.
Thanks for everyone's input.

I don't believe that is necessary, where did you read that? When I did mine a couple of years ago this is how I did it.
Create a folder .mosquitto
Create a file .mosquitto/mosquitto.conf
In there put

listener 1883
allow_anonymous true
persistence true
autosave_interval 300
persistence_location /data/data/com.termux/files/home/.mosquitto/
log_dest file /data/data/com.termux/files/home/.mosquitto/mosquitto.log

I came across some posts that mentioned it whilst searching. Forgive my ignorance Colin but are those instructions performed in Termux itself?

Yes, in the termux command window, where you ran the commands to install mosquitto and node-red.