Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_temperature(self, target_temperature):
""" Set the target temperature. """
try:
target_temperature = float(target_temperature)
except Exception as err:
LOG.debug("Thermostat.set_temperature: Exception %s" % (err,))
return False
self.writeNodeData("SET_POINT_TEMPERATURE", target_temperature)
def turnoff(self):
""" Turn off Thermostat. """
self.writeNodeData("SET_POINT_TEMPERATURE", self.OFF_VALUE)
self.actionNodeData('CONTROL_MODE', self.MANU_MODE)
class IPThermostatWall230V(HMThermostat, IPAreaThermostatNoBattery, HelperRssiDevice):
"""
HmIP-BWTH, HmIP-BWTH24
ClimateControl-Wall Thermostat that measures temperature and allows to set a target temperature or use some automatic mode.
"""
def __init__(self, device_description, proxy, resolveparamsets=False):
super().__init__(device_description, proxy, resolveparamsets)
# init metadata
self.SENSORNODE.update({"ACTUAL_TEMPERATURE": [1],
"HUMIDITY": [1]})
self.WRITENODE.update({"SET_POINT_TEMPERATURE": [1]})
self.ACTIONNODE.update({"AUTO_MODE": [1],
"MANU_MODE": [1],
"CONTROL_MODE": [1],
"BOOST_MODE": [1]})
self.ATTRIBUTENODE.update({"SET_POINT_MODE": [1],
super().__init__(device_description, proxy, resolveparamsets)
# init metadata
self.SENSORNODE.update({"ACTUAL_TEMPERATURE": [2],
"ACTUAL_HUMIDITY": [2]})
self.WRITENODE.update({"SET_TEMPERATURE": [2]})
self.ACTIONNODE.update({"AUTO_MODE": [2],
"MANU_MODE": [2],
"BOOST_MODE": [2],
"COMFORT_MODE": [2],
"LOWERING_MODE": [2]})
self.ATTRIBUTENODE.update({"CONTROL_MODE": [2],
"BATTERY_STATE": [2]})
class ThermostatWall2(HMThermostat, AreaThermostat):
"""
HM-CC-TC
ClimateControl-Wall Thermostat that measures temperature and allows to set a target temperature or use some automatic mode.
"""
def __init__(self, device_description, proxy, resolveparamsets=False):
super().__init__(device_description, proxy, resolveparamsets)
# init metadata
self.SENSORNODE.update({"TEMPERATURE": [1],
"HUMIDITY": [1]})
self.WRITENODE.update({"SETPOINT": [2]})
class MAXThermostat(HMThermostat, HelperLowBat, HelperValveState):
"""
BC-RT-TRX-CyG, BC-RT-TRX-CyG-2, BC-RT-TRX-CyG-3, BC-RT-TRX-CyG-4
def BOOSTMODE(self):
""" Return boost state. """
return self.mode == self.BOOST_MODE
@property
def COMFORTMODE(self):
""" Return comfort state. """
return self.mode == self.COMFORT_MODE
@property
def LOWERINGMODE(self):
""" Return lowering state. """
return self.mode == self.LOWERING_MODE
class ThermostatGroup(HMThermostat):
"""
HM-CC-VG-1
Thermostatgroups made up out of multiple supported thermostats
"""
def __init__(self, device_description, proxy, resolveparamsets=False):
super().__init__(device_description, proxy, resolveparamsets)
# init metadata
self.SENSORNODE.update({"ACTUAL_TEMPERATURE": [1]})
self.WRITENODE.update({"SET_TEMPERATURE": [1]})
self.ACTIONNODE.update({"AUTO_MODE": [1],
"MANU_MODE": [1],
"BOOST_MODE": [1],
"COMFORT_MODE": [1],
"LOWERING_MODE": [1]})
self.ATTRIBUTENODE.update({"VALVE_STATE": [1],
def _check_hm_to_ha_object(self):
"""Check if possible to use the Homematic object as this HA type."""
from pyhomematic.devicetypes.thermostats import HMThermostat\
as pyHMThermostat
# Check compatibility from HMDevice
if not super()._check_hm_to_ha_object():
return False
# Check if the Homematic device correct for this HA device
if isinstance(self._hmdevice, pyHMThermostat):
return True
_LOGGER.critical("This %s can't be use as thermostat", self._name)
return False