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:
A Raspberry Pi to run an instance of Node Red and MQTT: probably a zero W would suffice here plus I have one already.
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.
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.
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.
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.
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.
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).
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.
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.
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)
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