Detects and forwards temperature data using a BME280 sensor and a Raspberry PI
🤖 Integrates with Home-Assistant
📊 Reads sensor data, accessible via MQTT and metrics
🔐 Allows connecting to secure MQTT brokers using TLS client certificates
🔭 Expose temperature data as metrics to enable alerting and Grafana dashboards
Download a prebuilt binary from the releases section for your system.
As a prerequisite, you need to have Golang SDK installed. Then you can install gobot-bme280 from source by invoking:
$ go install github.com/soerenschneider/gobot-bme280@latest
{"alt":99,"humidity":13,"pressure":13.37,"temp":22.25,"timestamp":1630563744}
gobot-bme280 can be fully configured using either environment variables or a config file. To supply a config file, the -config
parameter is used.
Struct Field | Description | Environment Variable | Default Value | Validation |
---|---|---|---|---|
Placement | Specifies the placement. | GOBOT_BME280_PLACEMENT | N/A (required) | required |
MetricConfig | Metric server address. | GOBOT_BME280_METRICS_LISTEN_ADDR | N/A (omitempty) | tcp_addr |
IntervalSecs | Interval in seconds for sensor readings. | GOBOT_BME280_INTERVAL_S | 30 | min=30,max=300 |
StatIntervals | Intervals for collecting statistics. | GOBOT_BME280_STAT_INTERVALS | N/A (dive) | dive,min=10,max=3600 |
LogSensor | Whether to log sensor readings. | GOBOT_BME280_LOG_SENSOR_READINGS | false | N/A |
Struct Field | Description | Environment Variable | Default Value | Validation |
---|---|---|---|---|
Disabled | Indicates if MQTT is disabled. | GOBOT_BME280_MQTT_DISABLED | false | N/A |
Host | MQTT broker host address. | GOBOT_BME280_MQTT_BROKER | N/A (required_if=Disabled false, mqtt_broker) | required_if=Disabled false, mqtt_broker |
Topic | MQTT topic for sensor readings. | GOBOT_BME280_MQTT_TOPIC | N/A (required_if=Disabled false, mqtt_topic) | required_if=Disabled false, mqtt_topic |
ClientKeyFile | Client SSL key file for MQTT. | GOBOT_BME280_MQTT_TLS_CLIENT_KEY_FILE | N/A (required_unless=ClientCertFile '', file) | required_unless=ClientCertFile '', file |
ClientCertFile | Client SSL certificate file for MQTT. | GOBOT_BME280_MQTT_TLS_CLIENT_CRT_FILE | N/A (required_unless=ClientKeyFile '', file) | required_unless=ClientKeyFile '', file |
ServerCaFile | Server SSL CA certificate file for MQTT. | GOBOT_BME280_MQTT_TLS_SERVER_CA_FILE | N/A (omitempty, file) | required_unless=ClientKeyFile '', file |
Struct Field | Description | Environment Variable | Default Value | Validation |
---|---|---|---|---|
GpioBus | GPIO bus for sensor. | GOBOT_BME280_GPIO_BUS | 1 | gte=0 |
GpioAddress | GPIO address for sensor. | GOBOT_BME280_GPIO_ADDRESS | 0x76 | gte=1,lte=200 |
This project exposes the following metrics in Open Metrics format using the gobot_bme280
prefix.
Metric Name | Description | Labels |
---|---|---|
version | Version information of this robot | version, commit |
heartbeat_timestamp_seconds | Heartbeat of this robot | placement |
reading_errors_total | Total amount of errors while reading from the sensor | placement |
altitude_meters | The measured altitude in meters | placement |
humidity_percent | The measured humidity in percent | placement |
temperature_celsius | The measured temperature in degrees celsius | placement |
pressure_pa | The measured pressure in pascal | placement |
messages_published_total | The amount of published MQTT messages | placement |
message_publish_errors_total | Total amount of errors while trying to publish messages over MQTT | placement |