Set the thermostat mode.

        Mode optons:
            OFF = 0x00,
            HEAT = 0x01,
            COOL = 0x02,
            AUTO = 0x03,
            FAN_AUTO = 0x04,
            FAN_ALWAYS_ON = 0x8
776257
def set(self, mode):
        
        new_mode = None
        if mode == ThermostatMode.OFF:
            new_mode = COMMAND_THERMOSTAT_CONTROL_OFF_ALL_0X6B_0X09
        elif mode == ThermostatMode.HEAT:
            new_mode = COMMAND_THERMOSTAT_CONTROL_ON_HEAT_0X6B_0X04
        elif mode == ThermostatMode.COOL:
            new_mode = COMMAND_THERMOSTAT_CONTROL_ON_COOL_0X6B_0X05
        elif mode == ThermostatMode.AUTO:
            new_mode = COMMAND_THERMOSTAT_CONTROL_ON_AUTO_0X6B_0X06
        if new_mode:
            msg = ExtendedSend(address=self._address,
                               commandtuple=new_mode,
                               userdata=Userdata())
            msg.set_checksum()
            self._send_method(msg, self._mode_change_ack)
319397
def _init_controls(self):
        
        self._config['heater'] = 0
        self._config['fan'] = 0
        self._config['main_fan'] = 0
        self._config['drum_motor'] = 1
        self._config['solenoid'] = 0
        self._config['cooling_motor'] = 0
        self._config['interval'] = self.INTERVAL
        self._config['environment_temp'] = 0
        self._config['bean_temp'] = 0
        self._config['chaff_tray'] = 1

        self._roast['name'] = None
        self._roast['input_weight'] = -1
        self._roast['output_weight'] = -1
        self._roast['operator'] = None
        self._roast['start_time'] = None
        self._roast['end_time'] = None
        self._roast['duration'] = -1
        self._roast['notes'] = None
        self._roast['events'] = list()
        self._roast['last'] = None
        self._roast['record'] = False
        self._roast['charge'] = None
        self._roast['turning_point'] = None
64683
def set_level(self, val):
        """"""
        speed = self._value_to_fan_speed(val)
        if val == 0:
            self.off()
        else:
            set_command = ExtendedSend(self._address,
                                       COMMAND_LIGHT_ON_0X11_NONE,
                                       self._udata, cmd2=speed)
            set_command.set_checksum()
            self._send_method(set_command, self._on_message_received)
461645
def set_sensitivity(self, sensitivity=DEFAULT_SENSITIVITY):
        
        if sensitivity < 31:
            self._mtreg = 31
        elif sensitivity > 254:
            self._mtreg = 254
        else:
            self._mtreg = sensitivity
        self._power_on()
        self._set_mode(0x40 | (self._mtreg >> 5))
        self._set_mode(0x60 | (self._mtreg & 0x1f))
        self._power_down()
387481
def away(dev, away_end, temperature):
    
    if away_end:
        click.echo("Setting away until %s, temperature: %s" % (away_end, temperature))
    else:
        click.echo("Disabling away mode")
    dev.set_away(away_end, temperature)
60778
def set_auto_shutoff(self, timer):
        
        values = {
            "desired_state": {
                "auto_shutoff": timer
            }
        }
        response = self.api_interface.set_device_state(self, values)
        self._update_state_from_response(response)
367490
def set_mode(self, mode):
        """"""
        if not mode:
            raise AbodeException(ERROR.MISSING_ALARM_MODE)
        elif mode.lower() not in CONST.ALL_MODES:
            raise AbodeException(ERROR.INVALID_ALARM_MODE, CONST.ALL_MODES)

        mode = mode.lower()

        response = self._abode.send_request(
            "put", CONST.get_panel_mode_url(self._area, mode))

        _LOGGER.debug("Set Alarm Home Response: %s", response.text)

        response_object = json.loads(response.text)

        if response_object['area'] != self._area:
            raise AbodeException(ERROR.SET_MODE_AREA)

        if response_object['mode'] != mode:
            raise AbodeException(ERROR.SET_MODE_MODE)

        self._json_state['mode'][(self.device_id)] = response_object['mode']

        _LOGGER.info("Set alarm %s mode to: %s",
                     self._device_id, response_object['mode'])

        return True
454930
async def set_setback_temp(self, sb_temp, timeout=OTGW_DEFAULT_TIMEOUT):
        
        cmd = OTGW_CMD_SETBACK
        status = {}
        ret = await self._wait_for_cmd(cmd, sb_temp, timeout)
        if ret is None:
            return
        ret = float(ret)
        status[OTGW_SB_TEMP] = ret
        self._update_status(status)
        return ret
