|
8 | 8 |
|
9 | 9 | # This way of importing aiohttp is because of patch/mocking in testing (aiohttp timeouts) |
10 | 10 | from aiohttp import BasicAuth, ClientError, ClientResponse, ClientSession, ClientTimeout |
| 11 | + |
| 12 | +# Time related |
| 13 | +from dateutil import tz |
11 | 14 | from dateutil.parser import parse |
12 | 15 | from defusedxml import ElementTree as etree |
13 | 16 | from munch import Munch |
14 | | - |
15 | | -# Time related |
16 | | -import pytz |
17 | 17 | from semver import VersionInfo |
18 | 18 |
|
19 | 19 | from .constants import ( |
@@ -764,16 +764,17 @@ def _appliance_measurements( |
764 | 764 | data[name] = format_measure(appl_i_loc.text, ENERGY_WATT_HOUR) # type: ignore [literal-required] |
765 | 765 |
|
766 | 766 | # Thermostat actuator measurements |
767 | | - t_locator = f'.//actuator_functionalities/thermostat_functionality[type="thermostat"]/{measurement}' |
768 | | - if (t_function := appliance.find(t_locator)) is not None: |
769 | | - if new_name := attrs.get(ATTR_NAME): |
770 | | - measurement = new_name |
771 | | - |
772 | | - # Avoid double processing |
773 | | - if measurement == "setpoint": |
774 | | - continue |
| 767 | + for item in ["thermostat", "maximum_boiler_temperature"]: |
| 768 | + t_locator = f'.//actuator_functionalities/thermostat_functionality[type="{item}"]/{measurement}' |
| 769 | + if (t_function := appliance.find(t_locator)) is not None: |
| 770 | + if new_name := attrs.get(ATTR_NAME): |
| 771 | + measurement = new_name |
| 772 | + |
| 773 | + # Avoid double processing |
| 774 | + if measurement == "setpoint": |
| 775 | + continue |
775 | 776 |
|
776 | | - data[measurement] = format_measure(t_function.text, attrs[ATTR_UNIT_OF_MEASUREMENT]) # type: ignore [literal-required] |
| 777 | + data[measurement] = format_measure(t_function.text, attrs[ATTR_UNIT_OF_MEASUREMENT]) # type: ignore [literal-required] |
777 | 778 |
|
778 | 779 | return data |
779 | 780 |
|
@@ -1106,7 +1107,7 @@ def _last_used_schedule(self, loc_id: str, schedules: list[str]) -> str | None: |
1106 | 1107 | if not schedules: |
1107 | 1108 | return last_used # pragma: no cover |
1108 | 1109 |
|
1109 | | - epoch = dt.datetime(1970, 1, 1, tzinfo=pytz.utc) |
| 1110 | + epoch = dt.datetime(1970, 1, 1, tzinfo=tz.tzutc()) |
1110 | 1111 | schedules_dates: dict[str, float] = {} |
1111 | 1112 |
|
1112 | 1113 | for name in schedules: |
|
0 commit comments