Updates the target state on the specified device.
        :param targetState: the target state to reach.
        :param device: the device to update.
        :return:
325756
def updateDeviceState(self, device):
        
        # this is only threadsafe because the targetstate is effectively immutable, if it becomes mutable in future then
        # funkiness may result
        self._reactor.offer(REACH_TARGET_STATE, [self._targetStateProvider.state, device, self._httpclient])
755335
def update(self, state, tnow):
        ''''''
        self.state = state
        self.update_time = tnow
1007004
def update_status(self, reset=False):
        """"""
        if self.healthy_update_timer and not reset:
            return

        # get device features only once
        if not self.device_features:
            self.handle_features(self.get_features())

        # Get status from device to register/keep alive UDP
        self.handle_status()

        # Schedule next execution
        self.setup_update_timer()
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)
28029
public DeviceEnvelope updateDevice(String deviceId, Device device) throws ApiException {
        ApiResponse<DeviceEnvelope> resp = updateDeviceWithHttpInfo(deviceId, device);
        return resp.getData();
    }
254635
function updateState( targetState ) {
            const state = axVisibility.isVisible();
            if( state === lastState ) {
               return;
            }
            lastState = state;
            heartbeat.onAfterNext( () => {
               const handlers = targetState ? showHandlers : hideHandlers;
               handlers.forEach( f => f( targetState ) );
            } );
         }
965200
def update(self):
        

        (data_format, data) = RuuviTagSensor.get_data(self._mac, self._bt_device)

        if data == self._data:
            return self._state

        self._data = data

        if self._data is None:
            self._state = {}
        else:
            self._state = get_decoder(data_format).decode_data(self._data)

        return self._state
585482
def patch(self):
        
        # TODO block until all devices have updated?
        json = request.get_json()
        logger.info("Updating target state with " + str(json))
        self._targetStateController.updateTargetState(json)
        return None, 200
431952
def update(self, params):
        
        dev_info = self.json_state.get('deviceInfo')
        dev_info.update({k: params[k] for k in params if dev_info.get(k)})
468330
def update_state(self):
        """"""
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.settimeout(self._timeout)
        try:
            if sock.connect_ex((self._ip, self._port['state'])) == 0:
                self.state = True
            else:
                self.state = False
            sock.close()
        except socket.error:
            raise
353062
def update_device(self, device_obj):
        
        rid = device_obj['rid']
        device_obj['info']['description']['meta'] = \
                json.dumps(device_obj['info']['description']['meta'])
        headers = {
                'User-Agent': self.user_agent(),
        }
        headers.update(self.headers())

        r = requests.put(   self.portals_url()+'/devices/'+rid, 
                            data=json.dumps(device_obj),
                            headers=headers,
                            auth=self.auth())
        if HTTP_STATUS.OK == r.status_code:
            # fix the 'meta' to be dictionary instead of string
            updated_dev_obj = r.json()
            updated_dev_obj['info']['description']['meta'] =\
                            json.loads(device_obj['info']['description']['meta'])
            return updated_dev_obj
        else:
            print("update_device: Something went wrong: <{0}>: {1}".format(
                        r.status_code, r.reason))
            r.raise_for_status()
1150482
def put_device(self, pin, state, momentary=None, times=None, pause=None):
        
        url = self.base_url + '/device'

        payload = {
            "pin": pin,
            "state": state
        }

        if momentary is not None:
            payload["momentary"] = momentary

        if times is not None:
            payload["times"] = times

        if pause is not None:
            payload["pause"] = pause

        try:
            r = requests.put(url, json=payload, timeout=10)
            return r.json()
        except RequestException as err:
            raise Client.ClientError(err)
914807
def get_device_state(self):
        
        log.debug("getting device state...")
        cmd, url = DEVICE_URLS["get_device_state"]
        return self._exec(cmd, url)
23013
def set_state(self, state, *, index=0):
        """"""
        return self.set_values({
            ATTR_DEVICE_STATE: int(state)
        }, index=index)
1086754
def _wait_for_state_change(self, target_states, update_interval=10):
        
        while self.state not in target_states:
            if self.state == 'error':
                raise Exception('server is in error state')

            # update server state every 10s
            sleep(update_interval)
            self.populate()
1274397
def update_device_list(self, sessions):
        
        if sessions is None:
            _LOGGER.error('Error updating Emby devices.')
            return

        new_devices = []
        active_devices = []
        dev_update = False
        for device in sessions:
            dev_name = '{}.{}'.format(device['DeviceId'], device['Client'])

            try:
                _LOGGER.debug('Session msg on %s of type: %s, themeflag: %s',
                              dev_name, device['NowPlayingItem']['Type'],
                              device['NowPlayingItem']['IsThemeMedia'])
            except KeyError:
                pass

            active_devices.append(dev_name)
            if dev_name not in self._devices and \
                    device['DeviceId'] != str(self._api_id):
                _LOGGER.debug('New Emby DeviceID: %s. Adding to device list.',
                              dev_name)
                new = EmbyDevice(device, self)
                self._devices[dev_name] = new
                new_devices.append(new)
            elif device['DeviceId'] != str(self._api_id):
                # Before we send in new data check for changes to state
                # to decide if we need to fire the update callback
                if not self._devices[dev_name].is_active:
                    # Device wasn't active on the last update
                    # We need to fire a device callback to let subs now
                    dev_update = True

                do_update = self.update_check(
                    self._devices[dev_name], device)
                self._devices[dev_name].update_data(device)
                self._devices[dev_name].set_active(True)
                if dev_update:
                    self._do_new_devices_callback(0)
                    dev_update = False
                if do_update:
                    self._do_update_callback(dev_name)

        # Need to check for new inactive devices and flag
        for dev_id in self._devices:
            if dev_id not in active_devices:
                # Device no longer active
                if self._devices[dev_id].is_active:
                    self._devices[dev_id].set_active(False)
                    self._do_update_callback(dev_id)
                    self._do_stale_devices_callback(dev_id)

        # Call device callback if new devices were found.
        if new_devices:
            self._do_new_devices_callback(0)
7102
def set_temperature(self, set_point):
        
        response = self.api_interface.set_device_state(self, {
            "desired_state": {'set_point': set_point}
        })

        self._update_state_from_response(response)