This project contains an example virtual device, written in Node.js, for the Smart Home Device Manager sample. This device connects to Cloud IoT Core and reflects every configuration message it receives back as a telemtry event.
-
Install the sample dependencies:
$ npm install
-
Copy the private key file generated from the project Quickstart to the sample device directory.
-
Run the script, providing the private key generated in the previous step along with your Google Cloud project, registry, and device information:
$ node sample_device.js --projectId=$PROJECT_ID \ --cloudRegion=$REGION \ --registryId=$REGISTRY \ --deviceId=$DEVICE_ID \ --deviceType=light \ --privateKeyFile=$PRIVATE_KEY_FILE \ --algorithm=ES256