Skip to content

Commit

Permalink
Use coordinator's available property instead of checking device directly
Browse files Browse the repository at this point in the history
  • Loading branch information
mill1000 committed Jul 17, 2024
1 parent dc95559 commit 85c5667
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion custom_components/midea_ac/number.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def unique_id(self) -> str:
@property
def available(self) -> bool:
"""Check device availability."""
return self._device.online and self._device.power_state
return super().available and self._device.power_state

@property
def native_unit_of_measurement(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac/select.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def unique_id(self) -> str:
@property
def available(self) -> bool:
"""Check device availability."""
return self._device.online and self._device.power_state
return super().available and self._device.power_state

@property
def current_option(self) -> str:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/midea_ac/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def available(self) -> bool:
"""Check entity availability."""

# Sensor is unavailable if device is offline or value is None
return self._device.online and self.native_value is not None
return super().available and self.native_value is not None

@property
def device_class(self) -> str:
Expand Down

0 comments on commit 85c5667

Please sign in to comment.