Microphone Please ...

Tuesday, May 29, 2012

code monkey is back!

Its been a long while for an update. New interests in programming again. I picked up a filtrete wifi thermostat about a month ago and I have been tinkering with it ever since. Love this type of device for monitoring the largest energy hog in the house. Its also been fun in that it has allowed me to get back into some light coding using linux shell.


The wifi thermostat allows for monitoring and coding controls to and from the thermostat directly.


My latest venture so far has been some crude scripting to parse my data.


Since my router is always powered on running OpenWrt,



     I run the scripts from the router. I run a crontab, which from the output you can see I have played with diff times to verify it works, so as to monitor any changes. While there are a number of tools out there that will allow you to change via web or devices, I want to monitor and track changes and possibly graph my data.

More on the thermostat itself...


api calls you can make using curl to the router






# My first script
date >> /home/julian/accompare
curl http://192.168.0.196/tstat/datalog > /home/julian/dataloginfo
curl http://192.168.0.196/tstat > /home/julian/tstatcollect
cut -d: -f 1,6,7,8,13,14,15 /home/julian/dataloginfo >> /home/julian/accompare
cut -d\, -f 1,2,3,4,5,6,10,11 /home/julian/tstatcollect >> /home/julian/accompa
re

dataloginfo file

{"today":{"heat_runtime":{"hour":0,"minute":0},"cool_runtime":{"hour":0,"minute
":55}},"yesterday":{"heat_runtime":{"hour":0,"minute":0},"cool_runtime":{"hour"
:10,"minute":52}}}

tstatcollect file

{"temp":76.50,"tmode":2,"fmode":0,"override":0,"hold":0,"t_cool":75.00,"tstate"
:2,"fstate":1,"time":{"day":1,"hour":12,"minute":9},"t_type_post":0}

tstatmin file



Tue May 29 10:10:01 CDT 2012
{"temp":74.50,"tmode":2,"fmode":0,"override":0,"hold":0,"t_cool":75.00,"hour":10,"minute":9}
Tue May 29 11:10:01 CDT 2012
{"temp":75.50,"tmode":2,"fmode":0,"override":0,"hold":0,"t_cool":75.00,"hour":11,"minute":9}
Tue May 29 12:10:01 CDT 2012
{"temp":76.50,"tmode":2,"fmode":0,"override":0,"hold":0,"t_cool":75.00,"hour":12,"minute":9}
Tue May 29 13:00:01 CDT 2012
{"temp":76.00,"tmode":2,"fmode":0,"override":0,"hold":0,"t_cool":75.00,"hour":12,"minute":59}


Ongoing work todo's will be to graph the data and also do a curl against a webpage that can give me my local temp so I can add it to my collections. Perl will give me enough to pull from the data and apply in another format into a web page for viewing online.

Fun fun fun!

Julez.
posted by Jules at 11:04 AM

0 Comments:

Post a Comment

<< Home