Skip to content

Commit

Permalink
Restore try/except
Browse files Browse the repository at this point in the history
  • Loading branch information
forabi committed Jun 11, 2023
1 parent 88674ef commit 4847089
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
19 changes: 11 additions & 8 deletions custom_components/tuya_ble/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,17 @@ def _handle_coordinator_update(self) -> None:
break
self._attr_preset_mode = current_preset_mode

if (
self._attr_preset_mode == PRESET_AWAY
or self._attr_hvac_mode == HVACMode.OFF
or self._attr_target_temperature <= self._attr_current_temperature
):
self._attr_hvac_action = HVACAction.IDLE
else:
self._attr_hvac_action = HVACAction.HEATING
try:
if (
self._attr_preset_mode == PRESET_AWAY
or self._attr_hvac_mode == HVACMode.OFF
or self._attr_target_temperature <= self._attr_current_temperature
):
self._attr_hvac_action = HVACAction.IDLE
else:
self._attr_hvac_action = HVACAction.HEATING
except:
pass

self.async_write_ha_state()

Expand Down
7 changes: 0 additions & 7 deletions custom_components/tuya_ble/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
SwitchEntityDescription,
SwitchEntity,
)
from homeassistant.components.number import (
NumberEntityDescription,
NumberEntity,
)
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity import EntityCategory
Expand All @@ -24,9 +20,6 @@
from .devices import TuyaBLEData, TuyaBLEEntity, TuyaBLEProductInfo
from .tuya_ble import TuyaBLEDataPointType, TuyaBLEDevice

_LOGGER = logging.getLogger(__name__)


TuyaBLESwitchIsAvailable = Callable[["TuyaBLESwitch", TuyaBLEProductInfo], bool] | None


Expand Down

0 comments on commit 4847089

Please sign in to comment.