googlecodelabs/androidthings-googleassistant

Accessing pre-defined traits on Android Things

Opened this issue · 4 comments

https://codelabs.developers.google.com/codelabs/androidthings-assistant/index.html?index=..%2F..%2Fio2017#5

Running into some weird issues with step 5. Enabled traits in the console, ran through the terminal commands listed and authenticated, but any time I tell the device "turn on", it says power controls is not yet supported. Normal assistant commands (like 'what time is it') work as expected, and not seeing the traits in the list command, either, though I see them on the actions console page.

(env) ➜ MachineLearningDemo git:(master) ✗ googlesamples-assistant-devicetool --project-id ptr-machine-learning-demo list --model
Device Model ID: ptr-machine-learning-demo-machinelearningdemo-dvuzw4
Project ID: ptr-machine-learning-demo
Device Type: action.devices.types.LIGHT
No traits

After a while I created a new project because I messed up some stuff trying to work via the terminal, but managed to connect a device to the assistant with one model, then updated it via this command to enable traits.

googlesamples-assistant-devicetool --project-id project_id register --model model_id --product-name demolight --device instance_id --client-type SERVICE --type LIGHT --manufacturer test --trait OnOff

Kind of wonky, and not in the code lab, but it was the only way I could get things to work.

When you run the devicetool command, then you correctly get a device action when you say "Turn on"? You also are able to see the traits using ... list --model after registering with the devicetool?

Yeah after I ran the devicetool register command, I was able to do a list --model and see the OnOff trait for the one I had just registered (though still nothing on the one that I only updated via the console UI). I did notice that if I go into the actions console page and try to download the credentials for the newly updated model, I get a message that says "Reached limit on number of clients in this project. Try in a new project." and the creation time is set to Dec 31,1969,05:00 PM :)

I see the same issue where enabling the OnOff trait in the console still results in "power controls is not yet supported", but using googlesamples-assistant-devicetool to set the trait makes it work.

I noticed that after I use the command line tool to set the trait, the web console lists it as [my project ID].devices.traits.OnOff. And if I try to use the web console to change the list of traits, the [my project ID].devices.traits.OnOff trait disappears.

Note that I'm using the Python SDK, not Android Things, so it seems like this issue is probably not specific to Android Things.

When you do both, what happens when you want to list using the devicetool?