Radio Thermstat Web Interface Radio Thermostat CT-50, CT80, 3M50, CT-30
- JW Smythe https://jwsmythe.com jwsmythe[at]jwsmythe.com
v1.2 2023.10.12 - Changed temp jog buttons to slider.
Set hold mode on temp change.
Changes to tstat_main.html and tstst_scheduler.php to
validate HTML successfully.
v1.1 2023.09.29 - Finished mode/fan buttons. Added new graphing. Bugfixes.
v1.0 2023.08.23 - First release
This is shared under the non-commercial Creative Commons CC BY-SA. You may use and share this code for non-commercial purposes. If you're going to roll it into a product, please contact me for licensing first.
===== About =================================================================
This project is to provide a web interface for the Radio Thermostat CT-30, CT-50, CT80, and 3M50 thermostats.
As of May 15, 2023, the official Radio Thermostat web app is being discontinued. With this, we all lost the web interface, history logging, etc, that their site provided. This project is to give you that same functionality. I did ask them for the site code, so I could match their old look and feel. They declined. So this is all new code.
It project provides:
- Web interface that you can place on a local server.
- Ability to set the temp
- Ability to set the schedule
- Ability to change HVAC mode and fan mode
- Display of current information.
- MRTG graphing of the current temperature and target temperature
- MQTT publish current temperature for other MQTT nodes to use.
===== Requirements ==========================================================
-
One of the supported Radio Thermstat thermostats: Radio Thermostat CT-30, CT-50, CT80, and 3M50
-
A web server that supports PHP, that is on the same network.
A RPi or similar would be more than sufficient. Even an old desktop PC running Linux would be fine.PHP will require CURL and SQLite3, but those should be standard.
-
phpMQTT for the MQTT publish function if so desired.
https://github.com/bluerhinos/phpMQTT -
MRTG installed on host, if you want graphing.
-
Cron or similar scheduler, if you want graphing to work.
===== Files =================================================================
mrtg.thermostat.conf - MRTG configuration file, for temp/target graph
phpMQTT.php - MQTT library from https://github.com/bluerhinos/phpMQTT
tstat_api_gw.php - PHP to send API requests directly to the thermostat
tstat_gloabls.php - Global variables used by the PHP files.
tstat_info.php - A dump of all the API calls supported by the thermostat.
This is slow, but is only used for developing new features.
tstat_main.html - The main page. You should copy this to index.html
tstat_multi.php - Display of graphs for day/week/month/year
tstat_poll.php - This is run by the cron to update thermostat data,
generate MRTG graphs, push info out to MQTT, etc.
tstat_rebuild_db.php - Rebuild the SQLite DB from the CSV file(s). You
shouldn't ever need this, unless the DB gets corrupted.
tstat_scheduler.php - Editor for the thermostat scheduler.
tstat_temp_graph.php - This generates the graphs for display, from the DB.
./docs/ - This directory contains the user manual for the
Radio Thermostat CT-50, CT80, 3M50, and CT-30, as
well as the API doc that I found a while back.
If there is a more recent version of the API doc,
I would appreciate getting a copy.
./images/ - Some images for the web interface
./data/ - MRTG data
===== Installation ==========================================================
- Copy the files for this package to a directory on your local web server.
The web server must be on the same network segment. These thermostats do not have ANY security to them. There is no authentication for API calls. Do NOT ever put this thermostat directly facing the Internet.
I installed it on my custom firewall (Linux server), on the web interface that is only accessible by the LAN. (bound to 192.168.1.0:80 :443, not 0.0.0.0:80 :433)
-
Modify the tstat_globals.php file to match your installation.
-
Browse to it, and see that it works.
-
Set the crons (below) as necessary for automated tasks. The scheduler itself runs automatically on the thermostat. There is nothing more to do for that.
-
You may want to symlink tstat_main.html to index.html, if you don't have anything else in the folder.
===== Cron ==================================================================
To get the graphing, we need to poll the thermostat at regular intervals, and record the data in the csv, db, or optionally mrtg and mqtt.
This is in the standard Linux/Unix cron format. Fix your paths for your machine's paths. If you are running this on a Windows machine, you'll need to make the appropriate entry in Task Scheduler.
You can set the interval to anything you want. More frequent polling gives better resolution on your graphs. 5 minutes (/5) is what many people use. 1 minute (/1) seems to overload the thermostat on occasion, so I don't recommend 1 minute.
*/2 * * * * /usr/local/bin/php /var/www/htdocs/thermostat/tstat_poll.php >> /var/log/thermostat_cron.log 2>&1
===== Usage =================================================================
-
tstat_main.html
This is the main menu. It's used the same way you'd use the thermostat. * Select the operational mode with the buttons on the left. * Select the fan mode with the buttons on the right. * You can use the up/down buttons to jog the temperature by 1 degree. It's slow and tempermental. We're sending the commands correctly, it's totally to do with how the thermostat works-
1 day and 7 day graphs are the usage history.
- Blue line is the actual temperature at each sample.
- Red line is the commanded temperature. What it should be.
- The orange lines can be in one of three positions.
- No line means no sample was taken from the thermostat for some reason.
- Half a line means the unit was cycled off.
- Full line means the unit was cycled on. Ideally, you will see the unit cycled on for 10 to 15 minutes, and then cycled off for the same amount of time. That's a 50% duty cycle, and is ideal to keep the humidity at a reasonable level.
-
The bottom box has information.
- The date, model, and name collected from the thermostat. If the date is wrong, it should be corrected when you reload the page. We auto-send a date/time update from this web client. My thermostat resets to noon if the thermostat is reset, so this is important in getting it on schedule.
- The first line of links take you to the various sections.
- The second line of links pull more info from the thermostat, and may be interesting to you. The API info is a full dump of all of the information available via the API.
- Everything under "Manufacturer Documentation" is all the docs I have found related to these thermstats. If you have more documentation, please share, and I'll add it to this repo!
-
-
tstat_scheduler.php
This is the most complex part of this software. It's in roughly the same format as RTCOA's web interface had. This is all loaded directly to the thermostat, this web UI doesn't control the thermostat. Once you save it, you could shut down the web server, and it will keep working. * This page is slow to load and update, because it has to read and write all the information to the thermostat. There's no way to make it faster, sorry. * There are 4 slots per day. You can set the time each happens, and the desired temperature to set. * It holds 7 days of settings, Mon through Sun. This reflects the internal ordering. * There are two schedules, one for heat, and one for cool. * You can tab between fields, so you don't have to mouse click each one.My schedule is set to work well with my electric company's peak rate scheduling. Use my schedule as an example. I will explain it to you. I want the AC to run when power is cheap, and let the house warm up when the power is expensive.
-
6am, the thermostat goes up to 70 degrees, to prepare us to wake up in the morning.
-
11am is the beginning of peak power rates, so I set the thermostat to 78 degrees. You can see it takes about 5 hours for the house to warm up. After that, the AC cycles on and off to maintain 78 degrees.
-
8pm power starts being cheap again. 71 is comfortable for us.
-
11pm we let the AC cool the house down, to prepare for tomorrow's cycle.
-
-
tstat_multi.php
This page is entirely graphs generated from the collected data. It can help you figure out how to schedule your thermostat better, or if there is some operational problem to address (i.e., dirty filter).
===== Security ==========
This is not intended to be Internet facing. If you do, please be sure to use an appropriate htaccess, with both password protection, and restrictions to only allowing your own IP. If you don't, people will find it, and they will set your thermostat to crazy extremes that will run your power bill up, and potentially risk fire. I'd prefer my heater doesn't turn on to 90F+ in the middle of summer.
===== Bugs / To Do ==========
These are things that should be fixed, but haven't been yet. If you would like to fix them and submit the changes, I'll happily add them, and credit you for your contributions.
If you find any bugs in the code, feel free to file them as issues, and I will fix them. Send them via the issues tab on Github, or email me directly at jwsmythe[at]jwsmythe.com.
-
The pages don't scale well on mobile devices.
-
Investigate setting a hold mode to disable schedule. This might improve the manual temp setting.
-
Make the UI pretty, with a consistent header and footer. I know it's ugly.
-
Look at enabling dehumidifier mode. This requires a CT-80 Rev B thermostat, which I don't have.
-
Build a cloud interface. Make it a public service on a new domain. No documentation is available, but you can change the cloud URL from the AdHoc setup, and running direct web page. It should be doable. That might be a destructive process. I only have one thermostat, and it is in use. A donated thermostat would be lovely.
-
I recognize that I might be the only person still using this thermostat, so all this work may only ever be for me. If you use it, or if it's useful, please let me know. I'll put more effort in if there is actually an audience.
===== Credits ================================================================
- JWSmythe https://jwsmythe.com - All the code, unless otherwise noted.
- BlueRhinos http://www.bluerhinos.co.uk - phpMQTT library.
- Radio Thermstat Company of America https://www.radiothermostat.com/ - API documents, and user manuals.