Eq3btsmart more reliable (#11555)
* Eq3btsmart more reliable * Fixed 'Line too long' violations * Fixed trailing whitespaces * Fixed indents * Fix for disallowing external temperature setting * Logic fix after increasing eq3bt versionpull/11764/merge
parent
00ff305bd7
commit
f5c2e7ff68
|
@ -75,6 +75,8 @@ class EQ3BTSmartThermostat(ClimateDevice):
|
|||
|
||||
self._name = _name
|
||||
self._thermostat = eq3.Thermostat(_mac)
|
||||
self._target_temperature = None
|
||||
self._target_mode = None
|
||||
|
||||
@property
|
||||
def supported_features(self):
|
||||
|
@ -116,6 +118,7 @@ class EQ3BTSmartThermostat(ClimateDevice):
|
|||
temperature = kwargs.get(ATTR_TEMPERATURE)
|
||||
if temperature is None:
|
||||
return
|
||||
self._target_temperature = temperature
|
||||
self._thermostat.target_temperature = temperature
|
||||
|
||||
@property
|
||||
|
@ -132,6 +135,7 @@ class EQ3BTSmartThermostat(ClimateDevice):
|
|||
|
||||
def set_operation_mode(self, operation_mode):
|
||||
"""Set operation mode."""
|
||||
self._target_mode = operation_mode
|
||||
self._thermostat.mode = self.reverse_modes[operation_mode]
|
||||
|
||||
def turn_away_mode_off(self):
|
||||
|
@ -177,3 +181,15 @@ class EQ3BTSmartThermostat(ClimateDevice):
|
|||
self._thermostat.update()
|
||||
except BTLEException as ex:
|
||||
_LOGGER.warning("Updating the state failed: %s", ex)
|
||||
|
||||
if (self._target_temperature and
|
||||
self._thermostat.target_temperature
|
||||
!= self._target_temperature):
|
||||
self.set_temperature(temperature=self._target_temperature)
|
||||
else:
|
||||
self._target_temperature = None
|
||||
if (self._target_mode and
|
||||
self.modes[self._thermostat.mode] != self._target_mode):
|
||||
self.set_operation_mode(operation_mode=self._target_mode)
|
||||
else:
|
||||
self._target_mode = None
|
||||
|
|
Loading…
Reference in New Issue