Jump to content

How To: Filtrete 3m-50 wifi thermostat basic program


TJF1960

Recommended Posts

Here is a script I have modified to retrieve data from the thermostat and send the data to variables in the ISY. First I would like to thank 87squirrels for his code for the tstat (http://forum.universal-devices.com/viewtopic.php?f=68&t=6009&p=50006&hilit=filtrete#p50006). This modified script will only retrieve data and send variable updates to ISY. It will not change set points etc. on the tstat. Those can be changed via Network Resources in the ISY itself.

 

This code works on the PogoPlug which is Linux based, so it probably will work on other similar units. It will retrieve the data from the tstat and send the updates to the ISY every two minutes. After the initial data is loaded only changes in the data will get sent to the ISY to save on resources.

 

Here is the disclaimer: I am not a programmer or coder....as such there are probably a lot of things that could be changed to improve the script. If anyone has constructive criticism or suggestions they are welcome.

 

Look thru the script for # and change the following line(s) as needed. I would suggest following the tstat API for a description of terms etc. http://central.isaroach.com/wiki/index.php/Tstat_APIs

 

#!/bin/bash

#Change this next line to your 3M-50 IP address
var_tstat="http://xxx.xxx.x.xxx/tstat"

#Change this next line Name Password to the user name and password for your ISY
var_wgt="/usr/bin/wget -q -O /dev/null --http-user=admin --http-password=admin"

#Change the IP address to your ISY IP address
var_ISY="http://xxx.xxx.x.xxx/rest/vars/set"

#This next line gets the current time provided by Pogoplug and parses it for a usuable number for ISY variables
TIME=`date | cut -c12-19`
var_hb="$(echo "$TIME" | sed "s/[^0-9]//g" | sed 's/0*//')"

STR=`/usr/bin/wget -q $var_tstat -O -`

TEMP=`echo $STR | sed -e 's/.*temp":\([0-9]*\).*/\1/'`
TMODE=`echo $STR | sed -e 's/.*tmode":\([0-9]*\).*/\1/'`
FMODE=`echo $STR | sed -e 's/.*fmode":\([0-9]*\).*/\1/'`
OVERRIDE=`echo $STR | sed -e 's/.*override":\([0-9]*\).*/\1/'`
HOLD=`echo $STR | sed -e 's/.*hold":\([0-9]*\).*/\1/'`
THEAT=`echo $STR | sed -e 's/.*t_heat":\([0-9]*\).*/\1/'`
TCOOL=`echo $STR | sed -e 's/.*t_cool":\([0-9]*\).*/\1/'`
TSTATE=`echo $STR | sed -e 's/.*tstate":\([0-9]*\).*/\1/'`
FSTATE=`echo $STR | sed -e 's/.*fstate":\([0-9]*\).*/\1/'`

#Change the following numbers to match your variable numbers in ISY. ex $var_ISY/2/160/$TEMP change 160 to match which variable you choose for Temp.
$var_wgt $var_ISY/2/160/$TEMP $var_ISY/2/161/$TMODE $var_ISY/2/162/$FMODE $var_ISY/2/163/$OVERRIDE $var_ISY/2/164/$HOLD \
$var_ISY/2/165/0 $var_ISY/2/166/0 $var_ISY/2/165/$THEAT $var_ISY/2/166/$TCOOL $var_ISY/2/167/$TSTATE \
$var_ISY/2/168/$FSTATE $var_ISY/2/169/$var_hb

#This puts the program to sleep for 2 minutes then continues on below.
sleep 120s

while true
do

TIME=`date | cut -c12-19`
data="$var_wgt "
var_hb="$(echo "$TIME" | sed "s/[^0-9]//g" | sed 's/0*//')"

TEMPOLD=$TEMP
TMODEOLD=$TMODE
FMODEOLD=$FMODE
OVERRIDEOLD=$OVERRIDE
HOLDOLD=$HOLD
THEATOLD=$THEAT
TCOOLOLD=$TCOOL
TSTATEOLD=$TSTATE
FSTATEOLD=$FSTATE

STR=`/usr/bin/wget -q $var_tstat -O -`
TEMP=`echo $STR | sed -e 's/.*temp":\([0-9]*\).*/\1/'`
TMODE=`echo $STR | sed -e 's/.*tmode":\([0-9]*\).*/\1/'`
FMODE=`echo $STR | sed -e 's/.*fmode":\([0-9]*\).*/\1/'`
OVERRIDE=`echo $STR | sed -e 's/.*override":\([0-9]*\).*/\1/'`
HOLD=`echo $STR | sed -e 's/.*hold":\([0-9]*\).*/\1/'`
THEAT=`echo $STR | sed -e 's/.*t_heat":\([0-9]*\).*/\1/'`
TCOOL=`echo $STR | sed -e 's/.*t_cool":\([0-9]*\).*/\1/'`
TSTATE=`echo $STR | sed -e 's/.*tstate":\([0-9]*\).*/\1/'`
FSTATE=`echo $STR | sed -e 's/.*fstate":\([0-9]*\).*/\1/'`

#Change the numbers below like you did above to match your ISY variables.
if [ "$TEMP" != "$TEMPOLD" ]; then
data="$data $var_ISY/2/160/$TEMP"
fi
if [ "$TMODE" != "$TMODEOLD" ]; then
data="$data $var_ISY/2/161/$TMODE"
fi
if [ "$FMODE" != "$FMODEOLD" ]; then
data="$data $var_ISY/2/162/$FMODE"
fi
if [ "$OVERRIDE" != "$OVERRIDEOLD" ]; then
data="$data $var_ISY/2/163/$OVERRIDE"
fi
if [ "$HOLD" != "$HOLDOLD" ]; then
data="$data $var_ISY/2/164/$HOLD"
fi
if [[ "$STR" =~ "t_heat" ]] && [[ "$THEAT" != "$THEATOLD" ]]; then
data="$data $var_ISY/2/165/$THEAT $var_ISY/2/166/0"
fi
if [[ "$STR" =~ "t_cool" ]] && [[ "$TCOOL" != "$TCOOLOLD" ]]; then
data="$data $var_ISY/2/166/$TCOOL $var_ISY/2/165/0"
fi
if [ "$TSTATE" != "$TSTATEOLD" ]; then
data="$data $var_ISY/2/167/$TSTATE"
fi
if [ "$FSTATE" != "$FSTATEOLD" ]; then
data="$data $var_ISY/2/168/$FSTATE"
fi
data="$data $var_ISY/2/169/$var_hb"

$data

sleep 120s
done

 

Good luck!

Tim

Link to comment
  • 2 months later...

I would love to add some reasonably priced automated thermostats and this seems like a great way to do it.

 

I just ordered a dd-wrt router to experiment with the Mac id proximity detection discussed in other threads, but haven't had the chance to play with the scipting on it yet. Can anyone tell me if this script can be implemented by a dd-wrt router (instead of the pogo plug)?

Thanks.

Link to comment

Archived

This topic is now archived and is closed to further replies.


  • Recently Browsing

    • No registered users viewing this page.
  • Forum Statistics

    • Total Topics
      36.9k
    • Total Posts
      370.3k
×
×
  • Create New...