Code Monkey home page Code Monkey logo

homebridge-sgp30's Introduction

Homebridge Plugin for SGP30

This is a Homebridge plugin for SGP30 eCO2 and TVOC sensor, working on the Raspberry Pi 3.

It uses read() and write() syscalls on the I2C devices exposed by Linux's filesystem.

Configuration

Before running this plugin, you must add the homebridge user to the i2c group so Homebridge can access the I2C dev interface. sudo adduser homebridge i2c

Field name Description Type / Unit Default value Required?
name Name of the accessory string Y
enableFakeGato Enable storing data in Eve Home app bool false N
fakeGatoStoragePath Path to store data for Eve Home app string (fakeGato default) N
enableMQTT Enable sending data to MQTT server bool false N
mqttConfig Object containing some config for MQTT object N
showTemperatureTile Enable showing temperature tile in Home that represents TVOC bool false N

If showTemperatureTile is true, a temperature tile will show up in Home with the TVOC in ppb scaled by a factor of ten (e.g. 25.2 C = 252ppb).

The mqttConfig object is only required if enableMQTT is true, and is defined as follows:

Field name Description Type / Unit Default value Required?
url URL of the MQTT server, must start with mqtt:// string Y
eCO2Topic MQTT topic to which eCO2 data is sent string SGP30/eCO2 N
TVOCTopic MQTT topic to which TVOC data is sent string SGP30/TVOC N

Example Configuration

{
  "bridge": {
    "name": "Homebridge",
    "username": "XXXX",
    "port": XXXX
  },

  "accessories": [
    {
      "accessory": "SGP30",
      "name": "SGP30",
      "enableFakeGato": true,
      "enableMQTT": true,
      "mqtt": {
         "url": "mqtt://192.168.0.38",
         "eCO2Topic": "sgp30/eCO2",
         "TVOCTopic": "sgp30/TVOC"
      }
    },
  ]
}

Project Layout

  • All things required by Node are located at the root of the repository (i.e. package.json and index.js).
  • The rest of the code is in src, further split up by language.
    • c contains the C code that runs on the device to communicate with the sensor. It also contains a simple C program that communicates with the sensor.
    • binding contains the C++ code using node-addon-api to communicate between C and the Node.js runtime.
    • js contains a simple project that tests that the binding between C/Node.js is correctly working. It also contains a characteristic that enables Eve to keep a historical graph of air quality (i.e. eCO2).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.