Updates the system target state and propagates that to all devices.
        :param newState:
        :return:
18942
def updateTargetState(self, newState):
        
        self._targetStateProvider.state = loadTargetState(newState, self._targetStateProvider.state)
        for device in self.deviceController.getDevices():
            self.updateDeviceState(device.payload)
1160857
def _update_states(self, uid, states):
        
        #TODO: use try and catch all exceptions
        # test if uid exists
        if self.controllers[uid]:
            # test if states have correct lenght
            if len(states) == 14:
                old_states = self.controllers[uid][2]
                if old_states != states:
                    for key in range(14):
                        if int(old_states[key]) > int(states[key]):
                            e = Event(uid, E_KEYUP, key)
                            self.queue.put_nowait(e)
                        elif int(old_states[key]) < int(states[key]):
                            e = Event(uid, E_KEYDOWN, key)
                            self.queue.put_nowait(e)
                self.controllers[uid][2] = states
            self.controllers[uid][3] = time.time()
555465
def set_state(self, updater=None, **kwargs):
        
        if callable(updater):
            state_change = updater(self)
        elif updater is not None:
            state_change = updater
        else:
            state_change = kwargs

        return [callback_result
                for k, v in state_change.items()
                for callback_result in self.set(k, v)]
992115
public void setState(StreamState newState) {
        StreamState oldState = state.get();
        if (!oldState.equals(newState) && state.compareAndSet(oldState, newState)) {
            fireStateChange(oldState, newState);
        }
    }
846035
def state(self, new_state: bool):
    
    self._lutron.send(Lutron.OP_EXECUTE, Keypad._CMD_TYPE, self._keypad.id,
                      self.component_number, Led._ACTION_LED_STATE,
                      int(new_state))
    self._state = new_state
1329050
def _update_service_current_state(service: ServiceState):
    
    LOG.debug("Setting current state from target state for %s", service.id)
    service.update_current_state(service.target_state)
359972
def update_devices(self, devices):
        """"""
        for qspacket in devices:
            try:
                qsid = qspacket[QS_ID]
            except KeyError:
                _LOGGER.debug("Device without ID: %s", qspacket)
                continue

            if qsid not in self:
                self[qsid] = QSDev(data=qspacket)

            dev = self[qsid]
            dev.data = qspacket
            # Decode value from QSUSB
            newqs = _legacy_status(qspacket[QS_VALUE])
            if dev.is_dimmer:
                # Adjust dimmer exponentially to get a smoother effect
                newqs = min(round(math.pow(newqs, self.dim_adj)), 100)
            newin = round(newqs * _MAX / 100)
            if abs(dev.value - newin) > 1:  # Significant change
                _LOGGER.debug("%s qs=%s  -->  %s", qsid, newqs, newin)
                dev.value = newin
                self._cb_value_changed(self, qsid, newin)
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)
230742
public void setInstallState(@Nonnull InstallState newState) {
        String prior = installStateName;
        installStateName = newState.name();
        LOGGER.log(Main.isDevelopmentMode ? Level.INFO : Level.FINE, "Install state transitioning from: {0} to : {1}", new Object[] { prior, installStateName });
        if (!installStateName.equals(prior)) {
            getSetupWizard().onInstallStateUpdate(newState);
            newState.initializeState();
        }
        saveQuietly();
    }
335394
def update(self):
        
        with self._lock:
            if self._state == Bundle.ACTIVE:
                self.stop()
                self.start()
852507
def state(self):
        
        return Emitter(weakref.proxy(self.lib), self.lib.jit_new_state())
337151
def set_state(self, newState, timer=0):
        """"""
        if _debug: ServerSSM._debug("set_state %r (%s) timer=%r", newState, SSM.transactionLabels[newState], timer)

        # do the regular state change
        SSM.set_state(self, newState, timer)

        # when completed or aborted, remove tracking
        if (newState == COMPLETED) or (newState == ABORTED):
            if _debug: ServerSSM._debug("    - remove from active transactions")
            self.ssmSAP.serverTransactions.remove(self)

            # release the device info
            if self.device_info:
                if _debug: ClientSSM._debug("    - release device information")
                self.ssmSAP.deviceInfoCache.release(self.device_info)
297265
def set_state(self, newState, timer=0):
        """"""
        if _debug: SSM._debug("set_state %r (%s) timer=%r", newState, SSM.transactionLabels[newState], timer)

        # make sure we have a correct transition
        if (self.state == COMPLETED) or (self.state == ABORTED):
            e = RuntimeError("invalid state transition from %s to %s" % (SSM.transactionLabels[self.state], SSM.transactionLabels[newState]))
            SSM._exception(e)
            raise e

        # stop any current timer
        self.stop_timer()

        # make the change
        self.state = newState

        # if another timer should be started, start it
        if timer:
            self.start_timer(timer)
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()
706886
def initialize_state(self):
        
        if self.__hardware_source:
            self.__data_item_states_changed_event_listener = self.__hardware_source.data_item_states_changed_event.listen(self.__data_item_states_changed)
            self.__acquisition_state_changed_event_listener = self.__hardware_source.acquisition_state_changed_event.listen(self.__acquisition_state_changed)
        if self.on_display_name_changed:
            self.on_display_name_changed(self.display_name)
        self.__update_buttons()
        if self.on_data_item_states_changed:
            self.on_data_item_states_changed(list())
476495
def update(self):
        

        self.states = [bool(int(x)) for x in self.get('port list') or '0000']
800493
async def update_from_devices(self):
        """"""
        res = await self.get_json(URL_DEVICES.format(self._url))
        if res:
            self.devices.update_devices(res)
            return True
        return False