Set device state.

        :type value: str
        :param value: Future state (either ON or OFF)
433252
def state(self, value):
        
        if value.upper() == ON:
            return self.SOAPAction('SetSocketSettings', 'SetSocketSettingsResult', self.controlParameters("1", "true"))
        elif value.upper() == OFF:
            return self.SOAPAction('SetSocketSettings', 'SetSocketSettingsResult', self.controlParameters("1", "false"))
        else:
            raise TypeError("State %s is not valid." % str(value))
283172
def model(self, value):
        
        if value == self._defaults['ai.device.model'] and 'ai.device.model' in self._values:
            del self._values['ai.device.model']
        else:
            self._values['ai.device.model'] = value
921965
def set(self, option, value):
        
        if self.config is None:
            self.config = {}
        self.config[option] = value
150365
def set_value(self, instance, value):
        ''''''
        setattr(instance, self.attname, self.to_python(value))
1077287
def setCurrent(self, state=True):
        
        if self._current == state:
            return False
        
        widget = self.viewWidget()
        if widget:
            for other in widget.findChildren(type(self)):
                if other.isCurrent():
                    other._current = False
                    if not other.signalsBlocked():
                        other.currentStateChanged.emit(state)
                        other.deactivated.emit()
        
        self._current = state
        
        if not self.signalsBlocked():
            self.currentStateChanged.emit(state)
            if state:
                self.activated.emit()
            else:
                self.deactivated.emit()
        return True
543405
def set_switch_state(self, state):
        """"""
        self.set_service_value(
            self.switch_service,
            'Target',
            'newTargetValue',
            state)
        self.set_cache_value('Status', state)
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
            ]
        })
403298
def set_state(self, new_state):
        
        # Make sure it's a valid state
        if new_state not in self.STATES:
            raise ValueError('Invalid state value: %r' % new_state)

        # Set the state
        LOGGER.debug('State changing from %s to %s', self.STATES[self.state],
                     self.STATES[new_state])
        self.state = new_state
        self.state_start = time.time()
25406
def set(self, value):
        '''
        
        '''
        with self._lock.exclusive:
            self._value = value
            return value
303780
def set_state(self, state, speed=None):
        
        speed = speed or self.current_fan_speed()
        if state:
            desired_state = {"powered": state, "mode": speed}
        else:
            desired_state = {"powered": state}

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

        self._update_state_from_response(response)
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)
759336
def state(self, value):
        

        if value is not None:
            assert type(value) is bool, "'{0}' attribute: '{1}' type is not 'bool'!".format("state", value)
        self.__state = value
23013
def set_state(self, state, *, index=0):
        """"""
        return self.set_values({
            ATTR_DEVICE_STATE: int(state)
        }, index=index)
842624
def update_state(self):
        
        response = self.api_interface.get_device_state(self, id_override=self.parent.object_id(),
                                                       type_override=self.parent.object_type())
        self._update_state_from_response(response)
791978
def update(self, value):
        
        self.update_internal(value)
        self.emit('changed', self.get_widget_value())
364818
def write(self, offset, value):
		
		if(not self.mode & 0b10):
			raise ReadOnlyError("Device is Read-Only")
		if(offset >= self.size):
			raise AddressError("Offset({}) not in address space({})".format(offset, self.size))
		self.repr_[offset].setvalue(value)
989544
async def set_power(self, value: bool):
        """"""
        if value:
            status = "active"
        else:
            status = "off"
        # TODO WoL works when quickboot is not enabled
        return await self.services["system"]["setPowerStatus"](status=status)