jacano / esphome-influxdb-cloud

Component & example project for sending sensor data to cloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ESPHome InfluxDB Cloud

Component & example project for sending sensor data to cloud

Component

Built on top of esphome-influxdb and using ESP8266 Influxdb, this is a simplified component to send data to an InfluxDB 2 database. It will send all sensor updates in one batch, as fields of the same measurement.

You can use it in your project by pulling from Git or downloading the source - see the air-quality.yaml file.

Example Project

We will send data from an air quality sensor directly to the cloud, so we can avoid having to set up any local hub like Home Assistant. We will use the free versions of InfluxDB Cloud Serverless and Grafana Cloud, which lets us retain data for 30 days.

Hardware

Ingredients:

Wiring:

SEN55 Pin NodeMCU Pin
1 - VDD 5V - VIN 5V
2 - GND GND
3 - SDA P21 - GPIO21
4 - SCL P22 - GPIO22
5 - SEL GND
6 - NC -

Cable:

Firmware

See the ESPHome Sen5x documentation for details on the sensor, and the air-quality.yaml file for an example configuration.

Cloud

Set up a free InfluxDB Cloud Serverless account, create a bucket and a token with write access to the bucket. Configure the access parameters in your secrets.yaml, see the secrets.template.yaml for example.

After flashing and running the firmware, you should see a Connected to InfluxDB message in the logs and you should be able to query your data points with the Data Explorer on the InfluxDB Cloud portal.

Set up a free Grafana Cloud account as well, and follow the instructions to connect them. I used the FlightSQL plugin, which had to be installed first in Grafana.

Dashboard

You can find the description of the sensor readings in the application notes from the sensor documentation page. See an example Grafana dashboard at air-quality.grafana.json, or another one at anotter-sensor-hub.

About

Component & example project for sending sensor data to cloud

License:MIT License


Languages

Language:C++ 68.9%Language:Python 31.1%