Make the velbus component more robust in handling errors (#25567)
* Add some try excepts for velbus as the python-velbus lib is not good in handling these * Only catch velbusExceptions * only wrap the lines that can cause the exception * Fix indentation mixup
This commit is contained in:
parent
67cae00caa
commit
15ae970941
4 changed files with 42 additions and 10 deletions
|
@ -1,6 +1,8 @@
|
|||
"""Support for Velbus thermostat."""
|
||||
import logging
|
||||
|
||||
from velbus.util import VelbusException
|
||||
|
||||
from homeassistant.components.climate import ClimateDevice
|
||||
from homeassistant.components.climate.const import (
|
||||
HVAC_MODE_HEAT, SUPPORT_TARGET_TEMPERATURE)
|
||||
|
@ -76,7 +78,11 @@ class VelbusClimate(VelbusEntity, ClimateDevice):
|
|||
temp = kwargs.get(ATTR_TEMPERATURE)
|
||||
if temp is None:
|
||||
return
|
||||
self._module.set_temp(temp)
|
||||
try:
|
||||
self._module.set_temp(temp)
|
||||
except VelbusException as err:
|
||||
_LOGGER.error('A Velbus error occurred: %s', err)
|
||||
return
|
||||
self.schedule_update_ha_state()
|
||||
|
||||
def set_hvac_mode(self, hvac_mode):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue