PiicoDev ens160 air quality sensor with ESPHome/Home Assistant

Greetings friendly makers,

I am interested in seeing if anybody has integrated the Piico Dev sensors into Home Assistant using ESPHome as I followed some online guides from github but can’t get the sensor to register properly?

I am using an Adafruit QT PY ESP32-S3 hooked up with a PiicoDeV cable and the sensor shows a green light and the initial setup works yet I get an error code that causes the Wireless Install to fail?

Any assistance would be greatly appreciated as I much prefer using an ESP32 device that I can integrate with ESPHome to use with my other sensors/cameras, etc.

I’m using the following in the YAML:

esphome:
name: sensor-ens160
friendly_name: sensor-ens160

esp32:
board: adafruit_qtpy_esp32s3_nopsram
framework:
type: arduino

i2c:
id: i2c_component
sda: 3
scl: 4
scan: True

external_components:

  • source: github://pr#4243
    components:
    • ens160

sensor:

  • platform: ens160
    eco2:
    name: “eCO2 Value”
    id: en160_sensor_eco2
    tvoc:
    name: “Total Volatile Organic Compounds”
    id: ens160_sensor_tvoc
    aqi:
    name: “Air Quality Index”
    id: ens160_sensor_aqi
    address: 0x53
    update_interval: 10s

2 Likes

Could not find any blog or video. You can post your question to home assistant community:

2 Likes

Thanks for the tip as I will try the Home Assistant Forum to hopefully find a working solution.

I suspect its something in the script as the device shows a green light but unsure why the script rejects it as I have a Grove sensor working using a QT PY ESP32-C3 without issues and the PiicoDev sensors are better value for DIY projects.

With thanks!

1 Like

Hi Razor
Have you checked for any difference in the pin connections. I just had a quick look and the connectors seem to be mirror image but in this day and age where everyone uses their own “standard” it would depend on which pin is called “1” so in this case it would depend on which pin is “1”
Cheers Bob

3 Likes

Hi @Robert93820

Its y understanding that PiicoDev supports Qwiic and STEMMA QT and the sensor displays a green light but I’m literally stumped as not sure what different cable to try and the documentation seems to be tailored for Micropython and not Arduino/ESP IDF…?

I guess I can go back to using it with a Raspberry Pi/Pico as I know that will work but not really sure how I then integrate that into my Home Assistant setup, if that’s even possible?

Thanks for the suggestions

2 Likes

I have it integrated. You can do it with MQTT or a HTTP request from a Pi/Pi Pico W. Will post my code when I get the chance. You can do either of these through WiFi or what I do is connect the Pi Pico to the computer hosting HASS and write a Python script to read the REPL, then make the HTTP request to the Home Assistant api. What are you hosting HASS on?

3 Likes

Hi Steven,

Thanks for the reply and offer as I made sure to stock up on Pico’s so the sample code would be greatly appreciated, so no rush.

I’m currently running Supervised Home Assistant on a 16GB Orange Pi 5 using Debian and have integrated some ESP32-CAMs and a Grove gas Sensor using a ESP32-C3 QT PY from Adafruit which all run fine.

I’m still new to things so appreciate any help as I’m yet to run MQTT but am more than happy to give it a good go!

Cheers

1 Like

Hi Razor,

I havent used ESPHome for any projects so not certain about the setup but the ESP32-S3 uses different pins than specified in your YAML.
Updating to the following hopefully will work!

All that was changed are the SDA and SCL pins, according to the pinout on Adafruits site
The console should also update:

Let us know how you go if it doesn’t work!

2 Likes

@Liam120347

Eureka!!! I’m really grateful for all the suggestions and who knew all I had to do was use the correct i2c pin reference as now I have my first PiicoDev sensor working within ESPHome!

I plan on adding a few more Air Quality Sensors to the home as they’re affordable so here’s hoping this helps others looking to incorporate PiicoDev into their own Home Assistant setup.

Cheers

2 Likes

Hi Razor,

Awesome! Glad to hear you got it up and running, that combo looks perfect to tuck away.

PS: I’ve got some of these clean looking enclosures at home that might work!

Liam

1 Like

Thanks for the suggestion as it saves me 3D printing some and they seem to be well priced. :ok_hand:

1 Like