Skip to content

Commit 4847089

Browse files
committed
Restore try/except
1 parent 88674ef commit 4847089

File tree

2 files changed

+11
-15
lines changed

2 files changed

+11
-15
lines changed

custom_components/tuya_ble/climate.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,17 @@ def _handle_coordinator_update(self) -> None:
234234
break
235235
self._attr_preset_mode = current_preset_mode
236236

237-
if (
238-
self._attr_preset_mode == PRESET_AWAY
239-
or self._attr_hvac_mode == HVACMode.OFF
240-
or self._attr_target_temperature <= self._attr_current_temperature
241-
):
242-
self._attr_hvac_action = HVACAction.IDLE
243-
else:
244-
self._attr_hvac_action = HVACAction.HEATING
237+
try:
238+
if (
239+
self._attr_preset_mode == PRESET_AWAY
240+
or self._attr_hvac_mode == HVACMode.OFF
241+
or self._attr_target_temperature <= self._attr_current_temperature
242+
):
243+
self._attr_hvac_action = HVACAction.IDLE
244+
else:
245+
self._attr_hvac_action = HVACAction.HEATING
246+
except:
247+
pass
245248

246249
self.async_write_ha_state()
247250

custom_components/tuya_ble/switch.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
SwitchEntityDescription,
1111
SwitchEntity,
1212
)
13-
from homeassistant.components.number import (
14-
NumberEntityDescription,
15-
NumberEntity,
16-
)
1713
from homeassistant.config_entries import ConfigEntry
1814
from homeassistant.core import HomeAssistant
1915
from homeassistant.helpers.entity import EntityCategory
@@ -24,9 +20,6 @@
2420
from .devices import TuyaBLEData, TuyaBLEEntity, TuyaBLEProductInfo
2521
from .tuya_ble import TuyaBLEDataPointType, TuyaBLEDevice
2622

27-
_LOGGER = logging.getLogger(__name__)
28-
29-
3023
TuyaBLESwitchIsAvailable = Callable[["TuyaBLESwitch", TuyaBLEProductInfo], bool] | None
3124

3225

0 commit comments

Comments
 (0)