This is a Google Cloud Function that hooks into a Pub/Sub topic where Home Assistant states are published.
The cloud function will write each event to a Google BigQuery table.
- Use this documentation to create your table. Use the following table structure:
- Fill in
DATASET
andTABLE
inmain.py
- Make sure you have the
gcloud
cli installed: https://cloud.google.com/sdk/ - Use this command to deploy the Cloud Function
gcloud functions deploy hass_to_bigquery --runtime python37 --trigger-topic topic-name
Replace topic-name
with the topic name you use in Home Assistant to publish to Pub/Sub
You can verify your subscription to the topic here: https://console.cloud.google.com/cloudpubsub/subscriptions
That's it! Your events should start appearing in BigQuery.