Coder Social home page Coder Social logo

esphome-component-rcxazair's Introduction

About

This implements an esphome component to read data from a cheap air quality sensor that measures temperature, humidity, as well as, more interestingly, CO2, HCHO and TVOC concentrations. I bought mine here, hopefully the link stays alive: https://aliexpress.com/item/4001342074070.html

"Air quality detector With Bluetooth 5in1 CO2 Meter Digital Temperature Humidity Sensor Tester Air Quality Monitor Carbon Dioxide TVOC HCHO Detector"

There is no clear manufacturer or device name, so this component takes its name from the companion Android app available at http://www.pgyer.com/qoWB

The default name advertised via Bluetooth for my device is "XS-####", where #### are the last 4 hex digits of its Bluetooth mac address.

Usage

Add this to your esphome .yaml:


external_components:
  - source: github://mheistermann/esphome-component-rcxazair

ble_client:
  - mac_address: B6:6B:04:.....
    id: air_quality

sensor:
  - platform: rcxazair
    ble_client_id: air_quality
    co2:
      name: "CO2"
    tvoc:
      name: "TVOC"
    formaldehyde:
      name: "HCHO"
    temperature:
      name: "Temp"
    humidity:
      name: "Relhum"

esphome-component-rcxazair's People

Contributors

kittyfort avatar mheistermann avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

kittyfort

esphome-component-rcxazair's Issues

Unable to install

Trying to activate this for a 9-1 Unit - https://www.aliexpress.com/item/1005005473581314.html?spm=a2g0o.order_list.order_list_main.11.21ef1802nmwsfM

NFO ESPHome 2023.6.4
INFO Reading configuration /config/esphome/esphome-web-bb7d28.yaml...
INFO Generating C++ source...
INFO Compiling app...
Processing esphome-web-bb7d28 (board: esp32dev; framework: arduino; platform: platformio/[email protected])

HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash

  • toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
    Dependency Graph
    |-- AsyncTCP-esphome @ 1.2.2
    |-- WiFi @ 2.0.0
    |-- FS @ 2.0.0
    |-- Update @ 2.0.0
    |-- ESPAsyncWebServer-esphome @ 2.1.0
    |-- DNSServer @ 2.0.0
    |-- ESPmDNS @ 2.0.0
    |-- noise-c @ 0.1.4
    Compiling /data/esphome-web-bb7d28/.pioenvs/esphome-web-bb7d28/src/esphome/components/rcxazair/rcxazair.cpp.o
    Compiling /data/esphome-web-bb7d28/.pioenvs/esphome-web-bb7d28/src/esphome/components/socket/bsd_sockets_impl.cpp.o
    Compiling /data/esphome-web-bb7d28/.pioenvs/esphome-web-bb7d28/src/esphome/components/socket/lwip_raw_tcp_impl.cpp.o
    Compiling /data/esphome-web-bb7d28/.pioenvs/esphome-web-bb7d28/src/esphome/components/socket/socket.cpp.o
    Compiling /data/esphome-web-bb7d28/.pioenvs/esphome-web-bb7d28/src/esphome/components/web_server_base/web_server_base.cpp.o
    Compiling /data/esphome-web-bb7d28/.pioenvs/esphome-web-bb7d28/src/esphome/components/wifi/wifi_component.cpp.o
    src/esphome/components/rcxazair/rcxazair.cpp: In member function 'virtual void esphome::rcxazair::Rcxazair::gattc_event_handler(esp_gattc_cb_event_t, esp_gatt_if_t, esp_ble_gattc_cb_param_t*)':
    src/esphome/components/rcxazair/rcxazair.cpp:44:70: error: 'class esphome::ble_client::BLEClient' has no member named 'gattc_if'; did you mean 'gattc_if_'?
    auto status = esp_ble_gattc_register_for_notify(this->parent_->gattc_if, this->parent_->remote_bda, chr->handle);
    ^~~~~~~~
    gattc_if_
    src/esphome/components/rcxazair/rcxazair.cpp:44:95: error: 'class esphome::ble_client::BLEClient' has no member named 'remote_bda'; did you mean 'remote_bda_'?
    auto status = esp_ble_gattc_register_for_notify(this->parent_->gattc_if, this->parent_->remote_bda, chr->handle);
    ^~~~~~~~~~
    remote_bda_
    Compiling /data/esphome-web-bb7d28/.pioenvs/esphome-web-bb7d28/src/esphome/components/wifi/wifi_component_esp32_arduino.cpp.o
    *** [/data/esphome-web-bb7d28/.pioenvs/esphome-web-bb7d28/src/esphome/components/rcxazair/rcxazair.cpp.o] Error 1
    ========================== [FAILED] Took 6.35 seconds ==========================

YAML is configured as ;

esphome:
name: esphome-web-bb7d28
friendly_name: Air Quality

esp32:
board: esp32dev
framework:
type: arduino

Enable logging

logger:

Enable Home Assistant API

api:
encryption:
key: "6vqaOZfxMdHlaQaKUXslR0cVEeEuvOYos+oPeT0Dzb0="

ota:

wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password

Enable fallback hotspot (captive portal) in case wifi connection fails

ap:
ssid: "Esphome-Web-Bb7D28"
password: "XXXXXXXXXXXXX"

captive_portal:

external_components:

  • source: github://mheistermann/esphome-component-rcxazair

ble_client:

  • mac_address: MAC-ADDRESS-IS-HERE-REMOVED-FOR-GIT
    id: air_quality

sensor:

  • platform: rcxazair
    ble_client_id: air_quality
    co2:
    name: "CO2"
    tvoc:
    name: "TVOC"
    formaldehyde:
    name: "HCHO"
    temperature:
    name: "Temp"
    humidity:
    name: "Relhum"

Support other RCXAZ devices, starting with the 9-in-1 sensor.

I'm just putting this issue here for others facing the same thing to have a place to track it.

I've got a 9-in-1 device. The 5-in-1 code actually works on it, because the same 5-in-1 messages are used in the 9-in-1 device. It's just that the only sensors you can utilize are those exposed through the 5-in-1 code. So your 9-in-1 will basically be limited at the moment to temp, humidity, formaldehyde, CO2 and TVOC, IIRC. They're not much more expensive than the 5-in-1 devices, which are a bit rarer, and at around $20 USD each, I imagine they're getting more popular.

I'm working on code for this device. I'm not really a frequent C++ user, so I'm taking my sweet time on it. I've already got it handling the additional message type and exposing the sensor, and have found another message type with unclear usage that I'm looking into.

Also working on documenting a bit of what I have. The RCXAZ devices basically seem to only broadcast data when paired, but any other device that broadcasts sensor data on its own in byte messages on a service characteristic when paired can function similarly. One of the planned improvement is to better log unrecognized message bytes received from this characteristic. It should make onboarding new sensor data much easier if it operates similarly.

There's also what looks like a configuration service and an OTA (well, OAD) service.

When the code for the new sensors is not embarrassing, I'll submit it in a PR for review.

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.