Fix & update for latest Shelly Valve firmware (#60458)

This commit is contained in:
Simone Chemelli 2021-11-29 05:18:15 +01:00 committed by GitHub
parent a29cc29304
commit 110fd261ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 6 deletions

View File

@ -68,13 +68,12 @@ from .utils import (
BLOCK_PLATFORMS: Final = [
"binary_sensor",
"button",
"climate",
"cover",
"light",
"sensor",
"switch",
]
BLOCK_SLEEPING_PLATFORMS: Final = ["binary_sensor", "sensor"]
BLOCK_SLEEPING_PLATFORMS: Final = ["binary_sensor", "climate", "sensor"]
RPC_PLATFORMS: Final = ["binary_sensor", "button", "light", "sensor", "switch"]
_LOGGER: Final = logging.getLogger(__name__)

View File

@ -49,6 +49,9 @@ async def async_setup_entry(
if get_device_entry_gen(config_entry) == 2:
return
device_block: Block | None = None
sensor_block: Block | None = None
wrapper = hass.data[DOMAIN][DATA_CONFIG_ENTRY][config_entry.entry_id][BLOCK]
for block in wrapper.device.blocks:
if block.type == "device":
@ -176,7 +179,10 @@ class ShellyClimate(ShellyBlockEntity, RestoreEntity, ClimateEntity):
return
preset_index = self._attr_preset_modes.index(preset_mode)
if preset_index == 0:
await self.set_state_full_path(schedule=0)
else:
await self.set_state_full_path(
schedule=(0 if preset_index == 0 else 1),
schedule_profile=f"{preset_index}",
schedule=1, schedule_profile=f"{preset_index}"
)