My thermostat went a couple of years back. Originally I used a couple of Arduinos connected by radio link to control the AC. One to sense the temperature, and one to control the AC unit. This worked OK, but I wanted to expand the temperature sensing to all rooms, so they could be automatically controlled. I made a prototype battery powered arduino based unit, but then various factors made me change tack:
- Similar WiFi and Bluetooth units are now available off the shelf
- Aesthetic packaging of custom arduino projects is a problem
- This solution is difficult to maintain and upgrade, e.g.
a. What happens if I succumb to Covid-19?
b. If I want to change the code, I need to reflash the arduino and it is difficult to debug
My desired outcomes were:
- Have something that was easy to maintain and upgrade
- Use off the shelf hardware as much as possible (for reasons for requirement 1).
- Aesthetic packaging of long lasting battery operated sensors in each room, which then meant that each room could be separately controlled.
Given all this I decided to follow an IoT methodology
- Initially I tried using Hassio, but that proved to be quite a hassle. There seems to be a number of ways to implement this, and when trying to sort things out I couldn’t sort out which system the websites I ended up visiting were talking about, and ended up in a mess.
- The system I ended up using uses:
a. Unmodified Sonoff 4 channel devices for the output. I know purists will not like this, as I am dependent on eWelink, and I might get round to flashing the Sonoffs sometime, but it does mean it is easy to maintain. These have proved to have a problem with receiving too many instructions at once, so my code will only send 1 command per 5 seconds to any one device. This has proved to be reliable, but I also have background code that checks my outputs are what they should be, just to make sure.
b. Xiaomi BLE (LYWSD03MMC) temperature and humidity sensors. I did originally try using a Sonoff sensor, connected via IFTTT, which then emailed node-red to control the AC, but that proved unreliable. These seem to do the job well. I am adding code to monitor how long since I got a reading from them, and to alarm if it is too long. I also want to add code to monitor the battery voltage and alarm if it is getting too low.
c. An old Windows XP netbook now running Linux Mint as the server. This is as slow as a wet week when using it locally, but as a node-red server, accessed via SSH, it works well. I have a BLE dongle plugged into a USB port to talk to the sensors. Initially I thought I would use this as a photo frame screensaver, which would then show the GUI if touched, but it just doesn’t have enough grunt to do that. Using the GUI on our mobile phones works well, so that is all we need.
d. To talk to the Xiaomi devices, I use a bash script running on the server, which is then called by node-red functions and returns the relevant values. I looked at various node-red BLE nodes, but none seemed to be able to talk to the LYWSD03MMC device. I found a bash script which did so, and modified that to suit my purpose, adding battery voltage. I am going to have to do more mods to this to cope with using subflows.
- I have implemented the system this weekend, and it has been working well apart from some specific issues:
a. When deploying, the stored username and password for the eWelink gets lost or garbled and I have to reset that (not difficult, but annoying)
b. Occasionally when deploying, the bash script stops working properly for certain sensors. Redeploying can clear this problem.
Any suggestions welcome.