As per the title has anyone got this multi sensor working with esphome? It measures temperature, humidity and gas and smoke as well asair quality.
for £6 each I think they are good value, and would work as auxiliary smoke detection for rooms that dont have nest protects.
see here https://www.amazon.co.uk/AZDelivery-AZ-Envy-ESP8266-12F-Environmental-Development/dp/B08LKRG478/ref=sr_1_2
Both the MQ-2 sensor and the HDC1080 sensor can be used with esphome, so it should work.
Thanks I think I will give it a try.
I have integrated the AZ-Envy in my hassio but it is more a dev board because the temp sensor is not working precisely. The temp sensor is near the gas sensor heater which falsifies the result. If you need more infos for the integration let me know.
Are you saying the gas sensor creates heat?
yes please could you share your config code.
Sorry for my late reply.
esphome:
name: humidity
platform: ESP8266
board: nodemcuv2
i2c:
- sda: GPIO4
scl: GPIO5
id: bus_a
sensor:
#Temperatur und Luftfeuchtigkeit
- platform: sht3xd
i2c_id: bus_a
address: 0x44
temperature:
name: "Temperatur"
id: "temperature"
filters:
- offset: -10.0
humidity:
name: "Luftfeuchtigkeit"
id: "humidity"
filters:
- offset: 8.0
update_interval: 10s
# MQ2 Smoke Gas Sensor
- platform: adc
pin: A0
name: "Gassensor"
update_interval: 10s
#filters:
# - multiply: 100
#unit_of_measurement: "%"
filters:
lambda: |-
return (x * 1024/5);
unit_of_measurement: "ppm"
icon: "mdi:percent"
# Enable logging
logger:
....
Thank you so much for your code, I can start to install them now.
Thanks a lot for your code, I could build it without any issue.
Just one question though: as for the MQ2, can you please explain the formula you are using in order to get the ppm measurement?
I am absolutely not familiar with this sensor and air quality measurement but have researched a bit on the internet (like here: MQ-2 Smoke/LPG/CO Gas Sensor Module | Sandbox Electronics ) and understand this sensor can output LPG, co and smoke ppm values.
This is normally done using a C++ library (such as this one ESP8266-AZ-Envy/lib/MQ2 at main · thorsten-l/ESP8266-AZ-Envy · GitHub) I would like to reproduce the same with ESPHome (getting the 3 values) but I am really new to HA / ESPHome and don’t really understand how those kind of C/C++ libs can be used.
Anyway my first question to you is about the calculation / formula you are using and whether it is related to LPG measurement as per the library mentioned above
Thanks a lot!
I guess I understand: x * 1024/5 is supposed to return the 10bits analog value…this is nothing to do with ppm measurement right?
Also I noticed the pin A0 by default is not returning the 10bit 0 to 1024 value but it is returning the voltage input of the A0 analog input which is between 0 and 1 (reason why your commented lines are multiplying by 100 to get a range between 0 and 100%).
In any case it does not really matter as it is not possible to measure the real volume of the various elements this sensor is supposed to measure. What is interesting I guess is to check what would be a ‘safe’ range and create automation alerts when the threshold is reached.
There is a good article on these devices here https://lastminuteengineers.com/mq2-gas-senser-arduino-tutorial/
Yes an esp8266 returns a value between 0.0 and 1.0 for adc, unless some voltage dividers are used. The esp32 works a bit different - see Analog To Digital Sensor — ESPHome
There a number of gas/aqi sensors supported on esphome. See ESPHome — ESPHome
Thanks for the explanation.
What I don’t get though is why the ADC pin is returning a voltage value (between 0 and 1v). I understood you feed the ADC pin with 0 to 1v but it is supposed to return a converted value between 0 and 1024?
Why then is it returning the voltage value applied to the pin?
As I understand it you can get the 0-1023 value by using the raw option.
Thanks a lot, I’ll have a look at this raw option!
looks like this is more applicable to ESP32s than ESP8266s.
I guess I will stick with the current 0-1v measurement as it is then easy to convert it to 0-100% (I understand it is not possible to get an approx ppm measurement as you need to use a dedicated c library for this).
Just a pity this module is really not accurate (temp and hum)
Anyways, thanks a lot for your help!
Raw applies to all 3 available ie esp8266, esp32 or rp2040.
Do you have a reference to this library?
ok thanks for the info.
Here is the link to the lib:
My Config
substitutions:
name: esphome-az-envy-uno
room: STUDIO
boardPlatform: ESP8266
boardName: nodemcuv2
temperature_offset: "-10.0"
humidity_offset: "8.0"
esphome:
name: ${name}
friendly_name: AZ-Envy Uno ${room}
platform: ${boardPlatform}
board: ${boardName}
# Enable logging
logger:
# Enable Home Assistant API
api:
ota:
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
fast_connect: on
manual_ip:
# Set this to the IP of the ESP
static_ip: 192.168.178.128
# Set this to the IP address of the router. Often ends with .1
gateway: !secret gateway_secret
# The subnet of the network. 255.255.255.0 works for most home networks.
subnet: !secret subnet_secret
dns1: !secret gateway_secret
ap:
ssid: "AZENVY-UNO-AP"
password: !secret wifi_password
web_server:
port: 80
i2c:
- sda: GPIO4
scl: GPIO5
id: bus_a
sensor:
- platform: sht3xd
i2c_id: bus_a
address: 0x44
temperature:
name: "Temperatura ${room}"
id: "temperatura"
filters:
- offset: ${temperature_offset}
humidity:
name: "Umidità ${room}"
id: "umidita"
filters:
- offset: ${humidity_offset}
update_interval: 10s
- platform: adc
pin: A0
name: "Gas Sensore ${room}"
id: "gas_sensore"
update_interval: 10s
filters:
lambda: |-
return (x * 1024/5);
unit_of_measurement: "ppm"
icon: "mdi:meter-gas"
- platform: adc
pin: VCC
name: "VCC Voltage ${name} ${room}"
- platform: uptime
name: Uptime
# WiFi Signal sensor.
- platform: wifi_signal
name: ${name} ${room} WiFi Signal
update_interval: 60s
binary_sensor:
- platform: analog_threshold
name: "Pericolo Gas ${room}"
sensor_id: gas_sensore
threshold: 500.0
- platform: status
name: "${name} ${room} Status"
switch:
- platform: restart
name: "Restart ${name} ${room}"
Hm regarding to the temperatureproblem - this may depent how the Sensors are oriented.
E.g. if the pcb is hanging in the wall and the GAS Sensor below the temperature sensor the heat flows up and irritates the temp sensor if you turn it, so the tempsensor is below the gassensor it might be less irritating.
Hack solution relocate the sensor anywher far away from the gassensor and wire it up to the old pads. I have ordered one, lets see how it works and then I can test my guessings and also test the relocating stuff