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

Fixed #378 - Entering home age from the ecobee app sets the "age" property of HouseDetails wrong

This commit is contained in:
Jon Ziebell 2023-01-13 09:25:44 -05:00
parent 0b12aed7d6
commit a312ae5575

View File

@ -450,23 +450,27 @@ class ecobee_thermostat extends cora\crud {
} }
/** /**
* Example values from ecobee: "0", "1", "2", "3", "5", "6", "7", "8", * Example values from ecobee: 0, 1, 10, 100, 101, 102, 103, 104, 105,
* "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", * 106, 107, 108, 109, 11, 110, 111, 112, 113, 114, 115, 116, 117, 118,
* "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", * 119, 12, 120, 121, 122, 123, 124, 125, 126, 127, 128, 13, 14, 15, 16,
* "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", * 17, 18, 19, 1930, 1931, 1941, 1950, 1951, 1960, 1961, 1970, 1971, 1980,
* "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", * 1981, 1990, 1991, 2, 20, 2000, 2001, 2010, 2011, 2020, 2021, 21, 22,
* "57", "58", "59", "60", "61", "62", "63", "64", "65", "66", "67", "68", * 23, 24, 25, 26, 27, 28, 29, 3, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
* "69", "70", "71", "72", "73", "75", "76", "77", "78", "79", "80", "81", * 4, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 5, 50, 51, 52, 53, 54, 55,
* "82", "83", "86", "87", "88", "89", "90", "91", "92", "93", "95", "96", * 56, 57, 58, 59, 6, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 7, 70, 71,
* "97", "98", "99", "100", "101", "102", "103", "104", "105", "106", * 72, 73, 74, 75, 76, 77, 78, 79, 8, 80, 81, 82, 83, 84, 85, 86, 87, 88,
* "107", "108", "109", "111", "112", "116", "117", "118", "119", "120", * 89, 9, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
* "121", "122", "123", "124"
*/ */
$property['age'] = null; $property['age'] = null;
if(isset($ecobee_thermostat['house_details']['age']) === true) { if(isset($ecobee_thermostat['house_details']['age']) === true) {
$age = $ecobee_thermostat['house_details']['age']; $age = $ecobee_thermostat['house_details']['age'];
if(ctype_digit((string) $age) === true) { if(ctype_digit((string) $age) === true) {
$property['age'] = (int) $age; $property['age'] = (int) $age;
// Fix for #378 - the ecobee app stores year, the website stores age.
if($property['age'] > 1000) {
$property['age'] = date('Y') - $property['age'];
}
} }
} }