1
0
mirror of https://github.com/beestat/app.git synced 2025-05-23 18:04:14 -04:00

Added system off time to thermostat detail

This commit is contained in:
Jon Ziebell 2024-06-14 22:23:27 -04:00
parent c7fbefcf2e
commit c015f634eb
3 changed files with 74 additions and 1 deletions

View File

@ -82,6 +82,7 @@ beestat.runtime_thermostat.get_data = function(thermostat_id, range, key) {
'dehumidifier',
'ventilator',
'economizer',
'off_heat_cool',
'dummy'
].forEach(function(series_code) {
data.series[series_code] = [];
@ -383,6 +384,54 @@ beestat.runtime_thermostat.get_data = function(thermostat_id, range, key) {
durations.economizer = {'seconds': 0};
}
// System off duration
if (
durations.off_heat_cool.seconds === 0 &&
(
runtime_thermostat.compressor_1 < 300 &&
runtime_thermostat.compressor_2 < 300 &&
runtime_thermostat.auxiliary_heat_1 < 300 &&
runtime_thermostat.auxiliary_heat_2 < 300 &&
runtime_thermostat.fan < 300
)
) {
// If currently running and it stops.
durations.off_heat_cool = {
'seconds': 300 - Math.max(
runtime_thermostat.compressor_1,
runtime_thermostat.compressor_2,
runtime_thermostat.auxiliary_heat_1,
runtime_thermostat.auxiliary_heat_2
)
};
} else if (
durations.off_heat_cool.seconds > 0 &&
(
runtime_thermostat.compressor_1 > 0 ||
runtime_thermostat.compressor_2 > 0 ||
runtime_thermostat.auxiliary_heat_1 > 0 ||
runtime_thermostat.auxiliary_heat_2 > 0
)
) {
// If not currently running and it starts
durations.off_heat_cool.seconds +=
Math.max(
runtime_thermostat.compressor_1,
runtime_thermostat.compressor_2,
runtime_thermostat.auxiliary_heat_1,
runtime_thermostat.auxiliary_heat_2
);
durations.off_heat_cool = {'seconds': 0};
} else if (
durations.off_heat_cool.seconds > 0
) {
// If not currently running
durations.off_heat_cool.seconds += 300;
}
data.metadata.series.off_heat_cool.durations[current_m.valueOf()] = durations.off_heat_cool;
// Equipment
[
'fan',
@ -505,6 +554,7 @@ beestat.runtime_thermostat.get_data = function(thermostat_id, range, key) {
data.series.dehumidifier.push(null);
data.series.ventilator.push(null);
data.series.economizer.push(null);
data.series.off_heat_cool.push(null);
}
current_m.add(5, 'minute');

View File

@ -154,6 +154,11 @@ beestat.series.fan = {
'color': beestat.style.color.gray.base
};
beestat.series.off_heat_cool = {
'name': 'System Off',
'color': beestat.style.color.gray.base
};
beestat.series.humidifier = {
'name': 'Humidifier',
'color': beestat.style.color.gray.light

View File

@ -179,7 +179,8 @@ beestat.component.chart.runtime_thermostat_detail_temperature.prototype.get_opti
var groups = {
'mode': [],
'data': [],
'equipment': []
'equipment': [],
'off': []
};
var visible_series = [];
@ -378,6 +379,19 @@ beestat.component.chart.runtime_thermostat_detail_temperature.prototype.get_opti
}
});
if (
self.data_.metadata.series.off_heat_cool.durations[x.valueOf()] !== undefined &&
self.data_.metadata.series.off_heat_cool.durations[x.valueOf()].seconds > 0
) {
groups.off.push({
'label': beestat.series.off_heat_cool.name,
'value': beestat.time(
self.data_.metadata.series.off_heat_cool.durations[x.valueOf()]
),
'color': beestat.series.off_heat_cool.color
});
}
if (
groups.mode.length === 0 &&
groups.equipment.length === 0 &&
@ -394,6 +408,10 @@ beestat.component.chart.runtime_thermostat_detail_temperature.prototype.get_opti
sections.push(groups.data);
sections.push(groups.equipment);
if(beestat.user.has_early_access() === true) {
sections.push(groups.off);
}
var title = this.x.format('ddd, MMM D @ h:mma');
return self.tooltip_formatter_helper_(