{"id":15222264,"url":"https://github.com/googlecloudplatform/iot-smart-home-cloud","last_synced_at":"2025-10-03T15:30:42.850Z","repository":{"id":45099141,"uuid":"173636982","full_name":"GoogleCloudPlatform/iot-smart-home-cloud","owner":"GoogleCloudPlatform","description":"Sample project using Cloud IoT Core and the Google Assistant","archived":true,"fork":false,"pushed_at":"2022-01-08T14:27:44.000Z","size":355,"stargazers_count":116,"open_issues_count":11,"forks_count":58,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-12-18T08:40:59.252Z","etag":null,"topics":["cloud-iot-core","google-assistant"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GoogleCloudPlatform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-03T22:20:25.000Z","updated_at":"2024-08-27T18:02:50.000Z","dependencies_parsed_at":"2022-09-06T02:42:40.993Z","dependency_job_id":null,"html_url":"https://github.com/GoogleCloudPlatform/iot-smart-home-cloud","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fiot-smart-home-cloud","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fiot-smart-home-cloud/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fiot-smart-home-cloud/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GoogleCloudPlatform%2Fiot-smart-home-cloud/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GoogleCloudPlatform","download_url":"https://codeload.github.com/GoogleCloudPlatform/iot-smart-home-cloud/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235146571,"owners_count":18943281,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud-iot-core","google-assistant"],"created_at":"2024-09-28T15:11:22.882Z","updated_at":"2025-10-03T15:30:42.447Z","avatar_url":"https://github.com/GoogleCloudPlatform.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smart Home Device Manager\n\nThis projects contains sample code that demonstrates the use of\n[Firebase](https://firebase.google.com) and Google\n[Cloud IoT Core](https://cloud.google.com/iot-core/) to build a cloud service\nfor consumer smart home devices.\n\n## Quickstart\n\n### Set up Google Cloud\n\n1. Select or create a new project in the [Google Cloud Console](https://console.cloud.google.com/cloud-resource-manager).\n1. Visit the [Cloud IoT Core page](https://console.cloud.google.com/iot)\n   to enable the API.\n1. Follow [these instructions](https://cloud.google.com/iot/docs/how-tos/devices)\n   to create a device registry and a new device entry.\n\n   *  When creating a new device entry, generate an **ES256** key. You can find\n      details on creating an ES256 key pair\n      [here](https://cloud.google.com/iot/docs/how-tos/credentials/keys#generating_an_es256_key).\n   *  Use `device-events` as the **Default telemetry topic**.\n\n1. Save the project values as environment variables so you can use them later on:\n\n   ```\n   $ export PROJECT_ID=my-project\n   $ export REGION=us-central1\n   $ export REGISTRY=my-registry\n   $ export DEVICE_ID=my-device\n   $ export PRIVATE_KEY_FILE=./ec_private.pem\n   ```\n\n1. Visit the [Firebase console](https://console.firebase.google.com/) and click\n   **Add Project** from the dashboard. Choose the name of your existing\n   Google Cloud project under **Project name**, then select **Add Firebase**.\n\n### Set up Actions on Google\n\n1. Navigate to the [Actions console](http://console.actions.google.com/).\n1. Select **Add/import project**.\n1. Choose the name of your existing Google Cloud project under **Project name**,\n   then select **IMPORT PROJECT**.\n1. Choose **Home control**, followed by **Smart home**.\n1. Select **Setup** → **Invocation** and give your action a name.\n1. Create a unique client id and secret that you will assign to Google for use\n   during smart home account linking.\n\n   ```\n   $ export CLIENT_ID=my-client-id\n   $ export CLIENT_SECRET=my-client-secret\n   ```\n\n\u003e NOTE: These values enable the Google Assistant to identify itself to your action\n  during account linking. This is not used to identify any particular user.\n\n### Deploy project modules\n\n1. Deploy the server module to Firebase using the instructions in\n   [Device Manager Cloud](firebase/README.md).\n1. Deploy the web application using the instructions in\n   [Device Manager Web](web/README.md).\n1. Deploy the mobile application using the instructions in\n   [Device Manager Mobile](mobile/README.md).\n1. Run a [virtual sample device](sample-device/README.md) as either a light or\n   thermostat using the private key generated in the previous step.\n\n### Complete smart home setup\n\n1. Navigate to the [Actions console](http://console.actions.google.com/),\n   and select the your project.\n1. [Configure account linking](https://developers.google.com/actions/identity/oauth2?oauth=code#configure_the_project) for your action.\n   Set **Linking type** to **OAuth** → **Authorization Code**, then enter the\n   following **Client Information**:\n\n   *  **Client ID:** Value exported as `CLIENT_ID` during initial setup.\n   *  **Client secret:** Value generated for `CLIENT_SECRET` during initial setup.\n   *  **Authorization URL:** `https://\u003cyour-firebase-hosting-app\u003e/link-account`\n   *  **Token URL:** `https://\u003cyour-cloud-functions-url\u003e/token`\n\n1. Click **SAVE**.\n1. [Provide fulfillment](https://developers.google.com/actions/smarthome/create#provide-fulfillment) for your action.\n   Select **Build** → **Actions** from the sidebar and click **ADD YOUR FIRST ACTION**.\n   Enter the following **Fulfillment URL**:\n\n   *  `https://\u003cyour-cloud-functions-url\u003e/fulfillment`\n\n1. Click **DONE**.\n\n### Testing your action\n\nFollow [these instructions](https://developers.google.com/actions/smarthome/testing-deploying)\nto enable testing for your smart home action. You can use the\n[Google Home app](https://play.google.com/store/apps/details?id=com.google.android.apps.chromecast.app)\nto link your account and control devices.\n\n### Handle online status changes (Optional)\n\nBy default, the sample assumes a device is online once it begins receiving\nstate change events from that device. You can use the following steps to export\nthe MQTT logs from [Stackdriver](https://cloud.google.com/stackdriver/),\nwhich will report connection state changes.\n\n1. Enable logging for IoT Core Registry.\n   *  Navigate to IoT Core Registries page in the Cloud Console.\n   *  Click the ID of the Registry, and then click **EDIT REGISTRY** at the top of the page.\n   *  Under **Stackdriver Logging**, select **Info** log level.\n   *  Click Update.\n1. Visit the [Stackdriver Logs](https://console.cloud.google.com/logs) in the\n   Cloud Console.\n1. Enter the following advanced filter:\n\n    ```\n    resource.type=\"cloudiot_device\"\n    jsonPayload.eventType=\"DISCONNECT\" OR \"CONNECT\"\n    ```\n\n1. Click **CREATE EXPORT**\n1. Enter a value for **Sink Name**\n1. Select **Cloud Pub/Sub** for **Sink Service**\n1. Create a new Cloud Pub/Sub topic called `online-state` as the\n   **Sink Destination**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglecloudplatform%2Fiot-smart-home-cloud","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgooglecloudplatform%2Fiot-smart-home-cloud","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgooglecloudplatform%2Fiot-smart-home-cloud/lists"}