Implements the Update device Portals API.
            
            http://docs.exosite.com/portals/#update-device
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()
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)
1008346
def update_state(self, cache=True):
        """"""
        self.use_cached_state = cache

        endpoint = API_SESAME_ENDPOINT.format(self._device_id)
        response = self.account.request('GET', endpoint)
        if response is None or response.status_code != 200:
            return

        state = json.loads(response.text)
        self._nickname = state['nickname']
        self._is_unlocked = state['is_unlocked']
        self._api_enabled = state['api_enabled']
        self._battery = state['battery']
510453
public ApiResponse<DeviceStatus> putDeviceStatusWithHttpInfo(String deviceId, DeviceStatusPut body) throws ApiException {
        com.squareup.okhttp.Call call = putDeviceStatusValidateBeforeCall(deviceId, body, null, null);
        Type localVarReturnType = new TypeToken<DeviceStatus>(){}.getType();
        return apiClient.execute(call, localVarReturnType);
    }
996375
def _update_port_status_cache(self, device, device_bound=True):
        """"""
        with self._cache_lock:
            if device_bound:
                self._bound_ports.add(device)
                self._unbound_ports.discard(device)
            else:
                self._bound_ports.discard(device)
                self._unbound_ports.add(device)
476495
def update(self):
        

        self.states = [bool(int(x)) for x in self.get('port list') or '0000']
1283895
def update(
            self,
            update,
            *,
            channel_id=None,
            has_pts=(
                types.UpdateNewMessage,
                types.UpdateDeleteMessages,
                types.UpdateReadHistoryInbox,
                types.UpdateReadHistoryOutbox,
                types.UpdateWebPage,
                types.UpdateReadMessagesContents,
                types.UpdateEditMessage,
                types.updates.State,
                types.updates.DifferenceTooLong,
                types.UpdateShortMessage,
                types.UpdateShortChatMessage,
                types.UpdateShortSentMessage
            ),
            has_date=(
                types.UpdateUserPhoto,
                types.UpdateEncryption,
                types.UpdateEncryptedMessagesRead,
                types.UpdateChatParticipantAdd,
                types.updates.DifferenceEmpty,
                types.UpdateShortMessage,
                types.UpdateShortChatMessage,
                types.UpdateShort,
                types.UpdatesCombined,
                types.Updates,
                types.UpdateShortSentMessage,
            ),
            has_channel_pts=(
                types.UpdateChannelTooLong,
                types.UpdateNewChannelMessage,
                types.UpdateDeleteChannelMessages,
                types.UpdateEditChannelMessage,
                types.UpdateChannelWebPage,
                types.updates.ChannelDifferenceEmpty,
                types.updates.ChannelDifferenceTooLong,
                types.updates.ChannelDifference
            )
    ):
        
        has_pts = isinstance(update, has_pts)
        has_date = isinstance(update, has_date)
        has_channel_pts = isinstance(update, has_channel_pts)
        if has_pts and has_date:
            self._pts_date = update.pts, update.date
        elif has_pts:
            self._pts_date = update.pts, self._pts_date[1]
        elif has_date:
            self._pts_date = self._pts_date[0], update.date

        if has_channel_pts:
            if channel_id is None:
                channel_id = self.get_channel_id(update)

            if channel_id is None:
                self._logger.info(
                    'Failed to retrieve channel_id from %s', update)
            else:
                self.__dict__[channel_id] = update.pts
442577
def refresh(self, url=CONST.DEVICE_URL):
        
        url = url.replace('$DEVID$', self.device_id)

        response = self._abode.send_request(method="get", url=url)
        response_object = json.loads(response.text)

        _LOGGER.debug("Device Refresh Response: %s", response.text)

        if response_object and not isinstance(response_object, (tuple, list)):
            response_object = [response_object]

        for device in response_object:
            self.update(device)

        return response_object
435980
def update_state(self):
        
        response = self.api_interface.get_device_state(self, id_override=self.parent_id(),
                                                       type_override=self.parent_object_type())
        self._update_state_from_response(response)
1171170
def _update_hosting_device_exclusivity(self, context, hosting_device,
                                           tenant_id):
        
        with context.session.begin(subtransactions=True):
            hosting_device['tenant_bound'] = tenant_id
            context.session.add(hosting_device)
            for item in (context.session.query(hd_models.SlotAllocation).
                         filter_by(hosting_device_id=hosting_device['id'])):
                item['tenant_bound'] = tenant_id
                context.session.add(item)
779808
def update(self, **kwargs):
        
        tmos_version = self._meta_data['bigip'].tmos_version
        if LooseVersion(tmos_version) > LooseVersion('12.0.0'):
            msg = "Update() is unsupported for User on version %s. " \
                  "Utilize Modify() method instead" % tmos_version
            raise UnsupportedOperation(msg)
        else:
            self._update(**kwargs)
783679
public static device_profile update(nitro_service client, device_profile resource) throws Exception
	{
		resource.validate("modify");
		return ((device_profile[]) resource.update_resource(client))[0];
	}
607771
def refresh_client(self):
        
        req = self.session.post(
            self._fmip_refresh_url,
            params=self.params,
            data=json.dumps(
                {
                    'clientContext': {
                        'fmly': True,
                        'shouldLocate': True,
                        'selectedDevice': 'all',
                    }
                }
            )
        )
        self.response = req.json()

        for device_info in self.response['content']:
            device_id = device_info['id']
            if device_id not in self._devices:
                self._devices[device_id] = AppleDevice(
                    device_info,
                    self.session,
                    self.params,
                    manager=self,
                    sound_url=self._fmip_sound_url,
                    lost_url=self._fmip_lost_url,
                    message_url=self._fmip_message_url,
                )
            else:
                self._devices[device_id].update(device_info)

        if not self._devices:
            raise PyiCloudNoDevicesException()
88318
def get_device(self, rid):
        
        headers = {
                'User-Agent': self.user_agent(),
                'Content-Type': self.content_type()
        }
        headers.update(self.headers())

        url = self.portals_url()+'/devices/'+rid
        # print("URL: {0}".format(url))

        r = requests.get(   url,
                            headers=headers,
                            auth=self.auth())
    
        if HTTP_STATUS.OK == r.status_code:
            # fix the 'meta' to be dictionary instead of string
            device_obj = r.json()
            # device_obj['info']['description']['meta'] = \
                    # json.loads(device_obj['info']['description']['meta'])
            return device_obj
        else:
            print("get_device: Something went wrong: <{0}>: {1}".format(
                        r.status_code, r.reason))
            r.raise_for_status()
1182643
def _update_device_from_fs(self, device):
        
        try:
            directory_entries = listdir(device["mount_point"])

            # Always try to update using daplink compatible boards processself.
            # This is done for backwards compatibility.
            lowercase_directory_entries = [e.lower() for e in directory_entries]
            if self.MBED_HTM_NAME.lower() in lowercase_directory_entries:
                self._update_device_from_htm(device)

        except (OSError, IOError) as e:
            logger.warning(
                'Marking device with mount point "%s" as unmounted due to the '
                "following error: %s",
                device["mount_point"],
                e,
            )
            device["mount_point"] = None
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)
90463
def update_gateway_device(self, gateway_device_id, body=None):
        """"""
        return self.put(self.gateway_device_path % gateway_device_id,
                        body=body)