Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Google Cloud Function


# Enable Cloud Functions API
gcloud services enable

Update influxDB variables

Open and modify InfluxDB variables (host, port, username, password) in the _get_influxdb_client function

Deploy the cloud function

export PUBSUB_TOPIC="<your-topic-name>"
export REGION="us-central1" #
gcloud functions deploy iotcore_pubsub_to_influxdb --runtime python37 --trigger-topic $PUBSUB_TOPIC --region $REGION

Test, triggering the function manually and checking logs

gcloud pubsub topics publish $PUBSUB_TOPIC --message "{\"timestamp\":$(date +%s),\"temperature\":24.48,\"humidity\":37.72}" --attribute "deviceId=test"
gcloud functions logs read --limit 50 --region $REGION
You can’t perform that action at this time.