Skip to content

Commit 255e427

Browse files
committed
Cleanup climate, rename to self_location_id
1 parent 745d0d8 commit 255e427

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

custom_components/plugwise/climate.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,8 @@
3333
CONTROL_STATE,
3434
DEV_CLASS,
3535
DOMAIN,
36-
LOCATION,
3736
LOGGER,
3837
LOWER_BOUND,
39-
MASTER_THERMOSTATS,
4038
REGULATION_MODES,
4139
RESOLUTION,
4240
SELECT_REGULATION_MODE,
@@ -72,7 +70,6 @@ def _add_entities() -> None:
7270
return
7371

7472
entities: list[PlugwiseClimateEntity] = []
75-
gateway_name = coordinator.api.smile.name
7673
for device_id in coordinator.new_devices:
7774
device = coordinator.data[device_id]
7875
if device[DEV_CLASS] == "climate":
@@ -113,11 +110,7 @@ def __init__(
113110
gateway_id: str = coordinator.api.gateway_id
114111
self._gateway_data = coordinator.data[gateway_id]
115112
self._homekit_enabled = homekit_enabled # pw-beta homekit emulation
116-
117-
self._location = device_id
118-
if (location := self.device.get(LOCATION)) is not None:
119-
self._location = location
120-
113+
self._location_id = device_id
121114
self._attr_max_temp = min(self.device.get(THERMOSTAT, {}).get(UPPER_BOUND, 35.0), 35.0)
122115
self._attr_min_temp = self.device.get(THERMOSTAT, {}).get(LOWER_BOUND, 0.0)
123116
# Ensure we don't drop below 0.1
@@ -263,7 +256,7 @@ async def async_set_temperature(self, **kwargs: Any) -> None:
263256
if mode := kwargs.get(ATTR_HVAC_MODE):
264257
await self.async_set_hvac_mode(mode)
265258

266-
await self.coordinator.api.set_temperature(self._location, data)
259+
await self.coordinator.api.set_temperature(self._location_id, data)
267260

268261
@plugwise_command
269262
async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
@@ -273,7 +266,7 @@ async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
273266

274267
if hvac_mode != HVACMode.OFF:
275268
await self.coordinator.api.set_schedule_state(
276-
self._location,
269+
self._location_id,
277270
STATE_ON if hvac_mode == HVACMode.AUTO else STATE_OFF,
278271
)
279272

@@ -297,4 +290,4 @@ async def async_set_hvac_mode(self, hvac_mode: HVACMode) -> None:
297290
@plugwise_command
298291
async def async_set_preset_mode(self, preset_mode: str) -> None:
299292
"""Set the preset mode."""
300-
await self.coordinator.api.set_preset(self._location, preset_mode)
293+
await self.coordinator.api.set_preset(self._location_id, preset_mode)

0 commit comments

Comments
 (0)