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.
For this to work, the Aranet4 needs
- to have the firmware version v1.2.0 or greater and
- Smart Home integration must be enabled.
Both of these things can be checked in the Aranet4 Android/iOS mobile app.
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.
When set up correctly, the following sensors will be created within the ESPHome integration:
CO2
: CO2 concentration in ppmTemperature
: Temperature in °C (will be converted to °F if your Home Assistant is configured that way)Humidity
: Humidity in %Pressure
: Air pressure in hPaBattery
: Battery level in %Status
: CO2 status (1 -> Good, 2 -> Average, 3 -> Unhealthy)Interval
: Measurement interval in seconds (can be configured in the app)Ago
: Time since last measurement in seconds
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 %}
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.