3M-50 Wi-FI Thermostat: UPDATE

Original post here:

http://moderntoil.com/?p=325

Click HERE for the CT50, and HERE for the CT80.

This arrived last week, and it’s everything I hoped for, plus more.  VERY programmable via back-end JSON interface.  Of course, I’m old-skool and stubborn so I wrote a whole web-app in bash to control it :)

Here’s what my interface looks like:

Click it for a full size version.

The outside temp/humidity is polled via weather underground (XML feed), and the graph is gen’d by cacti.  I already use cacti for tons of other stuff, so it was only natural to use it for data collection here.   The red vertical on the graph represents the periods my furnace runs.  The rest of the legend it pretty obvious if you look at the full size snap.

If you’re even remotely THINKING of getting an ip-enabled thermostat, get one of these, they rock.

For those that don’t want to write their own app to control it, it can communicate directly to radio thermostat’s website and you can control it from there.  I just don’t like the idea of my thermostat taking orders from someplace else, so I wrote my own :)

There’s good documentation of the API here:

http://central.isaroach.com/wiki/index.php/Main_Page

  • Stephen

    March 28th, 2011

    I’d like to see how you’re building web-interfaces with BASH sometime. I’d love it if you would send me a bundle o’ code to peruse.

  • Rich

    March 31st, 2011

    It’s all kinds of ugly :P

    I have a script that uses curl to pull the JSON response into a single var, then extracts the vars I need by field position using cut.

    Since the thermostat is wireless and a little slow to respond (all embedded tech), I poll it once a min and store the vars for viewing the status

    For changing values, I pass the vars via a GET to another script and use curl -d to post the JSON to the thermostat, and then poll the new vars live to build the page with the new vars when a change is made.

    For example, here’s the script to change the temp (called from the status page):

    #!/bin/sh
    echo “Content-type: text/html”
    echo

    temp_to_set=$(echo $QUERY_STRING | cut -f2 -d= | cut -d. -f1)

    curl -A bogus -d {‘”t_heat”‘:$temp_to_set} http://thermostat-01.int.netmagi.com/tstat > /dev/null

    ./build_page_live

    It reads the new temp from the GET, and then calls the script to build the page afterwards.

  • Rene

    December 2nd, 2011

    Nice, is that something you would share ? I would love to use this with my radiothermostat!

    regards,

  • Rich

    December 3rd, 2011

    I’d like to share it, and several people have asked for it, but it’s a mess at present intertwined with a bunch of other scripts I’ve written for monitoring for gathering data.

    I *do* plan on separating it out and posting something on here when I have the time.

  • Ilya

    February 3rd, 2012

    Hi, I’ve also been playing the 3m50 and also don’t like the idea of a remote site controlling my thermostat, gathering all the usage data etc. So I’ve been writing a program in C to control it. However one thing that is missing from the public API is any information about authentication. If I open a port on my router to control it from the outside of my LAN I’d want to use some kind of authentication.. Do you have any idea how to do that?

  • Rich

    March 20th, 2012

    For securing something like this, you generally want to expose your app, not the device. You would authenticate to your app, and your app would proxy commands to the thermostat. If your app runs on IIS, Apache or something similar you can use built in auth, otherwise build simple auth into the app itself. Good luck and happy coding!

    -Rich

  • Paul

    August 22nd, 2012

    Is it possible to get a copy of the software you have built to log the information, and will it do two 3M50’s?

  • Rich

    September 10th, 2012

    I previously wrote everything to only accommodate heating since I had no central air where I lived. I moved, and just recently re-wrote to accommodate heating and cooling, but the data collection is done through a separate set of scripts that pull some other info from other devices as well (like APC UPS for other zone temp, some web scrapes for weather underground, etc.) Graphs are all done through cacti. I could share it as-is, but the requirements would be:

    - Box to run data collection crontabs, and cgi for web interface
    - Cacti

    -Rich

  • Mark

    August 25th, 2013

    I’ll add my request to see your scripts! Even if they’re ugly, I’d love to see the code you’ve used to build the interface. I’m comfortable interfacing with the thermostat, but would love to see some example code on building the display/graphs!

  • Chris

    December 26th, 2013

    I was looking for a simple web interface for my 3m50 and I always landed on your website, simply because your interface is for me the best one on the web. I would really like to encourage you to publish your code. I believe there a loads of people out there who are looking for a simple, beautyful interface to manage their thermostats.

    To shorten the time waiting for your code, I wrote a few old school bash cgi line myself. This code reads and sets the target temperature in Celsius:

    #!/bin/bash

    THERMURL=’http://192.168.144.136/tstat’

    if [ $# != 0 ]
    then
    QTEMP=$*
    CCTEMP=$(echo “scale=2;(((9/5)*$QTEMP)+32)+.5″|bc)
    CTEMP=$(echo “scale=0;$CCTEMP-($CCTEMP % .5)”|bc)
    curl –silent -d ‘{“tmode”:1,”t_heat”:’$CTEMP’,”hold”:1}’ $THERMURL;
    fi

    STR=`curl http://192.168.144.136/tstat`
    THEAT=`echo $STR | sed -e ’s/.*t_heat”:\([0-9]*\).*/\1/’`

    AATEMP=$(echo “scale=2;((5/9)*($THEAT-32))+.5″|bc)
    ATEMP=$(echo “scale=0;$AATEMP-($AATEMP % .5)”|bc)

    echo Content-type: text/html
    echo “”

    /bin/cat << EOM

    Thermostatsteuerung

    Aktuelle Zieltemperatur:
    EOM
    echo $ATEMP
    /bin/cat << EOM
    Grad

    EOM

    It is “quick code” but it works.

    The Celsius part is perhaps something to integrate in your scripts?

    Greetinx from Munich …

    Chris

  • Joe

    December 20th, 2014

    http://central.isaroach.com/wiki/index.php/Main_Page

    Is unavailable. How can I get the document?

    Thanks

  • Rick

    August 20th, 2015

    Necropost I know, but the API docs are posted by the manufacture now if anyone is looking for them. These thermostats are awesome, and the -80 version direct from Radio Thermostat has even more options.

    https://radiothermostat.desk.com/customer/portal/articles/1268461-where-do-i-find-information-about-the-wifi-api (see the attachment at the bottom)