Skip to content

Commit f50b70b

Browse files
committed
Simplify
1 parent 353bf3e commit f50b70b

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

plugwise/helper.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -762,28 +762,14 @@ def _get_gateway_mode(
762762
self._count += 1
763763

764764
def _get_gateway_outdoor_temp(self, entity_id: str, data: GwEntityData) -> None:
765-
"""Adam & Anna: the Smile outdoor_temperature is present in DOMAIN_OBJECTS and LOCATIONS.
766-
767-
Available under the Home location.
768-
"""
765+
"""Adam & Anna: the Smile outdoor_temperature is present in the Home location."""
769766
if self._is_thermostat and entity_id == self.gateway_id:
770-
outdoor_temperature = self._home_loc_value("outdoor_temperature")
771-
if outdoor_temperature is not None:
772-
data.update({"sensors": {"outdoor_temperature": outdoor_temperature}})
767+
locator = "./logs/point_log[type='outdoor_temperature']/period/measurement"
768+
if (found := self._home_location.find(locator)) is not None:
769+
val = format_measure(found.text, NONE)
770+
data.update({"sensors": {"outdoor_temperature": val}})
773771
self._count += 1
774772

775-
def _home_loc_value(self, measurement: str) -> float | int | None:
776-
"""Helper-function for smile.py: _get_entity_data().
777-
778-
Obtain the value/state for the given measurement from the Home location
779-
"""
780-
val: float | int | None = None
781-
locator = f'./logs/point_log[type="{measurement}"]/period/measurement'
782-
if (found := self._home_location.find(locator)) is not None:
783-
val = format_measure(found.text, NONE)
784-
785-
return val
786-
787773
def _process_c_heating_state(self, data: GwEntityData) -> None:
788774
"""Helper-function for _get_measurement_data().
789775

0 commit comments

Comments
 (0)