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 = [ BLOCK_PLATFORMS: Final = [
"binary_sensor", "binary_sensor",
"button", "button",
"climate",
"cover", "cover",
"light", "light",
"sensor", "sensor",
"switch", "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"] RPC_PLATFORMS: Final = ["binary_sensor", "button", "light", "sensor", "switch"]
_LOGGER: Final = logging.getLogger(__name__) _LOGGER: Final = logging.getLogger(__name__)

View File

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