ThermoMan / Thermostat-Tracking

Code to track and chart data from the 3M-50 WiFi enabled thermostat
8 stars 10 forks source link

Display customization #38

Closed Lerrissirrel closed 6 years ago

Lerrissirrel commented 10 years ago

I've been looking for something more to contribute here. I'm happy to take suggestions based on a "todo" list you might have (and would do such a thing first). But one I thought about adding was customizations to the display. Like custom colors, line types, and such. Any thoughts?

ThermoMan commented 10 years ago

At one time I did have a roadmap of planned features. I've not stuck to it very well, but it is here. https://github.com/ThermoMan/Thermostat-Tracking/wiki/Road-Map

For user interface things, I think that there are some nice things done to both sets of charts since the last time any "look and feel" sync was done. For instance the color of the border for run time on the daily is black (gets ugly when tehre are many days showing), but on the history it is a lighter shade of the fill color (I think this looks better)

The two biggest things that I think would help would be

  1. Using that thermostat_id instead of uuid everywhere
  2. Email alerts when things happen (need to add email to user table. Oh I mean need to add user table)

I'm working on an error handler/time out for when the thermostat doesn't respond in the dashboard (I've been having ISP DHCP trouble and my connection flakes out more these days)

For the Nest connection I need a better abstraction layer between the thermostat API and the internal model.

I'm still traveling and won't get back to a stable internet connection for at least a week.

ThermoMan commented 10 years ago

This is only semi-related. But given that there isn't really a community page, this is as good a place to post as any.

http://blog.spark.io/2014/01/17/open-source-thermostat/

ThermoMan commented 10 years ago

The custom colors thing would be cool. I have that one selcetor that changes the web page between those two themes (green and "ice") but it doesn't reach down into the charting object to change it's colors. If there were some sort of theme management object that consisted of both css for the page HTML components and a set of colors for the php components that would be really pretty neat.

So far anything I've done has been saved in cookies in the browser, but connecting these preferences to the user table would let a user have the same preferences regardless of browser used or platform.

As a side note, I have found a strange bug when using Google Chrome on my Android tablet. The date objects do not allow "today". They max out at "yesterday". So even when I do not have an absolute date stored in a cookie and ought to get today, I get at most yesterday.

Some of the HTML 5 features are still in flux and are rendered differently in different browsers. So while I have been specifically avoiding using jQuery, I might want to add a JavaScript parser for date, time, and temperature fields.

Lerrissirrel commented 10 years ago

Hmm, I'll think about how we could do themes that cover all coloring, with a method for building custom themes.

ThermoMan commented 10 years ago

@Lerrissirrel, I found where to add collaborators. It should give you more access to the repo now.

Lerrissirrel commented 10 years ago

Great, thanks ThermoMan. Sadly, my "free" time has dried up recently. Do you happen to know what additional functionality I should have being an official contributor? I didn't notice any new buttons/options around.

Lerrissirrel commented 10 years ago

nevermind, I found some of the additional capabilities, like tagging items and assigning items.

ThermoMan commented 10 years ago

My free time comes and goes too, so I know what you mean there. I just poke the project with a stick when I have some. Other times I just ignore it.

ThermoMan commented 10 years ago

One idea for a display customization is an annual over view and/or a year over year comparison. run times

Here I manually downloaded the data from the run times table and used MS Excel to sum the run times (minutes) per month and then further summarized by hours for presentation.

ThermoMan commented 10 years ago

Having a chart with a pair of lines showing "last year" and "this year" (or ANY two years) so you can compare is a useful thing I think.
If you look at my July 2012 and July 1013 you can see a HUGE difference. 2012 is the year I added insulation (as soon as I saw the run time numbers accumulating)/ Overall 2013 was a hotter year so the Aug and Sept numbers are higher. To put this in scope I need to show average cooling degree days ( http://en.wikipedia.org/wiki/Degree_day )

HVAC units lose efficiency over time and with this kind of chart over the course of a few years I'll be able to tell when my unit needs maintenance and/or replacement.

But it all starts with data visualization. So a new tab similar to the history tab, but with a year-at-a-glance would be a good place to start. I think a two Y-axis chart with total run times and monthly average degree days. With Jan through Dec as the X-Axis showing two series of data. Two single select drop downs that have the years available (from the run times table) in the database as the source for the drop downs. In my case they would offer 2012, 2013, 2014 as choices.

ThermoMan commented 10 years ago

Here is a fun little SQL that I'm embedding in the next version.

SELECT 
t1.date, 
t1.theMonthNumber, 
t1.theMonth
heatHours12, heatHours13, heatHours14,
coolHours12, coolHours13, coolHours14
hdd12, hdd13, hdd14,
cdd12, cdd13, cdd14
FROM
(SELECT 
DATE_FORMAT(rt.date, '%Y-%m') AS date,
DATE_FORMAT(rt.date, '%m') AS theMonthNumber,
DATE_FORMAT(rt.date, '%M') AS theMonth,
ROUND(SUM(IF( DATE_FORMAT(rt.date, '%Y') = '2012', rt.heat_runtime, 0))/60,0) AS heatHours12,
ROUND(SUM(IF( DATE_FORMAT(rt.date, '%Y') = '2013', rt.heat_runtime, 0))/60,0) AS heatHours13,
ROUND(SUM(IF( DATE_FORMAT(rt.date, '%Y') = '2014', rt.heat_runtime, 0))/60,0) AS heatHours14,
ROUND(SUM(IF( DATE_FORMAT(rt.date, '%Y') = '2012', rt.cool_runtime, 0))/60,0) AS coolHours12,
ROUND(SUM(IF( DATE_FORMAT(rt.date, '%Y') = '2013', rt.cool_runtime, 0))/60,0) AS coolHours13,
ROUND(SUM(IF( DATE_FORMAT(rt.date, '%Y') = '2014', rt.cool_runtime, 0))/60,0) AS coolHours14
FROM thermo2__run_times rt
GROUP BY 1, 2, 3) t1,
(SELECT 
DATE_FORMAT(dt.date, '%Y-%m') AS date,
DATE_FORMAT(dt.date, '%m') AS theMonthNumber,
DATE_FORMAT(dt.date, '%M') AS theMonth,
ROUND(SUM(IF( DATE_FORMAT(dt.date, '%Y') = '2012', dt.avgTempHDD, 0)),1) AS hdd12,
ROUND(SUM(IF( DATE_FORMAT(dt.date, '%Y') = '2013', dt.avgTempHDD, 0)),1) AS hdd13,
ROUND(SUM(IF( DATE_FORMAT(dt.date, '%Y') = '2014', dt.avgTempHDD, 0)),1) AS hdd14,
ROUND(SUM(IF( DATE_FORMAT(dt.date, '%Y') = '2012', dt.avgTempCDD, 0)),1) AS cdd12,
ROUND(SUM(IF( DATE_FORMAT(dt.date, '%Y') = '2013', dt.avgTempCDD, 0)),1) AS cdd13,
ROUND(SUM(IF( DATE_FORMAT(dt.date, '%Y') = '2014', dt.avgTempCDD, 0)),1) AS cdd14
FROM (
SELECT date_format(t.date, '%Y-%m-%d') AS date,
IF( AVG(t.outdoor_temp) <= 65, 65 - AVG(t.outdoor_temp), 0 ) AS avgTempHDD,
IF( AVG(t.outdoor_temp) >= 65, AVG(t.outdoor_temp) - 65, 0 ) AS avgTempCDD
FROM thermo2__temperatures t
GROUP BY DATE_FORMAT(date, '%Y-%m-%d') ) dt
GROUP BY 1, 2, 3) t2
WHERE 
    t1.date = t2.date
AND t1.theMonthNumber = t2.theMonthNumber
AND t1.theMonth = t2.theMonth

Having trouble getting ZERO to match on my two sets of data.

tingweil commented 10 years ago

hi @ThermoMan, do you have update on the compare tab? i'm will be interested to see a script that can sum the total run time for each month and able to show it in the history tab. (can chose the interval for daily and monthly) thanks again for your hard work, I wish i have more knowledge for coding to help..

ThermoMan commented 10 years ago

I have let myself get distracted and have not done any changes for a while. But this tab is the thing that has been occupying my thoughts regarding the software. I was thinking of choosing interval (day, week, or month) and then chose the end date for the two to display. So on picking month, it would sum by month and show a year. on picking a week, it would sum by week and show a month (or maybe 3 months), and on sum by day it would show a week or so.

Lerrissirrel commented 10 years ago

One thing I've found (with my electric and gas companies) is that it's very useful to compare as close to "like vs like" as possible. For the monthly display that would mean overlapping by at least a few months (like showing 15 months instead of 12). For the daily one that would probably mean showing something longer than one week. With weekly granularity there isn't really anything to compare to, unless in all of these you allow for comparing against the same period in the prior year?

And I like "I have let myself get distracted." Story of my life :)

ThermoMan commented 10 years ago

Oh, I was meaning two separate charts that overlapped 100% Lets say a month by month chart of the whole of 2010 and the same scale of chart for 2013. So the chart would only be 12 months "long" but there are two data points at each month.

ThermoMan commented 6 years ago

Here's a rough outline of a dashboard idea I've been working on.

dashboard wip

ThermoMan commented 6 years ago

This issue is so tied to v2 that it's stuck. V3 will need new display customizations, but those will be all new issues.