1
0
mirror of https://github.com/beestat/app.git synced 2025-07-31 14:33:51 -04:00

Simplified beestat.thermostat.get_color

It now uses the running_equipment listing and get_operating_mode function. Easy.
This commit is contained in:
Jon Ziebell 2021-02-20 22:14:52 -05:00
parent 93ea2642c8
commit 4bdb0d5c22

View File

@ -106,48 +106,22 @@ beestat.thermostat.get_stages = function(thermostat_id, mode) {
* @return {string} The color string. * @return {string} The color string.
*/ */
beestat.thermostat.get_color = function(thermostat_id) { beestat.thermostat.get_color = function(thermostat_id) {
var thermostat = beestat.cache.thermostat[thermostat_id]; switch (beestat.thermostat.get_operating_mode(thermostat_id)) {
var ecobee_thermostat = beestat.cache.ecobee_thermostat[ case 'auxiliary_heat_1':
thermostat.ecobee_thermostat_id return beestat.series.auxiliary_heat_1.color;
]; case 'auxiliary_heat_2':
return beestat.series.auxiliary_heat_1.color;
if ( case 'heat_1':
ecobee_thermostat.equipment_status.indexOf('compCool2') !== -1 || return beestat.series.compressor_heat_1.color;
ecobee_thermostat.equipment_status.indexOf('compCool1') !== -1 case 'heat_2':
) { return beestat.series.compressor_heat_2.color;
return beestat.style.color.blue.light; case 'cool_1':
} else if ( return beestat.series.compressor_cool_1.color;
ecobee_thermostat.settings.hasHeatPump === true && case 'cool_2':
( return beestat.series.compressor_cool_2.color;
ecobee_thermostat.equipment_status.indexOf('auxHeat3') !== -1 || default:
ecobee_thermostat.equipment_status.indexOf('auxHeat2') !== -1 || return beestat.style.color.bluegray.dark;
ecobee_thermostat.equipment_status.indexOf('auxHeat1') !== -1 ||
ecobee_thermostat.equipment_status.indexOf('auxHotWater') !== -1
)
) {
return beestat.style.color.red.base;
} else if (
(
ecobee_thermostat.settings.hasHeatPump === false &&
(
ecobee_thermostat.equipment_status.indexOf('auxHeat3') !== -1 ||
ecobee_thermostat.equipment_status.indexOf('auxHeat2') !== -1 ||
ecobee_thermostat.equipment_status.indexOf('auxHeat1') !== -1 ||
ecobee_thermostat.equipment_status.indexOf('compHotWater') !== -1 ||
ecobee_thermostat.equipment_status.indexOf('auxHotWater') !== -1
)
) ||
(
ecobee_thermostat.settings.hasHeatPump === true &&
(
ecobee_thermostat.equipment_status.indexOf('heatPump1') !== -1 ||
ecobee_thermostat.equipment_status.indexOf('heatPump2') !== -1
)
)
) {
return beestat.style.color.orange.base;
} }
return beestat.style.color.bluegray.dark;
}; };
/** /**
@ -198,4 +172,6 @@ beestat.thermostat.get_current_climate = function(thermostat_id) {
return climates[i]; return climates[i];
} }
} }
return null;
}; };