Check for existence of system mode on Honeywell thermostats (#2815)
* Check for existence of system mode on Honeywell thermostats * Return None instead of undefined * Use getattr instead of if/elsepull/2818/head
parent
bb14239d91
commit
8210d65850
|
@ -139,7 +139,7 @@ class RoundThermostat(ThermostatDevice):
|
|||
@property
|
||||
def operation(self: ThermostatDevice) -> str:
|
||||
"""Get the current operation of the system."""
|
||||
return self.device.system_mode
|
||||
return getattr(self.device, 'system_mode', None)
|
||||
|
||||
@property
|
||||
def is_away_mode_on(self):
|
||||
|
@ -148,6 +148,7 @@ class RoundThermostat(ThermostatDevice):
|
|||
|
||||
def set_hvac_mode(self: ThermostatDevice, hvac_mode: str) -> None:
|
||||
"""Set the HVAC mode for the thermostat."""
|
||||
if hasattr(self.device, 'system_mode'):
|
||||
self.device.system_mode = hvac_mode
|
||||
|
||||
def turn_away_mode_on(self):
|
||||
|
@ -231,7 +232,7 @@ class HoneywellUSThermostat(ThermostatDevice):
|
|||
@property
|
||||
def operation(self: ThermostatDevice) -> str:
|
||||
"""Return current operation ie. heat, cool, idle."""
|
||||
return self._device.system_mode
|
||||
return getattr(self._device, 'system_mode', None)
|
||||
|
||||
def set_temperature(self, temperature):
|
||||
"""Set target temperature."""
|
||||
|
@ -261,4 +262,5 @@ class HoneywellUSThermostat(ThermostatDevice):
|
|||
|
||||
def set_hvac_mode(self: ThermostatDevice, hvac_mode: str) -> None:
|
||||
"""Set the system mode (Cool, Heat, etc)."""
|
||||
if hasattr(self._device, 'system_mode'):
|
||||
self._device.system_mode = hvac_mode
|
||||
|
|
Loading…
Reference in New Issue