Can mobile resource id and chromeos device id collide? - google-admin-sdk

Are the resourceId for mobile devices (link) and chromeos deviceId (link) are generated from the same sample space, meaning they can't collide.
For example if there is a mobile device A with resourceId '1' can it be also a chromeos device B with deviceId of '1'?

Related

How do I query an Alexa device for a parameter?

I am creating a custom skill that will query a custom device for a parameter. In this case, it is the voltage.
The device is a node on node red so it is not a physical device but a virtual one.
The device will be linked to my account. Here is what I am thinking that the workflow would be:
Hello alexa ask test app what is the motor voltage?
I get a session request that goes to my custom intent and executes the corresponding function on the lambda server
----- here is the part that is fuzzy ----
Using some device ID, the lambda server sends out a request to the virtual device
The node for the device gets this request (mostly likely some sort of JSON object), parses it and sends back out the requested parameter that is stored on the Node Red server (For the sake of the discussion lets say that it is a constant number that is on the server)
Lambda server gets this response and forwards it to the Alexa service
Alexa - The voltage of the motor is twelve volts
So basically, how do I do this? Is this the correct workflow for Alexa or is there a different workflow? What components (besides the components needed for Alexa to run) will I be needing? I believe that I can get the ID of the device in the handler_interface.

Reset a Managed Chrome Device with SDK using Google Apps Script

I'm attempting to create a dashboard for admins to allow them to reset a chrome device managed by GoogleAdmin using google apps script.
I don't see any way to perform a reset using Admin SDK API. Can this be done?
If you want to deprovision and/or disable a ChromeOS device
The supported actions when using the Directory API, according to the documentation here are:
deprovision: Remove a device from management that is no longer active, being resold, or is being submitted for return / repair, use the deprovision action to dissociate it from management.
disable: If you believe a device in your organization has been lost or stolen, you can disable the device so that no one else can use it. When a device is disabled, all the user can see when turning on the Chrome device is a screen telling them that it’s been disabled, and your desired contact information of where to return the device.
Taking this into account, this is how the request would look like:
POST https://admin.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos/{resourceId}/action
If you want to reboot and/or remote powerwash a ChromeOS device
However, if you simply plan on doing a powerwash or a reboot, you can make use of the below information:
REBOOT: Reboot the device. Can only be issued to Kiosk and managed guest session devices.
REMOTE_POWERWASH: Wipes the device by performing a power wash. Executing this command in the device will remove all data including user policies, device policies and enrollment policies.
Warning: This will revert the device back to a factory state with no enrollment unless the device is subject to forced or auto enrollment. Use with caution, as this is an irreversible action!
Taking this into account, this is how the request would look like:
POST https://admin.googleapis.com/admin/directory/v1/customer/{customerId}/devices/chromeos/{deviceId}:issueCommand
Apps Script
As for applying any of these in Apps Script, you will have to add the Admin SDK API advanced service and choose the directory _v1 version and simulate any of the above requests.
Code
Assuming you want to remote powerwash a device, you will have to write something similar to this:
let resource = {
YOUR_RESOURCE_HERE;
"commandType": "REMOTE_POWERWASH"
};
let customerId = 'CUSTOMER_ID';
let deviceId = 'DEVICE_ID';
AdminDirectory.Customer.Devices.Chromeos.issueCommand(resource, customerId, deviceId);
Not what you are looking for?
You can simply create a feature request on Google's Issue Tracker and provide the details with regards to your task by filling in the form here.
Reference
Directory API Manage ChromeOS Devices.

Google Cloud IoT - Single MQTT client instance for all devices in a registry

I am able to publish events to a device in my Cloud IOT Registry via an MQTT client created this way (using paho python):
self.__client = mqtt.Client(client_id='projects/{}/locations/{}/registries/{}/devices/{}'.format(project_id,
cloud_region,
registry_id,
device_id))
Now I'm wondering if I can create an MQTT client being able to publish events to multiple devices by setting the client id at registry level (i.e. not specifying the device id):
self.__client = mqtt.Client(client_id='projects/{}/locations/{}/registries/{}'.format(project_id,
cloud_region,
registry_id))
This client is not able to connect even if I've added a CA Certificate to the registry.
My question is: can a single MQTT Client instance publish events to a set of devices defined in a registry?
Should I use a gateway instead?
No, you can't send messages to a registry like this.
The way you'd want to do this is either 1) Use a gateway like you say, send one message then spread it to the devices locally. Or 2) Grab the list of devices in the registry using the DeviceManagerClient(), and iterate over them each sending each device the message in a loop.
Check out this: https://cloud.google.com/iot/docs/samples/device-manager-samples#list_devices_in_a_registry
For fetching the list of devices in a registry. Snippet for python:
# project_id = 'YOUR_PROJECT_ID'
# cloud_region = 'us-central1'
# registry_id = 'your-registry-id'
print("Listing devices")
client = iot_v1.DeviceManagerClient()
registry_path = client.registry_path(project_id, cloud_region, registry_id)
devices = list(client.list_devices(request={"parent": registry_path}))
for device in devices:
print("Device: {} : {}".format(device.num_id, device.id))
return devices
So in that for device in devices loop you can call your code to get the MQTT client and send the message you want to the specified device.

HTTP Sony's Audio Control API

I have some problem with the Audio control API by Sony using postman. Why post request from the screen didn't work?
Why is it working when I call getPowerStatus?
You haven't provided what SONY device you trying to send the command to so I can't say for sure, but not all devices support the "standby" status.
It can be a bit confusing that you can't send "standby" and then you send "off" the status is set to "standby" this is controlled by the setting "QuickStart/Network Standby :ON" that setts that "off" is resulting in status "standby".
So try using
"status": "off"
and the status will be "standby"

Alexa device status "stuck in progress" and not coming out

I attached my Amazon Echo Dot device into Alexa for Business.
Initially, status was "Synced". But, when I added this device into given room, it entered into state "Sync in progress", and stuck in that state only.
Required information-
Device software version - 597464620
Address in Room profile - Mexico City/New York (Tried with Area)
Alexa for Business Region - us-east-1 (N. Verginia)
My location - Bengalore, India
Device Name - Amazon Echo Dot.
Found one forum discussion over this, but didn't get much help - https://forums.aws.amazon.com/thread.jspa?messageID=824543&tstart=0
Please help me out here.