Coder Social home page Coder Social logo

tfaco2airco2ntrol_co2meter's Introduction

Read TFA AirCO2ntrol Mini, CO2-Meter and AIRCO2NTROL Coach CO2 Monitor

With this simple script you can read the CO2-Values of TFA AirCO2ntrol Mini https://www.tfa-dostmann.de/produkt/co2-monitor-airco2ntrol-mini-31-5006/ , CO2Meter https://www.co2meter.com/products/co2mini-co2-indoor-air-quality-monitor and AIRCO2NTROL Coach CO2 Monitor https://www.tfa-dostmann.de/produkt/co2-monitor-airco2ntrol-coach-31-5009/

In most cases device is recognized as /dev/hidraw0

Run the script with sudo ./co2monitor.py /dev/hidraw0

This script is based on https://hackaday.io/project/5301-reverse-engineering-a-low-cost-usb-co-monitor/log/17909-all-your-base-are-belong-to-us and was ported to python3

Issue once after insert sudo chmod o+rw /dev/hidraw0 then you can simply run the script withou superuser permissions, which is prefered ./co2monitor.py /dev/hidraw0

Send the data of TFA AirCO2ntrol via MQTT

You can send the data of this script via MQTT with this simple commandline. Note: if there is any connection error to the broker,

while true; do ./co2monitor.py /dev/hidraw0 | grep --line-buffered -oP "(?<=CO2:).*" | tee /dev/tty | mosquitto_pub -t CO2 -h <MQTT-Server> [-u username] [-P pw] -l -q 1 ; done

If you don't need the CO2 level printed to console leave out the tee part, so

while true; do ./co2monitor.py /dev/hidraw0 | grep --line-buffered -oP "(?<=CO2:).*" | mosquitto_pub -t CO2 -h <MQTT-Server> [-u username] [-P pw] -l -q 1 ; done

Be sure to have -q 1. Without if you do a restart of mosquitto mosquitto_pub won't notice that connection is closed and seems still sending data but no data is actually transmitted.

You can also use it with QOS 0 and xargs. However that is less efficient as mosquitto_pub is executed on every new value and has to establish a new connection on each value ./co2monitor.py /dev/hidraw0 | grep --line-buffered -oP "(?<=CO2:).*" | xargs -I % bash -c 'mosquitto_pub -h <IP of MQTT Server> -m % -t /CO2 ; echo %

tfaco2airco2ntrol_co2meter's People

Contributors

jsbergbau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tfaco2airco2ntrol_co2meter's Issues

Is it possible to write to the devices?

As a general question:
Is it possible to write to the device? E.g. setting the time with a script would be much more convenient than fiddling with the buttons.

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.