1
0
mirror of https://github.com/beestat/app.git synced 2026-04-14 04:51:38 -04:00
beestat/js/beestat/ecobee.js
2020-01-31 20:00:01 -05:00

26 lines
738 B
JavaScript

beestat.ecobee = {};
/**
* Check to see if ecobee is down. If so, render the footer component.
*/
beestat.ecobee.notify_if_down = function() {
if (
beestat.cache !== undefined &&
beestat.cache.thermostat !== undefined &&
beestat.user.get() !== undefined
) {
var last_update = moment.utc(beestat.user.get().sync_status.thermostat);
var down = last_update.isBefore(moment().subtract(15, 'minutes'));
if (beestat.ecobee.down_notification_ === undefined) {
beestat.ecobee.down_notification_ = new beestat.component.down_notification();
}
if (down === true) {
beestat.ecobee.down_notification_.render($('body'));
} else {
beestat.ecobee.down_notification_.dispose();
}
}
};