|
7 | 7 |
|
8 | 8 | # This way of importing aiohttp is because of patch/mocking in testing (aiohttp timeouts) |
9 | 9 | from aiohttp import BasicAuth, ClientSession, ClientTimeout, ServerTimeoutError |
10 | | -from dateutil import tz |
11 | 10 | from dateutil.parser import parse |
12 | 11 | from defusedxml import ElementTree as etree |
13 | 12 | from munch import Munch |
|
17 | 16 |
|
18 | 17 | from .constants import ( |
19 | 18 | APPLIANCES, |
20 | | - ATTR_ICON, |
21 | | - ATTR_ID, |
22 | 19 | ATTR_NAME, |
23 | | - ATTR_STATE, |
24 | 20 | ATTR_TYPE, |
25 | 21 | ATTR_UNIT_OF_MEASUREMENT, |
26 | 22 | BINARY_SENSORS, |
27 | | - COOLING_ICON, |
28 | 23 | DEVICE_MEASUREMENTS, |
29 | | - DOMAIN_OBJECTS, |
30 | 24 | ENERGY_KILO_WATT_HOUR, |
31 | 25 | ENERGY_WATT_HOUR, |
32 | 26 | FAKE_LOC, |
33 | | - FLAME_ICON, |
34 | 27 | HEATER_CENTRAL_MEASUREMENTS, |
35 | | - HEATING_ICON, |
36 | 28 | HOME_MEASUREMENTS, |
37 | | - IDLE_ICON, |
38 | 29 | LOCATIONS, |
39 | 30 | POWER_WATT, |
40 | 31 | SENSORS, |
|
49 | 40 | ResponseError, |
50 | 41 | ) |
51 | 42 | from .util import ( |
52 | | - determine_selected, |
53 | 43 | escape_illegal_xml_characters, |
54 | 44 | format_measure, |
55 | 45 | in_between, |
@@ -165,9 +155,9 @@ def schemas_schedule_temp(schedules, name): |
165 | 155 | for i in range(length): |
166 | 156 | result_1 = schema_list[i][0] |
167 | 157 | start = schema_list[i][1] |
168 | | - n = (i + 1) % (length - 1) |
169 | | - result_2 = schema_list[n][0] |
170 | | - end = schema_list[n][1] |
| 158 | + j = (i + 1) % (length - 1) |
| 159 | + result_2 = schema_list[j][0] |
| 160 | + end = schema_list[j][1] |
171 | 161 | now = dt.datetime.now().time() |
172 | 162 | if ( |
173 | 163 | result_1 == dt.datetime.now().weekday() |
@@ -326,6 +316,39 @@ async def close_connection(self): |
326 | 316 | class SmileHelper: |
327 | 317 | """The SmileHelper class.""" |
328 | 318 |
|
| 319 | + def __init__(self): |
| 320 | + """Set the constructor for this class.""" |
| 321 | + self._appl_data = None |
| 322 | + self._appliances = None |
| 323 | + self._cooling_present = None |
| 324 | + self._cp_state = None |
| 325 | + self._devices = None |
| 326 | + self._domain_objects = None |
| 327 | + self._heater_id = None |
| 328 | + self._home_location = None |
| 329 | + self._last_active = {} |
| 330 | + self._loc_data = None |
| 331 | + self._locations = None |
| 332 | + self._modules = None |
| 333 | + self._on_off_device = None |
| 334 | + self._ot_device = None |
| 335 | + self._outdoor_temp = None |
| 336 | + self._sm_thermostat = None |
| 337 | + self._thermo_locs = None |
| 338 | + |
| 339 | + self._smile_legacy = None |
| 340 | + self._stretch_v2 = None |
| 341 | + self._stretch_v3 = None |
| 342 | + |
| 343 | + self.cooling_active = None |
| 344 | + self.gateway_id = None |
| 345 | + self.gw_data = {} |
| 346 | + self.gw_devices = {} |
| 347 | + |
| 348 | + self.smile_name = None |
| 349 | + self.smile_type = None |
| 350 | + self.smile_version = [] |
| 351 | + |
329 | 352 | def _locations_legacy(self): |
330 | 353 | """Helper-function for _all_locations(). |
331 | 354 | Create locations for legacy devices. |
@@ -420,7 +443,8 @@ def _get_module_data(self, appliance, locator, mod_type): |
420 | 443 | if appl_search is not None: |
421 | 444 | link_id = appl_search.attrib["id"] |
422 | 445 | locator = f".//{mod_type}[@id='{link_id}']...." |
423 | | - if (module := self._modules.find(locator)) is not None: |
| 446 | + module = self._modules.find(locator) |
| 447 | + if module is not None: |
424 | 448 | v_name = module.find("vendor_name").text |
425 | 449 | v_model = module.find("vendor_model").text |
426 | 450 | hw_version = module.find("hardware_version").text |
|
0 commit comments