mirror of
https://github.com/beestat/app.git
synced 2025-07-09 03:04:07 -04:00
Added degree days to Thermostat Summary
This commit is contained in:
parent
d298259704
commit
212a8e26db
@ -184,6 +184,16 @@ beestat.series.outdoor_temperature = {
|
||||
'color': beestat.style.color.gray.light
|
||||
};
|
||||
|
||||
beestat.series.heating_degree_days = {
|
||||
'name': 'Degree Days',
|
||||
'color': beestat.style.color.red.dark
|
||||
};
|
||||
|
||||
beestat.series.cooling_degree_days = {
|
||||
'name': 'Degree Days',
|
||||
'color': beestat.style.color.lightblue.dark
|
||||
};
|
||||
|
||||
beestat.series.indoor_humidity = {
|
||||
'name': 'Indoor Humidity',
|
||||
'color': beestat.style.color.bluegreen.base
|
||||
@ -218,6 +228,8 @@ beestat.series.sum_economizer = beestat.series.economizer;
|
||||
beestat.series.sum_ventilator = beestat.series.ventilator;
|
||||
beestat.series.avg_indoor_temperature = beestat.series.indoor_temperature;
|
||||
beestat.series.avg_outdoor_temperature = beestat.series.outdoor_temperature;
|
||||
beestat.series.sum_heating_degree_days = beestat.series.heating_degree_days;
|
||||
beestat.series.sum_cooling_degree_days = beestat.series.cooling_degree_days;
|
||||
beestat.series.avg_indoor_humidity = beestat.series.indoor_humidity;
|
||||
beestat.series.avg_outdoor_humidity = beestat.series.outdoor_humidity;
|
||||
|
||||
|
@ -164,6 +164,8 @@ beestat.component.card.runtime_thermostat_summary.prototype.get_data_ = function
|
||||
'min_outdoor_temperature',
|
||||
'max_outdoor_temperature',
|
||||
'extreme_outdoor_temperature',
|
||||
'sum_heating_degree_days',
|
||||
'sum_cooling_degree_days',
|
||||
'avg_indoor_temperature',
|
||||
'avg_indoor_humidity'
|
||||
].forEach(function(series_code) {
|
||||
@ -279,7 +281,7 @@ beestat.component.card.runtime_thermostat_summary.prototype.get_data_ = function
|
||||
|
||||
data.series[key].push(value);
|
||||
|
||||
var this_active = key.includes('temperature') ? true : (value > 0);
|
||||
var this_active = key.includes('temperature') ? true : (value !== 0);
|
||||
data.metadata.series[key].active = data.metadata.series[key].active || this_active;
|
||||
}
|
||||
}
|
||||
@ -342,6 +344,8 @@ beestat.component.card.runtime_thermostat_summary.prototype.get_buckets_group_ =
|
||||
'avg_outdoor_humidity': [],
|
||||
'min_outdoor_temperature': [],
|
||||
'max_outdoor_temperature': [],
|
||||
'sum_heating_degree_days': [],
|
||||
'sum_cooling_degree_days': [],
|
||||
'avg_indoor_temperature': [],
|
||||
'avg_indoor_humidity': []
|
||||
};
|
||||
@ -394,6 +398,21 @@ beestat.component.card.runtime_thermostat_summary.prototype.get_bucket_key_ = fu
|
||||
* @return {object} The combined buckets.
|
||||
*/
|
||||
beestat.component.card.runtime_thermostat_summary.prototype.get_buckets_combined_ = function(buckets) {
|
||||
// Basically just excludes degree_days.
|
||||
const keys_to_convert_from_seconds_to_hours = [
|
||||
'sum_compressor_cool_1',
|
||||
'sum_compressor_cool_2',
|
||||
'sum_compressor_heat_1',
|
||||
'sum_compressor_heat_2',
|
||||
'sum_auxiliary_heat_1',
|
||||
'sum_auxiliary_heat_2',
|
||||
'sum_fan',
|
||||
'sum_humidifier',
|
||||
'sum_dehumidifier',
|
||||
'sum_ventilator',
|
||||
'sum_economizer'
|
||||
];
|
||||
|
||||
for (var bucket_key in buckets) {
|
||||
var bucket = buckets[bucket_key];
|
||||
|
||||
@ -440,7 +459,9 @@ beestat.component.card.runtime_thermostat_summary.prototype.get_buckets_combined
|
||||
*/
|
||||
|
||||
// Convert seconds to hours.
|
||||
bucket[key] /= 3600;
|
||||
if (keys_to_convert_from_seconds_to_hours.includes(key) === true) {
|
||||
bucket[key] /= 3600;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -95,19 +95,30 @@ beestat.component.chart.runtime_thermostat_summary.prototype.get_options_series_
|
||||
}
|
||||
});
|
||||
|
||||
if (self.data_.metadata.series.avg_outdoor_temperature.active === true) {
|
||||
if (
|
||||
self.data_.metadata.series.avg_outdoor_temperature.active === true ||
|
||||
self.data_.metadata.series.extreme_outdoor_temperature.active === true
|
||||
) {
|
||||
series.push({
|
||||
'name': 'avg_outdoor_temperature',
|
||||
'id': 'avg_outdoor_temperature',
|
||||
'data': this.data_.series.avg_outdoor_temperature,
|
||||
'color': beestat.series.avg_outdoor_temperature.color,
|
||||
'yAxis': 1,
|
||||
'type': 'spline',
|
||||
'dashStyle': 'ShortDash',
|
||||
'lineWidth': 1
|
||||
});
|
||||
}
|
||||
'lineWidth': 1,
|
||||
'events': {
|
||||
'legendItemClick': function() {
|
||||
const outdoor_temperature_visible = this.visible;
|
||||
|
||||
if (outdoor_temperature_visible === false) {
|
||||
this.chart.get('sum_heating_degree_days').setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (self.data_.metadata.series.extreme_outdoor_temperature.active === true) {
|
||||
series.push({
|
||||
'name': 'extreme_outdoor_temperature',
|
||||
'data': this.data_.series.extreme_outdoor_temperature,
|
||||
@ -116,6 +127,41 @@ beestat.component.chart.runtime_thermostat_summary.prototype.get_options_series_
|
||||
'yAxis': 1,
|
||||
'fillOpacity': 0.2,
|
||||
'lineWidth': 0,
|
||||
'linkedTo': 'avg_outdoor_temperature'
|
||||
});
|
||||
}
|
||||
|
||||
if (
|
||||
self.data_.metadata.series.sum_heating_degree_days.active === true ||
|
||||
self.data_.metadata.series.sum_cooling_degree_days.active === true
|
||||
) {
|
||||
series.push({
|
||||
'name': 'sum_heating_degree_days',
|
||||
'id': 'sum_heating_degree_days',
|
||||
'data': this.data_.series.sum_heating_degree_days,
|
||||
'color': beestat.series.sum_heating_degree_days.color,
|
||||
'yAxis': 2,
|
||||
'type': 'spline',
|
||||
'lineWidth': 2,
|
||||
'visible': false,
|
||||
'events': {
|
||||
'legendItemClick': function() {
|
||||
const degree_days_visible = this.visible;
|
||||
|
||||
if (degree_days_visible === false) {
|
||||
this.chart.get('avg_outdoor_temperature').setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
series.push({
|
||||
'name': 'sum_cooling_degree_days',
|
||||
'data': this.data_.series.sum_cooling_degree_days,
|
||||
'color': beestat.series.sum_cooling_degree_days.color,
|
||||
'yAxis': 2,
|
||||
'type': 'spline',
|
||||
'lineWidth': 2,
|
||||
'linkedTo': 'sum_heating_degree_days',
|
||||
'visible': false
|
||||
});
|
||||
}
|
||||
@ -190,6 +236,24 @@ beestat.component.chart.runtime_thermostat_summary.prototype.get_options_yAxis_
|
||||
return this.value + beestat.setting('units.temperature');
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
'alignTicks': false,
|
||||
'gridLineColor': null,
|
||||
'gridLineDashStyle': 'longdash',
|
||||
'opposite': true,
|
||||
'allowDecimals': false,
|
||||
'title': {
|
||||
'text': ''
|
||||
},
|
||||
'labels': {
|
||||
'style': {
|
||||
'color': beestat.style.color.gray.base
|
||||
},
|
||||
'formatter': function() {
|
||||
return this.value.toLocaleString();
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
};
|
||||
@ -226,27 +290,7 @@ beestat.component.chart.runtime_thermostat_summary.prototype.get_options_tooltip
|
||||
var color;
|
||||
switch (point.series.name) {
|
||||
case 'extreme_outdoor_temperature':
|
||||
label = beestat.series.extreme_outdoor_temperature.name;
|
||||
color = point.series.color;
|
||||
if (
|
||||
values.min_outdoor_temperature !== undefined &&
|
||||
values.max_outdoor_temperature !== undefined
|
||||
) {
|
||||
value = beestat.temperature({
|
||||
'temperature': values.min_outdoor_temperature,
|
||||
'input_temperature_unit': beestat.setting('units.temperature'),
|
||||
'units': true,
|
||||
'round': 0
|
||||
});
|
||||
value += ' to ';
|
||||
value += beestat.temperature({
|
||||
'temperature': values.max_outdoor_temperature,
|
||||
'input_temperature_unit': beestat.setting('units.temperature'),
|
||||
'units': true,
|
||||
'round': 0
|
||||
});
|
||||
}
|
||||
break;
|
||||
return;
|
||||
case 'avg_outdoor_temperature':
|
||||
label = beestat.series.avg_outdoor_temperature.name;
|
||||
color = point.series.color;
|
||||
@ -256,6 +300,35 @@ beestat.component.chart.runtime_thermostat_summary.prototype.get_options_tooltip
|
||||
'units': true,
|
||||
'round': 0
|
||||
});
|
||||
|
||||
value += ' (';
|
||||
|
||||
value += beestat.temperature({
|
||||
'temperature': values.min_outdoor_temperature,
|
||||
'input_temperature_unit': beestat.setting('units.temperature'),
|
||||
'units': true,
|
||||
'round': 0
|
||||
});
|
||||
value += ' to ';
|
||||
value += beestat.temperature({
|
||||
'temperature': values.max_outdoor_temperature,
|
||||
'input_temperature_unit': beestat.setting('units.temperature'),
|
||||
'units': true,
|
||||
'round': 0
|
||||
});
|
||||
|
||||
value += ')';
|
||||
|
||||
break;
|
||||
case 'sum_heating_degree_days':
|
||||
label = beestat.series.sum_heating_degree_days.name;
|
||||
color = point.series.color;
|
||||
value = Math.round(values.sum_heating_degree_days).toLocaleString();
|
||||
break;
|
||||
case 'sum_cooling_degree_days':
|
||||
label = beestat.series.sum_cooling_degree_days.name;
|
||||
color = point.series.color;
|
||||
value = Math.round(values.sum_cooling_degree_days).toLocaleString();
|
||||
break;
|
||||
default:
|
||||
label = beestat.series[point.series.name].name;
|
||||
|
Loading…
x
Reference in New Issue
Block a user