1016738
def set_temperature(self, temp):
        """"""
        temp = round(temp, 1)
        self.__manual_update_time = time.time()
        data = self._controller.command(self._id, 'set_temps',
                                        {"driver_temp": temp,
                                         "passenger_temp": temp},
                                        wake_if_asleep=True)
        if data['response']['result']:
            self.__driver_temp_setting = temp
            self.__passenger_temp_setting = temp
378115
def set_arbitrary(self, freq, low_volt, high_volt, output_state=True):
        """"""
        commands = ['FUNC USER',
                    'BURS:STAT OFF',
                    'SWE:STAT OFF',
                    'FM:STAT OFF',
                    'FREQ {0}'.format(freq),
                    'VOLT:HIGH {0}'.format(high_volt),
                    'VOLT:LOW {0}'.format(low_volt),
                    ]
        if output_state is True:
            commands.append('OUTP ON')
        else:
            commands.append('OUTP OFF')

        command_string = '\n'.join(commands)
        print_string = '\n\t' + command_string.replace('\n', '\n\t')
        logging.info(print_string)
        self.instr.write(command_string)
221778
def set_mode(self, mode, custom_mode = 0, custom_sub_mode = 0):
        ''''''
        mav_autopilot = self.field('HEARTBEAT', 'autopilot', None)
        if mav_autopilot == mavlink.MAV_AUTOPILOT_PX4:
            self.set_mode_px4(mode, custom_mode, custom_sub_mode)
        else:
            self.set_mode_apm(mode)
841136
def SetVoltage(self, v):
        
        if v == 0:
            self._SendStruct("BBB", 0x01, 0x01, 0x00)
        else:
            self._SendStruct("BBB", 0x01, 0x01, int((v - 2.0) * 100))
535063
def _set_dhw(self, status="Scheduled", mode=None, next_time=None):
        
        data = {"Status": status,
                "Mode": mode,
                "NextTime": next_time,
                "SpecialModes": None,
                "HeatSetpoint": None,
                "CoolSetpoint": None}

        self._populate_full_data()
        dhw_zone = self._get_dhw_zone()
        if dhw_zone is None:
            raise Exception('No DHW zone reported from API')
        url = (self.hostname + "/WebAPI/api/devices"
               "/%s/thermostat/changeableValues" % dhw_zone)

        response = self._do_request('put', url, json.dumps(data))

        task_id = self._get_task_id(response)

        while self._get_task_status(task_id) != 'Succeeded':
            time.sleep(1)
1297390
def set_temperature(self, max_set_point=None):
        
        desired_state = {}

        if max_set_point:
            desired_state['max_set_point'] = max_set_point

        response = self.api_interface.set_device_state(self, {
            "desired_state": desired_state
        })

        self._update_state_from_response(response)
476298
def set_set_point(self, param):
        
        if self.temperature_low_limit <= param <= self.temperature_high_limit:
            self.set_point_temperature = param
        return ""
936830
def set_ac_fan_speed(self, speed):
        
        desired_state = {"fan_speed": speed}

        response = self.api_interface.set_device_state(self, {
            "desired_state": desired_state
        })

        self._update_state_from_response(response)
885953
async def set_heater_values(heater_data, heater):
    """"""
    heater.current_temp = heater_data.get('currentTemp')
    heater.device_status = heater_data.get('deviceStatus')
    heater.available = heater.device_status == 0
    heater.name = heater_data.get('deviceName')
    heater.fan_status = heater_data.get('fanStatus')
    heater.is_holiday = heater_data.get('isHoliday')

    # Room assigned devices don't report canChangeTemp
    # in selectDevice response.
    if heater.room is None:
        heater.can_change_temp = heater_data.get('canChangeTemp')

    # Independent devices report their target temperature via
    # holidayTemp value. But isHoliday is still set to 0.
    # Room assigned devices may have set "Control Device individually"
    # which effectively set their isHoliday value to 1.
    # In this mode they behave similar to independent devices
    # reporting their target temperature also via holidayTemp.
    if heater.independent_device or heater.is_holiday == 1:
        heater.set_temp = heater_data.get('holidayTemp')
    elif heater.room is not None:
        if heater.room.current_mode == 1:
            heater.set_temp = heater.room.comfort_temp
        elif heater.room.current_mode == 2:
            heater.set_temp = heater.room.sleep_temp
        elif heater.room.current_mode == 3:
            heater.set_temp = heater.room.away_temp
    heater.power_status = heater_data.get('powerStatus')
    heater.tibber_control = heater_data.get('tibberControl')
    heater.open_window = heater_data.get('open_window',
                                         heater_data.get('open')
                                         )
    heater.is_heating = heater_data.get('heatStatus',
                                        heater_data.get('heaterFlag')
                                        )
    try:
        heater.sub_domain = int(float(heater_data.get('subDomain',
                                                      heater_data.get('subDomainId',
                                                                      heater.sub_domain)
                                                      )))
    except ValueError:
        pass