Caravan automation project suggestions

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


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?


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.


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.


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 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 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.


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 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 with no success. It's as if the Mosquitto MQTT broker running in Termux is only using 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 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 (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.

Ok on typing in:
$ mkdir .mosquitto replies - cannot create directory .mosquitto: read only file system

I tried:
$ ls replies - cannot open directory : permission denied

It doesn't seem to like any Linux style commands

Are you doing this on the phone? Looking back at my notes I use ssh to connect to it and was able to do everything from my laptop.

cd /data/data/com.termux/files/home
to see if that gets you do the right place.