stefanthoss / esphome-aranet4

Read data from an Aranet4 CO2 sensor and expose it in Home Assistant
BSD 2-Clause "Simplified" License
16 stars 0 forks source link
aranet4 ble esphome home-assistant

ESPHome Aranet4

This ESPHome package will read data from an Aranet4 CO2 sensor and expose it as Home Assistant entities. I use a ESPHome Bluetooth Proxy with a ESP32 because it is easy to set up, but any other Bluetooth-enabled ESPHome device will also work.

I developed this for the Aranet4 Home, but it should also work with the Pro model. In its current form, only one Aranet4 sensor is supported per ESPHome device.

Requirements

For this to work, the Aranet4 needs

Both of these things can be checked in the Aranet4 Android/iOS mobile app.

Usage

First, you have to figure out the MAC address of your Aranet4 device. You can do this by pairing your phone with the Aranet4 and checking the MAC address in your phone's Bluetooth settings, or use a BLE scanner app.

Then, add the follow configuration to your ESPHome:

substitutions:
  aranet4_name: "Aranet4 Home"
  aranet4_mac_address: "XX:XX:XX:XX:XX:XX"
packages:
  stefanthoss.esphome-aranet4: github://stefanthoss/esphome-aranet4/esphome-aranet4.yaml@main

The aranet4_name parameter is used to name the sensor in Home Assistant. aranet4_mac_address should be the MAC address of your Aranet4.

Home Assistant Sensors

When set up correctly, the following sensors will be created within the ESPHome integration:

Mapping Status in Home Assistant

You can create a template sensor that maps the Status sensor's integer value to readable text:

template:
  - sensor:
      - name: "Aranet4 Home Indicator"
        state_class: "measurement"
        state: >
          {% if states('sensor.aranet4_home_status') | int == 1 %}
            Good
          {% elif states('sensor.aranet4_home_status') | int == 2 %}
            Average
          {% elif states('sensor.aranet4_home_status') | int == 3 %}
            Unhealthy
          {% endif %}

Source

I have most of my knowledge about how to parse the Aranet4 Bluetooth data from the Aranet4-Python project, specifically the lines of code that decode the 13-Byte vector that Aranet4 returns.