Sets state on the light, can be used like this:

        .. code-block:: python

            set_state(1, xy=[1,2])
511504
def set_state(self, light_id, **kwargs):
        '''
        
        '''
        light = self.get_light(light_id)
        url = '/api/%s/lights/%s/state' % (self.username, light.light_id)
        response = self.make_request('PUT', url, kwargs)
        setting_count = len(kwargs.items())
        success_count = 0

        for data in response:
            if 'success' in data:
                success_count += 1

        if success_count == setting_count:
            return True
        else:
            return False
1049893
def set_active_state(self, name, value):
        """"""
        if name not in self.__active_states.keys():
            raise ValueError("Can not set unknown state '" + name + "'")

        if (isinstance(self.__active_states[name], int) and
                isinstance(value, str)):
            # we get an update as str but current value is
            # an int, try to convert
            self.__active_states[name] = int(value)
        elif (isinstance(self.__active_states[name], float) and
              isinstance(value, str)):
            # we get an update as str but current value is
            # a float, try to convert
            self.__active_states[name] = float(value)
        else:
            self.__active_states[name] = value
1230961
def set_alarm_state(self, state):
        
        values = {"desired_state": {"alarm_enabled": state}}
        response = self.api_interface.set_device_state(self, values)
        self._update_state_from_response(response)
571878
def set_state(self, state):
        
        if self.index() == 0:
            values = {"outlets": [{"desired_state": {"powered": state}}, {}]}
        else:
            values = {"outlets": [{}, {"desired_state": {"powered": state}}]}

        response = self.api_interface.set_device_state(self, values, id_override=self.parent_id(),
                                                       type_override="powerstrip")
        self._update_state_from_response(response)
368509
def set_power_state(self, is_on, bulb=ALL_BULBS, timeout=None):
        
        with _blocking(self.lock, self.power_state, self.light_state_event,
                       timeout):
            self.send(REQ_SET_POWER_STATE,
                      bulb, '2s', '\x00\x01' if is_on else '\x00\x00')
            self.send(REQ_GET_LIGHT_STATE, ALL_BULBS, '')
        return self.power_state
542399
def resp_set_light(self, resp, color=None):
        
        if color:
            self.color=color
        elif resp:
            self.power_level = resp.power_level
            self.color = resp.color
            self.label = resp.label.decode().replace("\x00", "")
1075404
def __set_false_state(self):
        

        LOGGER.debug("> Setting variable QPushButton() to 'False' state.")

        self.__state = False

        palette = QPalette()
        palette.setColor(QPalette.Button, self.__colors[1])
        self.setPalette(palette)

        self.setChecked(False)
        self.setText(self.__labels[1])
459512
def set_gl_state(self, preset=None, **kwargs):
        
        for v in self._subvisuals:
            v.set_gl_state(preset=preset, **kwargs)
1211061
def set_state(self, state, speed=None):
        
        desired_state = {"powered": state}
        if state:
            brightness = self._to_brightness.get(speed or self.current_fan_speed(), 0.33)
            desired_state.update({'brightness': brightness})

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

        self._update_state_from_response(response)
1002225
def _set_random_state_from(self, other):
        
        try:
            # this works if randgen is an instance of random.Random()
            self.randgen.setstate(other.randgen.getstate())
        except AttributeError:
            # this works if randgen is an instance of numpy.random.RandomState()
            self.randgen.set_state(other.randgen.get_state())

        return self
1032808
def set_values(self, values, *, index=0):
        
        assert len(self.raw) == 1, \
            'Only devices with 1 light supported'

        return Command('put', self._device.path, {
            ATTR_LIGHT_CONTROL: [
                values
            ]
        })
879916
def set_state(seed_value=None, step=None):
    """"""
    global RANDOM_SEED  # pylint: disable=global-statement
    if seed_value is not None:
        RANDOM_SEED = seed_value
    if step is not None:
        RANDOM_SEED += step
122937
def set_state(block, state):
        
        if block is None:
            return
        user_state = block.userState()
        if user_state == -1:
            user_state = 0
        higher_part = user_state & 0x7FFF0000
        state &= 0x0000FFFF
        state |= higher_part
        block.setUserState(state)
1276231
def set_state(self, hdr):
        """"""

        self.conf_f = hdr.get('CSUCONFF', 'UNKNOWN')
        # Read CSUPOS and set position in model
        # The bars
        for idx in self.bars:
            key = "CSUP{}".format(idx)
            # UNIT is mm

            # set CSUPOS for BAR
            # Using the model, this sets the X,Y coordinate
            self.bars[idx].csupos = hdr[key]

        self._update_slits(hdr)
123283
def set(self, is_on=None, brightness=None, cancel_transition=True):
        
        if cancel_transition:
            self._cancel_active_transition()

        if is_on is not None:
            self._is_on = is_on

        if brightness is not None:
            self._assert_is_brightness(brightness)
            self._brightness = brightness

        self._update_pwm()
230447
def set_xy_color(self, color_x, color_y, *, index=0, transition_time=None):
        """"""
        self._value_validate(color_x, RANGE_X, "X color")
        self._value_validate(color_y, RANGE_Y, "Y color")

        values = {
            ATTR_LIGHT_COLOR_X: color_x,
            ATTR_LIGHT_COLOR_Y: color_y
        }

        if transition_time is not None:
            values[ATTR_TRANSITION_TIME] = transition_time

        return self.set_values(values, index=index)
1112206
def set_key_state(self, key, state):
        
        key.state = state
        self.renderer.draw_key(self.surface, key)