mirror of
https://github.com/home-assistant/core.git
synced 2025-07-07 21:37:07 +00:00
Fix missing linked device on Overkiz integration (#114006)
* Fix missing linked device (#112731) * Update homeassistant/components/overkiz/executor.py Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com> --------- Co-authored-by: Robert Svensson <Kane610@users.noreply.github.com>
This commit is contained in:
parent
39c44ad5b7
commit
4f22c85e39
@ -143,7 +143,9 @@ class AtlanticElectricalHeaterWithAdjustableTemperatureSetpoint(
|
||||
@property
|
||||
def current_temperature(self) -> float | None:
|
||||
"""Return the current temperature."""
|
||||
if temperature := self.temperature_device.states[OverkizState.CORE_TEMPERATURE]:
|
||||
if self.temperature_device is not None and (
|
||||
temperature := self.temperature_device.states[OverkizState.CORE_TEMPERATURE]
|
||||
):
|
||||
return temperature.value_as_float
|
||||
return None
|
||||
|
||||
|
@ -95,7 +95,9 @@ class AtlanticElectricalTowelDryer(OverkizEntity, ClimateEntity):
|
||||
@property
|
||||
def current_temperature(self) -> float | None:
|
||||
"""Return the current temperature."""
|
||||
if temperature := self.temperature_device.states[OverkizState.CORE_TEMPERATURE]:
|
||||
if self.temperature_device is not None and (
|
||||
temperature := self.temperature_device.states[OverkizState.CORE_TEMPERATURE]
|
||||
):
|
||||
return cast(float, temperature.value)
|
||||
|
||||
return None
|
||||
|
@ -69,7 +69,9 @@ class AtlanticHeatRecoveryVentilation(OverkizEntity, ClimateEntity):
|
||||
@property
|
||||
def current_temperature(self) -> float | None:
|
||||
"""Return the current temperature."""
|
||||
if temperature := self.temperature_device.states[OverkizState.CORE_TEMPERATURE]:
|
||||
if self.temperature_device is not None and (
|
||||
temperature := self.temperature_device.states[OverkizState.CORE_TEMPERATURE]
|
||||
):
|
||||
return cast(float, temperature.value)
|
||||
|
||||
return None
|
||||
|
@ -108,7 +108,9 @@ class AtlanticPassAPCHeatingZone(OverkizEntity, ClimateEntity):
|
||||
@property
|
||||
def current_temperature(self) -> float | None:
|
||||
"""Return the current temperature."""
|
||||
if temperature := self.temperature_device.states[OverkizState.CORE_TEMPERATURE]:
|
||||
if self.temperature_device is not None and (
|
||||
temperature := self.temperature_device.states[OverkizState.CORE_TEMPERATURE]
|
||||
):
|
||||
return cast(float, temperature.value)
|
||||
|
||||
return None
|
||||
|
@ -24,7 +24,7 @@ OVERKIZ_MODE_TO_PRESET_MODES: dict[str, str] = {
|
||||
|
||||
PRESET_MODES_TO_OVERKIZ = {v: k for k, v in OVERKIZ_MODE_TO_PRESET_MODES.items()}
|
||||
|
||||
TEMPERATURE_ZONECONTROL_DEVICE_INDEX = 1
|
||||
TEMPERATURE_ZONECONTROL_DEVICE_INDEX = 20
|
||||
|
||||
|
||||
# Those device depends on a main probe that choose the operating mode (heating, cooling, ...)
|
||||
@ -65,10 +65,15 @@ class AtlanticPassAPCZoneControlZone(AtlanticPassAPCHeatingZone):
|
||||
"""Return hvac operation ie. heat, cool, dry, off mode."""
|
||||
|
||||
if (
|
||||
state := self.zone_control_device.states[
|
||||
OverkizState.IO_PASS_APC_OPERATING_MODE
|
||||
]
|
||||
) is not None and (value := state.value_as_str) is not None:
|
||||
self.zone_control_device is not None
|
||||
and (
|
||||
state := self.zone_control_device.states[
|
||||
OverkizState.IO_PASS_APC_OPERATING_MODE
|
||||
]
|
||||
)
|
||||
is not None
|
||||
and (value := state.value_as_str) is not None
|
||||
):
|
||||
return OVERKIZ_TO_HVAC_MODE[value]
|
||||
return HVACMode.OFF
|
||||
|
||||
|
@ -166,7 +166,9 @@ class SomfyHeatingTemperatureInterface(OverkizEntity, ClimateEntity):
|
||||
@property
|
||||
def current_temperature(self) -> float | None:
|
||||
"""Return the current temperature."""
|
||||
if temperature := self.temperature_device.states[OverkizState.CORE_TEMPERATURE]:
|
||||
if self.temperature_device is not None and (
|
||||
temperature := self.temperature_device.states[OverkizState.CORE_TEMPERATURE]
|
||||
):
|
||||
return temperature.value_as_float
|
||||
return None
|
||||
|
||||
|
@ -104,7 +104,9 @@ class SomfyThermostat(OverkizEntity, ClimateEntity):
|
||||
@property
|
||||
def current_temperature(self) -> float | None:
|
||||
"""Return the current temperature."""
|
||||
if temperature := self.temperature_device.states[OverkizState.CORE_TEMPERATURE]:
|
||||
if self.temperature_device is not None and (
|
||||
temperature := self.temperature_device.states[OverkizState.CORE_TEMPERATURE]
|
||||
):
|
||||
return cast(float, temperature.value)
|
||||
return None
|
||||
|
||||
|
@ -91,7 +91,9 @@ class ValveHeatingTemperatureInterface(OverkizEntity, ClimateEntity):
|
||||
@property
|
||||
def current_temperature(self) -> float | None:
|
||||
"""Return the current temperature."""
|
||||
if temperature := self.temperature_device.states[OverkizState.CORE_TEMPERATURE]:
|
||||
if self.temperature_device is not None and (
|
||||
temperature := self.temperature_device.states[OverkizState.CORE_TEMPERATURE]
|
||||
):
|
||||
return temperature.value_as_float
|
||||
|
||||
return None
|
||||
|
@ -41,9 +41,9 @@ class OverkizExecutor:
|
||||
"""Return Overkiz device linked to this entity."""
|
||||
return self.coordinator.data[self.device_url]
|
||||
|
||||
def linked_device(self, index: int) -> Device:
|
||||
def linked_device(self, index: int) -> Device | None:
|
||||
"""Return Overkiz device sharing the same base url."""
|
||||
return self.coordinator.data[f"{self.base_device_url}#{index}"]
|
||||
return self.coordinator.data.get(f"{self.base_device_url}#{index}")
|
||||
|
||||
def select_command(self, *commands: str) -> str | None:
|
||||
"""Select first existing command in a list of commands."""
|
||||
|
Loading…
x
Reference in New Issue
Block a user