Set the power state to `state` synchronously.
 @param state [:on, :off]
 @return [Light, LightCollection] self for chaining
19035
def set_power!(state)
      level = case state
      when :on
        1
      when :off
        0
      else
        raise ArgumentError.new("Must pass in either :on or :off")
      end
      send_message!(Protocol::Device::SetPower.new(level: level), wait_for: Protocol::Device::StatePower) do |payload|
        if level == 0
          payload.level == 0
        else
          payload.level > 0
        end
      end
      self
    end
735477
def set_state(self, state):
        
        values = {"desired_state": {"powered": state}}
        response = self.api_interface.set_device_state(self, values)
        self._update_state_from_response(response)
816685
def setConfigurable(self, state):
        
        self._configurable = state
        self._configButton.setVisible(state)
884565
def state(self, state):
        ''''''
        logger.debug('client changing to state=%s', ClientState.Names[state])
        self._state = state
229358
def set_state(self, onoff, channel=None):
        """"""
        try:
            onoff = bool(onoff)
        except Exception as err:
            LOG.debug("HelperActorState.set_state: Exception %s" % (err,))
            return False

        self.writeNodeData("STATE", onoff, channel)
939755
def update_state(self, name, state):
        

        self._loop.run_coroutine(self._client.update_state(name, state))
1343487
def __set_true_state(self):
        

        LOGGER.debug("> Setting variable QPushButton() to 'True' state.")
        self.__state = True

        palette = QPalette()
        palette.setColor(QPalette.Button, foundations.common.get_first_item(self.__colors))
        self.setPalette(palette)

        self.setChecked(True)
        self.setText(foundations.common.get_first_item(self.__labels))
23013
def set_state(self, state, *, index=0):
        """"""
        return self.set_values({
            ATTR_DEVICE_STATE: int(state)
        }, index=index)
1204989
def consume(self, state):
        
        self.state.append(self.func(state))
        return self.state
663976
def setInheritVisibility(self, state):
        
        if self._inheritVisibility == state:
            return False
            
        self._inheritVisibility = state
        self.sync()
        return True
809519
def state(self, state):
        """"""
        with self._lock:
            self._value = self._states.index(state)
1283673
def setSnapToGrid( self, state = True ):
        
        self._xSnapToGrid = state
        self._ySnapToGrid = state
583
def _set_state(self, new_state, diag=None):
        
        old_state = self._session_state

        LOG.info("[BFD][%s][STATE] State changed from %s to %s.",
                 hex(self._local_discr),
                 bfd.BFD_STATE_NAME[old_state],
                 bfd.BFD_STATE_NAME[new_state])
        self._session_state = new_state

        if new_state == bfd.BFD_STATE_DOWN:
            if diag is not None:
                self._local_diag = diag
            self._desired_min_tx_interval = 1000000
            self._is_polling = True
            self._update_xmit_period()
        elif new_state == bfd.BFD_STATE_UP:
            self._desired_min_tx_interval = self._cfg_desired_min_tx_interval
            self._is_polling = True
            self._update_xmit_period()

        self.app.send_event_to_observers(
            EventBFDSessionStateChanged(self, old_state, new_state))
1043339
def state(self, state: str) -> None:
        """"""
        self._state = state
        for callback in self._callbacks:
            callback()
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)
185373
def set_state(self, state):
        
        values = {"desired_state": {"locked": state}}
        response = self.api_interface.local_set_state(self, values)
        self._update_state_from_response(response)
940826
def _set_master_state(self, state):
        """"""
        if state == 'init':
            self._service_state.update_current_state('init', force=True)
            self.set_state(DevState.INIT)

        elif state == 'on':
            self.set_state(DevState.ON)
            self._service_state.update_current_state('on')