Temperature Control and Monitoring using

Raspberry Pi and TpLink HS110 Smart Plugs and two 3kW Fan Heaters

If you have any queries or comments, please email rpi@torrens.xyz

At the moment the underfloor heating is on so fan heaters do not come on.

The last changes made in 2018 have been to introduce a change to reduce power used during a session in two ways and to introduce a better form of schedule file

The schedule file now just has a list of start times and session durations instead of a list of times and temperatures. This now means all sessions for a whole year can be in a quite small file. The schedule also specifies the ramp up speed, minimum and maximum temperatures.  To facilitate testing this the script outputs files to check the calculations and list temperatures.

A complete set of files in use March 1st 2019 code version 27 now in use can be downloaded from this link..   In this version have added debug rotating log file to try to detect where the code freezes. Freezing is happening after 3 to 10 days running.  The file generated can be viewed by clicking on debug.html link in above window. 

(The next stage will be to generate the schedule for multiple rooms from a web site booking system. This would allow rooms to be booked and then the heating to be automatically brought on at the right time.  Also it is intended to put the profiles for rooms in a separate file from the list of session times and lengths.).

The Raspberry Pi Python 3 code used in this project has the following features:

Every Cycle five "three wire" temperature sensors are scanned, and data logged from them, if new sensors were connected then they would automatically be included.  (Currently five sensors are connected in parallel, but it is possible to use far more).
A CSV file is generated with sensor codes, names, locations etc which can be edited for the next program run so that sensor names can be added.

       (CSV files also generated for testing the new temperature scheduling and profile).

A CSV file, config.csv is used to set up program parameters.

FTP is used to send files to this website.

Every Cycle the following files are generated:

An HTML File To display status on web site (See Below)
An HTML File showing Recent Program Status (Status.html) linked to from page below.
An HTML File showing all recent Logged data, (log.html) linked to from page below

Every few cycles a CSV file is updated with logged data also linked to from the page below.  This shows all data logged since program started.
This CSV file can be opened by Excel so that data can be analysed.

Each cycle two TPLink type HS110 Smartplugs are commanded on or off based on current target temperature and their status and power use logged.

After a power failure the software is restarted automatically by editing "rc.local" in "/etc" and using a command that uses "tmux"

This system is controlling the heating in the Whitchurch Shed. ( www.whitchurchmeninsheds.uk ).

Fan Heaters are controlled by TPLink Smart Plugs which in turn are controlled over Wi Fi by the R Pi (Raspberry Pi)

A combination of www.dataplicity.com and "tmux" (  github.com/tmux/tmux/wiki ) and "cloudcmd" ( is used to allow the Python 3 to be monitored stopped, started and edited from anywhere. (docs.dataplicity.com/docs/share-files-with-wormhole ) [ see also My Cheat Sheet ]

(The same software is used to provide more accurate control of a Sauna Heater.  This mode is one of the start-up options. This application has not yet been tested with this version of the software)


If you have any queries or comments, please email rpi@torrens.xyz .