1
0
mirror of https://github.com/beestat/app.git synced 2025-07-09 03:04:07 -04:00

Refactored inconsistent naming of heat_auxiliary to auxiliary_heat

This commit is contained in:
Jon Ziebell 2021-03-01 22:38:52 -05:00
parent 159670e08c
commit b3d4b11037
3 changed files with 10 additions and 36 deletions

View File

@ -636,8 +636,8 @@ CREATE TABLE `thermostat` (
`program` json DEFAULT NULL,
`system_type_heat` enum('geothermal','compressor','boiler','gas','oil','electric','none') DEFAULT NULL,
`system_type_heat_stages` int unsigned DEFAULT NULL,
`system_type_heat_auxiliary` enum('electric','gas','oil','none') DEFAULT NULL,
`system_type_heat_auxiliary_stages` int unsigned DEFAULT NULL,
`system_type_auxiliary_heat` enum('electric','gas','oil','none') DEFAULT NULL,
`system_type_auxiliary_heat_stages` int unsigned DEFAULT NULL,
`system_type_cool` enum('geothermal','compressor','none') DEFAULT NULL,
`system_type_cool_stages` int unsigned DEFAULT NULL,
`property_age` int unsigned DEFAULT NULL,

View File

@ -244,10 +244,6 @@ class ecobee_thermostat extends cora\crud {
'equipment' => null,
'stages' => null
],
'heat_auxiliary' => [
'equipment' => null,
'stages' => null
],
'auxiliary_heat' => [
'equipment' => null,
'stages' => null
@ -264,8 +260,6 @@ class ecobee_thermostat extends cora\crud {
'reported' => $thermostat['system_type']['reported'],
'detected' => $detected_system_type
];
// TODO This is temporary.
$attributes['system_type']['reported']['auxiliary_heat'] = $attributes['system_type']['reported']['heat_auxiliary'];
}
$attributes['running_equipment'] = $this->get_running_equipment(
@ -589,11 +583,6 @@ class ecobee_thermostat extends cora\crud {
} else {
$system_type_heat = $system_type['detected']['heat']['equipment'];
}
if($system_type['reported']['heat_auxiliary'] !== null) {
$system_type_heat_auxiliary = $system_type['reported']['heat_auxiliary']['equipment'];
} 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 {
@ -601,7 +590,6 @@ class ecobee_thermostat extends cora\crud {
}
$has_heat = (
$system_type_heat !== 'none' ||
$system_type_heat_auxiliary !== 'none' ||
$system_type_auxiliary_heat !== 'none'
);
@ -745,20 +733,6 @@ class ecobee_thermostat extends cora\crud {
// Rudimentary aux heat guess. It's pretty good overall but not as good as
// heat/cool.
$detected_system_type['heat_auxiliary'] = [
'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['heat_auxiliary']['equipment'] = 'none';
} else if($detected_system_type['heat']['equipment'] === 'compressor') {
$detected_system_type['heat_auxiliary']['equipment'] = 'electric';
}
$detected_system_type['auxiliary_heat'] = [
'equipment' => null,
'stages' => null
@ -1027,21 +1001,21 @@ class ecobee_thermostat extends cora\crud {
break;
case 'auxHeat1':
if ($system_type['detected']['heat']['equipment'] === 'compressor') {
$running_equipment[] = 'heat_auxiliary_1';
$running_equipment[] = 'auxiliary_heat_1';
} else {
$running_equipment[] = 'heat_1';
}
break;
case 'auxHeat2':
if ($system_type['detected']['heat']['equipment'] === 'compressor') {
$running_equipment[] = 'heat_auxiliary_2';
$running_equipment[] = 'auxiliary_heat_2';
} else {
$running_equipment[] = 'heat_2';
}
break;
case 'auxHeat3':
if ($system_type['detected']['heat']['equipment'] === 'compressor') {
$running_equipment[] = 'heat_auxiliary_3';
$running_equipment[] = 'auxiliary_heat_3';
} else {
$running_equipment[] = 'heat_3';
}
@ -1065,7 +1039,7 @@ class ecobee_thermostat extends cora\crud {
$running_equipment[] = 'heat_1';
break;
case 'auxHotWater':
$running_equipment[] = 'heat_auxiliary_1';
$running_equipment[] = 'auxiliary_heat_1';
break;
default:
throw new \Exception('Unknown equipment running.', 10800);

View File

@ -49,7 +49,7 @@ class thermostat extends cora\crud {
$generated_columns = [];
if(isset($attributes['system_type']) === true) {
foreach(['heat', 'heat_auxiliary', 'auxiliary_heat', 'cool'] as $mode) {
foreach(['heat', 'auxiliary_heat', 'cool'] as $mode) {
if($attributes['system_type']['reported'][$mode]['equipment'] !== null) {
$generated_columns['system_type_' . $mode] = $attributes['system_type']['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', 'auxiliary_heat', 'cool']) === true) {
if(in_array($system_type, ['heat', 'auxiliary_heat', 'cool']) === true) {
$thermostat['system_type']['reported'][$system_type]['equipment'] = $value;
}
}
@ -127,8 +127,8 @@ class thermostat extends cora\crud {
foreach($thermostats as &$thermostat) {
unset($thermostat['system_type_heat']);
unset($thermostat['system_type_heat_stages']);
unset($thermostat['system_type_heat_auxiliary']);
unset($thermostat['system_type_heat_auxiliary_stages']);
unset($thermostat['system_type_auxiliary_heat']);
unset($thermostat['system_type_auxiliary_heat_stages']);
unset($thermostat['system_type_cool']);
unset($thermostat['system_type_cool_stages']);
unset($thermostat['property_age']);