Skip to content

Sensirion SCD30 CO2 sensor MQTT gateway with Home Assistant MQTT discovery

License

Notifications You must be signed in to change notification settings

pvainio/scd30-mqtt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sensirion SCD30 CO2 sensor MQTT gateway for Home Assistant

Overview

This gateway can be used to publish measurements SCD30 to mqtt.

It supports Home Assistant MQTT Discovery but can also be used without Home Assistant.

Only requirement is MQTT Broker to connect to.

Example usecase

Attach SCD30 to Raspberry Pi Zero W I2C bus and run this gateway to publish CO2, temperature and humidity to Home Assistant.

Configuration

Application is configure with environment variables

variable required default description
SCD30_MQTT_URL x mqtt url, for example tcp://10.1.2.3:8883
SCD30_MQTT_USER mqtt username
SCD30_MQTT_PASSWORD mqtt password
SCD30_MQTT_CLIENT_ID scd30 mqtt client id
SCD30_DEBUG false enable debug output, true/false
SCD30_ID scd30 home assistant discovery id
SCD30_TEMP_OFFSET 150 temperature compensation offset
SCD30_NAME SCD30 home assistant device name
SCD30_INTEVAL 50 measurement interval in seconds
SCD30_AUTOCAL 1 1 to enable automatic calibration, 0 to disable
SCD30_FORCECAL CO2 ppm to force calibration to

Usage

For example with following script

#!/bin/sh

# Change to your real mqtt url
export MQTT_URL=tcp://localhost:8883

./scd30-mqtt

MQTT Topics used

  • homeassistant/status subscribe to HA status changes
  • scd30/id/co2 publish co2
  • scd30/id/temperature publish temperature
  • scd30/id/humidity publish humidity