diff --git a/api/ecobee_thermostat.php b/api/ecobee_thermostat.php index 54d2626..8c53d32 100644 --- a/api/ecobee_thermostat.php +++ b/api/ecobee_thermostat.php @@ -228,6 +228,10 @@ class ecobee_thermostat extends cora\crud { 'equipment' => null, 'stages' => null ], + 'auxiliary_heat' => [ + 'equipment' => null, + 'stages' => null + ], 'cool' => [ 'equipment' => null, 'stages' => null @@ -568,9 +572,15 @@ class ecobee_thermostat extends cora\crud { } else { $system_type_heat_auxiliary = $system_type['detected']['heat_auxiliary']['equipment']; } + if($system_type['reported']['auxiliary_heat'] !== null) { + $system_type_auxiliary_heat = $system_type['reported']['auxiliary_heat']['equipment']; + } else { + $system_type_auxiliary_heat = $system_type['detected']['auxiliary_heat']['equipment']; + } $has_heat = ( $system_type_heat !== 'none' || - $system_type_heat_auxiliary !== 'none' + $system_type_heat_auxiliary !== 'none' || + $system_type_auxiliary_heat !== 'none' ); if($system_type['reported']['cool'] !== null) { @@ -727,6 +737,20 @@ class ecobee_thermostat extends cora\crud { } else if($detected_system_type['heat']['equipment'] === 'compressor') { $detected_system_type['heat_auxiliary']['equipment'] = 'electric'; } + $detected_system_type['auxiliary_heat'] = [ + 'equipment' => null, + 'stages' => null + ]; + if( + $detected_system_type['heat']['equipment'] === 'gas' || + $detected_system_type['heat']['equipment'] === 'boiler' || + $detected_system_type['heat']['equipment'] === 'oil' || + $detected_system_type['heat']['equipment'] === 'electric' + ) { + $detected_system_type['auxiliary_heat']['equipment'] = 'none'; + } else if($detected_system_type['heat']['equipment'] === 'compressor') { + $detected_system_type['auxiliary_heat']['equipment'] = 'electric'; + } // Cool $detected_system_type['cool'] = [ diff --git a/api/thermostat.php b/api/thermostat.php index 81bb520..e1ec2bc 100644 --- a/api/thermostat.php +++ b/api/thermostat.php @@ -49,7 +49,7 @@ class thermostat extends cora\crud { $generated_columns = []; if(isset($attributes['system_type2']) === true) { - foreach(['heat', 'heat_auxiliary', 'cool'] as $mode) { + foreach(['heat', 'heat_auxiliary', 'auxiliary_heat', 'cool'] as $mode) { if($attributes['system_type2']['reported'][$mode]['equipment'] !== null) { $generated_columns['system_type_' . $mode] = $attributes['system_type2']['reported'][$mode]['equipment']; } else { @@ -104,7 +104,7 @@ class thermostat extends cora\crud { $thermostat = $this->get($thermostat_id); foreach($system_types as $system_type => $value) { - if(in_array($system_type, ['heat', 'heat_auxiliary', 'cool']) === true) { + if(in_array($system_type, ['heat', 'heat_auxiliary', 'auxiliary_heat', 'cool']) === true) { $thermostat['system_type2']['reported'][$system_type]['equipment'] = $value; } } diff --git a/js/component/card/my_home.js b/js/component/card/my_home.js index 464ff98..64d204b 100644 --- a/js/component/card/my_home.js +++ b/js/component/card/my_home.js @@ -42,9 +42,9 @@ beestat.component.card.my_home.prototype.decorate_system_type_ = function(parent 'heat' ); const heat_stages_string = heat_stages > 1 ? ' (2 Stage)' : ''; - const heat_auxiliary = beestat.thermostat.get_system_type( + const auxiliary_heat = beestat.thermostat.get_system_type( thermostat.thermostat_id, - 'heat_auxiliary' + 'auxiliary_heat' ); const cool = beestat.thermostat.get_system_type( thermostat.thermostat_id, @@ -68,7 +68,7 @@ beestat.component.card.my_home.prototype.decorate_system_type_ = function(parent .set_background_color(beestat.series.auxiliary_heat_1.color) .set_text_color('#fff') .set_icon('fire') - .set_text(heat_auxiliary.charAt(0).toUpperCase() + heat_auxiliary.slice(1))); + .set_text(auxiliary_heat.charAt(0).toUpperCase() + auxiliary_heat.slice(1))); button_group.add_button(new beestat.component.button() .set_type('pill') .set_background_color(beestat.series.compressor_cool_1.color) diff --git a/js/component/modal/change_system_type.js b/js/component/modal/change_system_type.js index 014e74b..d74e0c7 100644 --- a/js/component/modal/change_system_type.js +++ b/js/component/modal/change_system_type.js @@ -27,7 +27,7 @@ beestat.component.modal.change_system_type.prototype.decorate_contents_ = functi 'oil', 'none' ], - 'heat_auxiliary': [ + 'auxiliary_heat': [ 'gas', 'electric', 'oil', @@ -42,13 +42,13 @@ beestat.component.modal.change_system_type.prototype.decorate_contents_ = functi var titles = { 'heat': 'Heat', - 'heat_auxiliary': 'Auxiliary Heat', + 'auxiliary_heat': 'Auxiliary Heat', 'cool': 'Cool' }; var colors = { 'heat': beestat.style.color.orange.base, - 'heat_auxiliary': beestat.style.color.red.dark, + 'auxiliary_heat': beestat.style.color.red.dark, 'cool': beestat.style.color.blue.light };