mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Fix climate channel for Shelly (#63756)
* Revert "Improve availability for Shelly Valve" This reverts commit d8cbd81b456820153522e6d86bbd00c4a4a31129. * Fix channel for climate
This commit is contained in:
parent
d99548fc04
commit
9479ef0a34
@ -143,16 +143,17 @@ class BlockSleepingClimate(
|
|||||||
|
|
||||||
if self.block is not None and self.device_block is not None:
|
if self.block is not None and self.device_block is not None:
|
||||||
self._unique_id = f"{self.wrapper.mac}-{self.block.description}"
|
self._unique_id = f"{self.wrapper.mac}-{self.block.description}"
|
||||||
assert self.block.channel
|
|
||||||
self._preset_modes = [
|
self._preset_modes = [
|
||||||
PRESET_NONE,
|
PRESET_NONE,
|
||||||
*wrapper.device.settings["thermostats"][int(self.block.channel)][
|
*wrapper.device.settings["thermostats"][cast(int, self.block.channel)][
|
||||||
"schedule_profile_names"
|
"schedule_profile_names"
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
elif entry is not None:
|
elif entry is not None:
|
||||||
self._unique_id = entry.unique_id
|
self._unique_id = entry.unique_id
|
||||||
|
|
||||||
|
self._channel = cast(int, self._unique_id.split("_")[1])
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def unique_id(self) -> str:
|
def unique_id(self) -> str:
|
||||||
"""Set unique id of entity."""
|
"""Set unique id of entity."""
|
||||||
@ -234,13 +235,6 @@ class BlockSleepingClimate(
|
|||||||
"connections": {(device_registry.CONNECTION_NETWORK_MAC, self.wrapper.mac)}
|
"connections": {(device_registry.CONNECTION_NETWORK_MAC, self.wrapper.mac)}
|
||||||
}
|
}
|
||||||
|
|
||||||
@property
|
|
||||||
def channel(self) -> str | None:
|
|
||||||
"""Device channel."""
|
|
||||||
if self.block is not None:
|
|
||||||
return self.block.channel
|
|
||||||
return self.last_state_attributes.get("channel")
|
|
||||||
|
|
||||||
def _check_is_off(self) -> bool:
|
def _check_is_off(self) -> bool:
|
||||||
"""Return if valve is off or on."""
|
"""Return if valve is off or on."""
|
||||||
return bool(
|
return bool(
|
||||||
@ -254,7 +248,7 @@ class BlockSleepingClimate(
|
|||||||
try:
|
try:
|
||||||
async with async_timeout.timeout(AIOSHELLY_DEVICE_TIMEOUT_SEC):
|
async with async_timeout.timeout(AIOSHELLY_DEVICE_TIMEOUT_SEC):
|
||||||
return await self.wrapper.device.http_request(
|
return await self.wrapper.device.http_request(
|
||||||
"get", f"thermostat/{self.channel}", kwargs
|
"get", f"thermostat/{self._channel}", kwargs
|
||||||
)
|
)
|
||||||
except (asyncio.TimeoutError, OSError) as err:
|
except (asyncio.TimeoutError, OSError) as err:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user