基于Ubuntu虚拟机的Google Assistant SDK智能家居设备建模:可用设备类型疑问
Hey there, let's work through this issue you're hitting with adding a CAMERA device type to your smart home model. The restriction to LIGHT/SWITCH/OUTLET usually boils down to project configuration, permissions, or SDK setup gaps—here's how to address each angle:
1. Verify Actions Console Device Type Configuration
The most common culprit is that your smart home project in the Actions Console hasn't been enabled to support camera devices. Here's how to fix it:
- Log into your Google Actions Console and open your smart home project.
- Navigate to the Device Registration (or Device Types) section.
- Look for an option to add supported device types, then select CAMERA from the list.
- Save your changes and wait a few minutes for the configuration to propagate.
2. Ensure Proper Authentication & Permissions
If you're using a limited test account or service key, it might not have access to extended device types:
- Create a dedicated service account in the Google Cloud Console for your project.
- Assign the Home Graph Editor or Home Graph Viewer role to this service account (these roles grant access to manage smart home device types).
- Download the service account key file, then set the environment variable on your Ubuntu VM:
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-key.json"
3. Update Google Assistant SDK Dependencies
Older versions of the SDK might not include support for newer device types like CAMERA. Run this command to upgrade your SDK packages:
pip install --upgrade google-assistant-sdk[samples]
4. Validate Your Camera Device Model JSON
Double-check that your device model follows the official schema—typos or missing traits can trigger unexpected restrictions. Here's a minimal valid CAMERA model example:
{ "id": "living-room-camera-01", "type": "action.devices.types.CAMERA", "traits": [ "action.devices.traits.CameraStream" ], "name": { "name": "Living Room Camera" }, "willReportState": false, "attributes": { "cameraStreamSupportedProtocols": ["hls"], "cameraStreamNeedAuthToken": false } }
5. Trigger Home Graph Sync
After updating your device types and models, you need to sync the changes with Google's Home Graph:
- Use the
gactionsCLI tool to push your updated action package:gactions update --action_package action.json --project YOUR_PROJECT_ID - Alternatively, call the Home Graph API's
devices.syncendpoint programmatically to refresh the device list for your test account.
If you still run into issues after these steps, double-check that your project isn't in a restricted test mode—some sandbox environments limit device types for initial testing. You might need to request full access for extended device types through the Actions Console.
内容的提问来源于stack exchange,提问作者MKB

