desc
stringlengths
3
26.7k
decl
stringlengths
11
7.89k
bodies
stringlengths
8
553k
'Return true if aux heater.'
@property def is_aux_heat_on(self):
if ((self.wink.current_hvac_mode() == 'aux') and self.wink.is_on()): return True elif ((self.wink.current_hvac_mode() == 'aux') and (not self.wink.is_on())): return False return None
'Set new target temperature.'
def set_temperature(self, **kwargs):
target_temp = kwargs.get(ATTR_TEMPERATURE) target_temp_low = kwargs.get(ATTR_TARGET_TEMP_LOW) target_temp_high = kwargs.get(ATTR_TARGET_TEMP_HIGH) if (target_temp is not None): if (self.current_operation == STATE_COOL): target_temp_high = target_temp if (self.current_operatio...
'Set operation mode.'
def set_operation_mode(self, operation_mode):
if (operation_mode == STATE_HEAT): self.wink.set_operation_mode('heat_only') elif (operation_mode == STATE_COOL): self.wink.set_operation_mode('cool_only') elif (operation_mode == STATE_AUTO): self.wink.set_operation_mode('auto') elif (operation_mode == STATE_OFF): self.w...
'List of available operation modes.'
@property def operation_list(self):
op_list = ['off'] modes = self.wink.hvac_modes() if ('cool_only' in modes): op_list.append(STATE_COOL) if (('heat_only' in modes) or ('aux' in modes)): op_list.append(STATE_HEAT) if ('auto' in modes): op_list.append(STATE_AUTO) if ('eco' in modes): op_list.append(...
'Turn away on.'
def turn_away_mode_on(self):
self.wink.set_away_mode()
'Turn away off.'
def turn_away_mode_off(self):
self.wink.set_away_mode(False)
'Return whether the fan is on.'
@property def current_fan_mode(self):
if (self.wink.current_fan_mode() == 'on'): return STATE_ON elif (self.wink.current_fan_mode() == 'auto'): return STATE_AUTO return None
'List of available fan modes.'
@property def fan_list(self):
if self.wink.has_fan(): return self.wink.fan_modes() return None
'Turn fan on/off.'
def set_fan_mode(self, fan):
self.wink.set_fan_mode(fan.lower())
'Turn auxillary heater on.'
def turn_aux_heat_on(self):
self.set_operation_mode(STATE_AUX)
'Turn auxillary heater off.'
def turn_aux_heat_off(self):
self.set_operation_mode(STATE_AUTO)
'Return the minimum temperature.'
@property def min_temp(self):
minimum = 7 min_min = self.wink.min_min_set_point() min_max = self.wink.min_max_set_point() return_value = minimum if (self.current_operation == STATE_HEAT): if min_min: return_value = min_min else: return_value = minimum elif (self.current_operation == ST...
'Return the maximum temperature.'
@property def max_temp(self):
maximum = 35 max_min = self.wink.max_min_set_point() max_max = self.wink.max_max_set_point() return_value = maximum if (self.current_operation == STATE_HEAT): if max_min: return_value = max_min else: return_value = maximum elif (self.current_operation == S...
'Initialize the Wink device.'
def __init__(self, wink, hass, temp_unit):
super().__init__(wink, hass) self._config_temp_unit = temp_unit
'Return the unit of measurement.'
@property def temperature_unit(self):
return TEMP_CELSIUS
'Return the optional state attributes.'
@property def device_state_attributes(self):
data = {} target_temp_high = self.target_temperature_high target_temp_low = self.target_temperature_low if (target_temp_high is not None): data[ATTR_TARGET_TEMP_HIGH] = self._convert_for_display(self.target_temperature_high) if (target_temp_low is not None): data[ATTR_TARGET_TEMP_LOW...
'Return the current temperature.'
@property def current_temperature(self):
return self.wink.current_temperature()
'Return current operation ie. heat, cool, idle.'
@property def current_operation(self):
if (not self.wink.is_on()): current_op = STATE_OFF elif (self.wink.current_mode() == 'cool_only'): current_op = STATE_COOL elif (self.wink.current_mode() == 'auto_eco'): current_op = STATE_ECO elif (self.wink.current_mode() == 'fan_only'): current_op = STATE_FAN else:...
'List of available operation modes.'
@property def operation_list(self):
op_list = ['off'] modes = self.wink.modes() if ('cool_only' in modes): op_list.append(STATE_COOL) if ('auto_eco' in modes): op_list.append(STATE_ECO) if ('fan_only' in modes): op_list.append(STATE_FAN) return op_list
'Set new target temperature.'
def set_temperature(self, **kwargs):
target_temp = kwargs.get(ATTR_TEMPERATURE) self.wink.set_temperature(target_temp)
'Set operation mode.'
def set_operation_mode(self, operation_mode):
if (operation_mode == STATE_COOL): self.wink.set_operation_mode('cool_only') elif (operation_mode == STATE_ECO): self.wink.set_operation_mode('auto_eco') elif (operation_mode == STATE_OFF): self.wink.set_operation_mode('off') elif (operation_mode == STATE_FAN): self.wink....
'Return the temperature we try to reach.'
@property def target_temperature(self):
return self.wink.current_max_set_point()
'Only supports cool.'
@property def target_temperature_low(self):
return None
'Only supports cool.'
@property def target_temperature_high(self):
return None
'Return the current fan mode.'
@property def current_fan_mode(self):
speed = self.wink.current_fan_speed() if ((speed <= 0.4) and (speed > 0.3)): return SPEED_LOW elif ((speed <= 0.8) and (speed > 0.5)): return SPEED_MEDIUM elif ((speed <= 1.0) and (speed > 0.8)): return SPEED_HIGH return STATE_UNKNOWN
'Return a list of available fan modes.'
@property def fan_list(self):
return [SPEED_LOW, SPEED_MEDIUM, SPEED_HIGH]
'Set fan speed.'
def set_fan_mode(self, mode):
if (mode == SPEED_LOW): speed = 0.4 elif (mode == SPEED_MEDIUM): speed = 0.8 elif (mode == SPEED_HIGH): speed = 1.0 self.wink.set_ac_fan_speed(speed)
'Initialize the Vera device.'
def __init__(self, vera_device, controller):
VeraDevice.__init__(self, vera_device, controller) self.entity_id = ENTITY_ID_FORMAT.format(self.vera_id)
'Return current operation ie. heat, cool, idle.'
@property def current_operation(self):
mode = self.vera_device.get_hvac_mode() if (mode == 'HeatOn'): return OPERATION_LIST[0] elif (mode == 'CoolOn'): return OPERATION_LIST[1] elif (mode == 'AutoChangeOver'): return OPERATION_LIST[2] elif (mode == 'Off'): return OPERATION_LIST[3] return 'Off'
'Return the list of available operation modes.'
@property def operation_list(self):
return OPERATION_LIST
'Return the fan setting.'
@property def current_fan_mode(self):
mode = self.vera_device.get_fan_mode() if (mode == 'ContinuousOn'): return FAN_OPERATION_LIST[0] elif (mode == 'Auto'): return FAN_OPERATION_LIST[1] elif (mode == 'PeriodicOn'): return FAN_OPERATION_LIST[2] return 'Auto'
'Return a list of available fan modes.'
@property def fan_list(self):
return FAN_OPERATION_LIST
'Set new target temperature.'
def set_fan_mode(self, mode):
if (mode == FAN_OPERATION_LIST[0]): self.vera_device.fan_on() elif (mode == FAN_OPERATION_LIST[1]): self.vera_device.fan_auto() elif (mode == FAN_OPERATION_LIST[2]): return self.vera_device.fan_cycle()
'Return the current power usage in W.'
@property def current_power_w(self):
power = self.vera_device.power if power: return convert(power, float, 0.0)
'Handle state updates.'
def update(self):
self._state = self.vera_device.get_hvac_mode()
'Return the unit of measurement.'
@property def temperature_unit(self):
vera_temp_units = self.vera_device.vera_controller.temperature_units if (vera_temp_units == 'F'): return TEMP_FAHRENHEIT return TEMP_CELSIUS
'Return the current temperature.'
@property def current_temperature(self):
return self.vera_device.get_current_temperature()
'Return current operation ie. heat, cool, idle.'
@property def operation(self):
return self.vera_device.get_hvac_state()
'Return the temperature we try to reach.'
@property def target_temperature(self):
return self.vera_device.get_current_goal_temperature()
'Set new target temperatures.'
def set_temperature(self, **kwargs):
if (kwargs.get(ATTR_TEMPERATURE) is not None): self.vera_device.set_temperature(kwargs.get(ATTR_TEMPERATURE))
'Set HVAC mode (auto, cool, heat, off).'
def set_operation_mode(self, operation_mode):
if (operation_mode == OPERATION_LIST[3]): self.vera_device.turn_off() elif (operation_mode == OPERATION_LIST[2]): self.vera_device.turn_auto_on() elif (operation_mode == OPERATION_LIST[1]): self.vera_device.turn_cool_on() elif (operation_mode == OPERATION_LIST[0]): self.v...
'Turn fan on.'
def turn_fan_on(self):
self.vera_device.fan_on()
'Turn fan off.'
def turn_fan_off(self):
self.vera_device.fan_auto()
'Initialize MAX! Cube ClimateDevice.'
def __init__(self, hass, name, rf_address):
self._name = name self._unit_of_measurement = TEMP_CELSIUS self._operation_list = [STATE_AUTO, STATE_MANUAL, STATE_BOOST, STATE_VACATION] self._rf_address = rf_address self._cubehandle = hass.data[MAXCUBE_HANDLE]
'Return the polling state.'
@property def should_poll(self):
return True
'Return the name of the climate device.'
@property def name(self):
return self._name
'Return the minimum temperature.'
@property def min_temp(self):
device = self._cubehandle.cube.device_by_rf(self._rf_address) return self.map_temperature_max_hass(device.min_temperature)
'Return the maximum temperature.'
@property def max_temp(self):
device = self._cubehandle.cube.device_by_rf(self._rf_address) return self.map_temperature_max_hass(device.max_temperature)
'Return the unit of measurement.'
@property def temperature_unit(self):
return self._unit_of_measurement
'Return the current temperature.'
@property def current_temperature(self):
device = self._cubehandle.cube.device_by_rf(self._rf_address) return self.map_temperature_max_hass(device.actual_temperature)
'Return current operation (auto, manual, boost, vacation).'
@property def current_operation(self):
device = self._cubehandle.cube.device_by_rf(self._rf_address) return self.map_mode_max_hass(device.mode)
'Return the list of available operation modes.'
@property def operation_list(self):
return self._operation_list
'Return the temperature we try to reach.'
@property def target_temperature(self):
device = self._cubehandle.cube.device_by_rf(self._rf_address) return self.map_temperature_max_hass(device.target_temperature)
'Set new target temperatures.'
def set_temperature(self, **kwargs):
if (kwargs.get(ATTR_TEMPERATURE) is None): return False target_temperature = kwargs.get(ATTR_TEMPERATURE) device = self._cubehandle.cube.device_by_rf(self._rf_address) cube = self._cubehandle.cube with self._cubehandle.mutex: try: cube.set_target_temperature(device, targe...
'Set new operation mode.'
def set_operation_mode(self, operation_mode):
device = self._cubehandle.cube.device_by_rf(self._rf_address) mode = self.map_mode_hass_max(operation_mode) if (mode is None): return False with self._cubehandle.mutex: try: self._cubehandle.cube.set_mode(device, mode) except (socket.timeout, socket.error): ...
'Get latest data from MAX! Cube.'
def update(self):
self._cubehandle.update()
'Map Temperature from MAX! to HASS.'
@staticmethod def map_temperature_max_hass(temperature):
if (temperature is None): return 0.0 return temperature
'Map Home Assistant Operation Modes to MAX! Operation Modes.'
@staticmethod def map_mode_hass_max(operation_mode):
from maxcube.device import MAX_DEVICE_MODE_AUTOMATIC, MAX_DEVICE_MODE_MANUAL, MAX_DEVICE_MODE_VACATION, MAX_DEVICE_MODE_BOOST if (operation_mode == STATE_AUTO): mode = MAX_DEVICE_MODE_AUTOMATIC elif (operation_mode == STATE_MANUAL): mode = MAX_DEVICE_MODE_MANUAL elif (operation_mode == S...
'Map MAX! Operation Modes to Home Assistant Operation Modes.'
@staticmethod def map_mode_max_hass(mode):
from maxcube.device import MAX_DEVICE_MODE_AUTOMATIC, MAX_DEVICE_MODE_MANUAL, MAX_DEVICE_MODE_VACATION, MAX_DEVICE_MODE_BOOST if (mode == MAX_DEVICE_MODE_AUTOMATIC): operation_mode = STATE_AUTO elif (mode == MAX_DEVICE_MODE_MANUAL): operation_mode = STATE_MANUAL elif (mode == MAX_DEVICE_...
'Initialize the climate device.'
def __init__(self, name, target_temperature, unit_of_measurement, away, hold, current_temperature, current_fan_mode, target_humidity, current_humidity, current_swing_mode, current_operation, aux, target_temp_high, target_temp_low):
self._name = name self._target_temperature = target_temperature self._target_humidity = target_humidity self._unit_of_measurement = unit_of_measurement self._away = away self._hold = hold self._current_temperature = current_temperature self._current_humidity = current_humidity self._...
'Return the polling state.'
@property def should_poll(self):
return False
'Return the name of the climate device.'
@property def name(self):
return self._name
'Return the unit of measurement.'
@property def temperature_unit(self):
return self._unit_of_measurement
'Return the current temperature.'
@property def current_temperature(self):
return self._current_temperature
'Return the temperature we try to reach.'
@property def target_temperature(self):
return self._target_temperature
'Return the highbound target temperature we try to reach.'
@property def target_temperature_high(self):
return self._target_temperature_high
'Return the lowbound target temperature we try to reach.'
@property def target_temperature_low(self):
return self._target_temperature_low
'Return the current humidity.'
@property def current_humidity(self):
return self._current_humidity
'Return the humidity we try to reach.'
@property def target_humidity(self):
return self._target_humidity
'Return current operation ie. heat, cool, idle.'
@property def current_operation(self):
return self._current_operation
'Return the list of available operation modes.'
@property def operation_list(self):
return self._operation_list
'Return if away mode is on.'
@property def is_away_mode_on(self):
return self._away
'Return hold mode setting.'
@property def current_hold_mode(self):
return self._hold
'Return true if away mode is on.'
@property def is_aux_heat_on(self):
return self._aux
'Return the fan setting.'
@property def current_fan_mode(self):
return self._current_fan_mode
'Return the list of available fan modes.'
@property def fan_list(self):
return self._fan_list
'Set new target temperatures.'
def set_temperature(self, **kwargs):
if (kwargs.get(ATTR_TEMPERATURE) is not None): self._target_temperature = kwargs.get(ATTR_TEMPERATURE) if ((kwargs.get(ATTR_TARGET_TEMP_HIGH) is not None) and (kwargs.get(ATTR_TARGET_TEMP_LOW) is not None)): self._target_temperature_high = kwargs.get(ATTR_TARGET_TEMP_HIGH) self._target_t...
'Set new target temperature.'
def set_humidity(self, humidity):
self._target_humidity = humidity self.schedule_update_ha_state()
'Set new target temperature.'
def set_swing_mode(self, swing_mode):
self._current_swing_mode = swing_mode self.schedule_update_ha_state()
'Set new target temperature.'
def set_fan_mode(self, fan):
self._current_fan_mode = fan self.schedule_update_ha_state()
'Set new target temperature.'
def set_operation_mode(self, operation_mode):
self._current_operation = operation_mode self.schedule_update_ha_state()
'Return the swing setting.'
@property def current_swing_mode(self):
return self._current_swing_mode
'List of available swing modes.'
@property def swing_list(self):
return self._swing_list
'Turn away mode on.'
def turn_away_mode_on(self):
self._away = True self.schedule_update_ha_state()
'Turn away mode off.'
def turn_away_mode_off(self):
self._away = False self.schedule_update_ha_state()
'Update hold mode on.'
def set_hold_mode(self, hold):
self._hold = hold self.schedule_update_ha_state()
'Turn away auxillary heater on.'
def turn_aux_heat_on(self):
self._aux = True self.schedule_update_ha_state()
'Turn auxillary heater off.'
def turn_aux_heat_off(self):
self._aux = False self.schedule_update_ha_state()
'Initialize the thermostat.'
def __init__(self, device, hold_temp, away_temps):
self.device = device self.set_time() self._target_temperature = None self._current_temperature = None self._current_operation = STATE_IDLE self._name = None self._fmode = None self._tmode = None self._tstate = None self._hold_temp = hold_temp self._away = False self._away...
'Return the name of the Radio Thermostat.'
@property def name(self):
return self._name
'Return the unit of measurement.'
@property def temperature_unit(self):
return TEMP_FAHRENHEIT
'Return the device specific state attributes.'
@property def device_state_attributes(self):
return {ATTR_FAN: self._fmode, ATTR_MODE: self._tmode}
'Return the current temperature.'
@property def current_temperature(self):
return self._current_temperature
'Return the current operation. head, cool idle.'
@property def current_operation(self):
return self._current_operation
'Return the operation modes list.'
@property def operation_list(self):
return self._operation_list
'Return the temperature we try to reach.'
@property def target_temperature(self):
return self._target_temperature
'Return true if away mode is on.'
@property def is_away_mode_on(self):
return self._away
'Update and validate the data from the thermostat.'
def update(self):
current_temp = self.device.temp['raw'] if (current_temp == (-1)): _LOGGER.error("Couldn't get valid temperature reading") return self._current_temperature = current_temp self._name = self.device.name['raw'] try: self._fmode = self.device.fmode['human'] except ...
'Set new target temperature.'
def set_temperature(self, **kwargs):
temperature = kwargs.get(ATTR_TEMPERATURE) if (temperature is None): return if (self._current_operation == STATE_COOL): self.device.t_cool = (round((temperature * 2.0)) / 2.0) elif (self._current_operation == STATE_HEAT): self.device.t_heat = (round((temperature * 2.0)) / 2.0) ...
'Set device time.'
def set_time(self):
now = datetime.datetime.now() self.device.time = {'day': now.weekday(), 'hour': now.hour, 'minute': now.minute}