ESP8266 Air quality sensor

Everything about esp8266 and more.

Moderator: leecollings

astrapowerrr
Posts: 141
Joined: Tuesday 31 January 2017 20:34
Target OS: -
Domoticz version:
Contact:

Re: ESP8266 Air quality sensor

Post by astrapowerrr »

astrapowerrr wrote:
I think that disappeared at some point with an upgrade as I don't see them either anymore in the graph.
Looking at the code in js/domoticz.js, it seems the logic is still there but it is not showing up in the graph. I don't know enough of this part of the setup so hope somebody else can chime in here.

Jos[/quote]

Well i hope that too.
But for now I’m satisfied with a working esp board!! Thanks for your help.

Will try searching the forum for the graph.
Is on my later to do list.

Marco


Verzonden vanaf mijn iPhone met Tapatalk[/quote]

Just something I bumped into.
On iPhone no text in graph.
But on iPad it gives me the text in the graph...

Don’t know what the difference is...


Verzonden vanaf mijn iPhone met Tapatalk
User avatar
jvdz
Posts: 2441
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: ESP8266 Air quality sensor

Post by jvdz »

astrapowerrr wrote: Wednesday 30 January 2019 21:01 Just something I bumped into.
On iPhone no text in graph.
But on iPad it gives me the text in the graph...

Don’t know what the difference is...
This made me check with Edge and that browser is nicely displaying the words on the graph as well. So maybe a Chrome thing?

Jos
User avatar
jvdz
Posts: 2441
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: ESP8266 Air quality sensor

Post by jvdz »

Applying this workaround in domoticz.js does fix this issue of not showing the text: https://github.com/highcharts/highchart ... -424353401

-or- highcharts needs to be updated.

Jos
astrapowerrr
Posts: 141
Joined: Tuesday 31 January 2017 20:34
Target OS: -
Domoticz version:
Contact:

Re: ESP8266 Air quality sensor

Post by astrapowerrr »

jvdz wrote:Applying this workaround in domoticz.js does fix this issue of not showing the text: https://github.com/highcharts/highchart ... -424353401

-or- highcharts needs to be updated.

Jos
Hahah sorry but that is abracadabra for me...


Verzonden vanaf mijn iPhone met Tapatalk
User avatar
jvdz
Posts: 2441
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: ESP8266 Air quality sensor

Post by jvdz »

I thought the same but after a little research found that at the top in file domoticz.js (line 18) found in /domoticz/www/js you can add this like below.
Then restart domoticz and clear your browser cache before loading the webpage again:

Code: Select all

// Add custom behaviour to highcharts.
if (typeof (Highcharts) !== 'undefined') {
    if (typeof (Storage) !== 'undefined') {
        (function (H_) {
            /*
                    // Use this code to debug excessive redrawing of graphs.
                    H_.wrap( H_.Chart.prototype, 'redraw', function ( fProceed_ ) {
                        console.log( 'draw ' + $( this.container ).parent().attr( 'id' ) );
                        fProceed_.apply( this, Array.prototype.slice.call( arguments, 1 ) );
                    } );
            */

                // Drop-in fix for Highcharts issue #8477 on older Highcharts versions. The
                // issue is fixed since Highcharts v6.1.1.
                Highcharts.wrap(Highcharts.Axis.prototype, 'getPlotLinePath', function(proceed) {
                    var path = proceed.apply(this, Array.prototype.slice.call(arguments, 1));
                    if (path) {
                        path.flat = false;
                    }
                    return path;
                });

                H_.wrap(H_.Series.prototype, 'setVisible', function (fProceed_) {
Jos
astrapowerrr
Posts: 141
Joined: Tuesday 31 January 2017 20:34
Target OS: -
Domoticz version:
Contact:

Re: ESP8266 Air quality sensor

Post by astrapowerrr »

jvdz wrote:I thought the same but after a little research found that at the top in file domoticz.js (line 18) found in /domoticz/www/js you can add this like below.
Then restart domoticz and clear your browser cache before loading the webpage again:

Code: Select all

// Add custom behaviour to highcharts.
if (typeof (Highcharts) !== 'undefined') {
    if (typeof (Storage) !== 'undefined') {
        (function (H_) {
            /*
                    // Use this code to debug excessive redrawing of graphs.
                    H_.wrap( H_.Chart.prototype, 'redraw', function ( fProceed_ ) {
                        console.log( 'draw ' + $( this.container ).parent().attr( 'id' ) );
                        fProceed_.apply( this, Array.prototype.slice.call( arguments, 1 ) );
                    } );
            */

                // Drop-in fix for Highcharts issue #8477 on older Highcharts versions. The
                // issue is fixed since Highcharts v6.1.1.
                Highcharts.wrap(Highcharts.Axis.prototype, 'getPlotLinePath', function(proceed) {
                    var path = proceed.apply(this, Array.prototype.slice.call(arguments, 1));
                    if (path) {
                        path.flat = false;
                    }
                    return path;
                });

                H_.wrap(H_.Series.prototype, 'setVisible', function (fProceed_) {
Jos
Thanks.
I will look at it when I have some Domoticz time leftImage


Verzonden vanaf mijn iPhone met Tapatalk
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: ESP8266 Air quality sensor

Post by sincze »

Just to be sure.. Should I buy the MH-Z19 or the MH-Z19b
MH-Z19B.JPG
MH-Z19B.JPG (28.52 KiB) Viewed 2872 times
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
User avatar
jvdz
Posts: 2441
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: ESP8266 Air quality sensor

Post by jvdz »

sincze wrote: Saturday 16 February 2019 11:21 Just to be sure.. Should I buy the MH-Z19 or the MH-Z19b
MH-Z19B.JPG
I am using the MH-Z19b and have no experience with the MH-Z19.

Jos
astrapowerrr
Posts: 141
Joined: Tuesday 31 January 2017 20:34
Target OS: -
Domoticz version:
Contact:

Re: ESP8266 Air quality sensor

Post by astrapowerrr »

sincze wrote:Just to be sure.. Should I buy the MH-Z19 or the MH-Z19b
MH-Z19B.JPG
Same here. Only experience with the b version.
And it works fine.


Verzonden vanaf mijn iPhone met Tapatalk
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: ESP8266 Air quality sensor

Post by sincze »

jvdz wrote: Friday 03 November 2017 17:27 Hi Matty,

No problem. We can do that here so others can also benefit from it... and maybe later convert that into a Wiki page once we have nailed down the appropriate process.
So lets start simple and work our way into the details depending on how far you are already.
Components used:
  • Wemos D1 mini - https://wiki.wemos.cc/products:d1:d1_mini
  • MH-Z19(b) (Either A or B version will work. I have a B version)
  • ESPEasy - Latest Mega version will work but won't update via HTTP JSON with the standard settings. My version does work with JSON. So the below only works with my GIT version at this moment.
Assembling
Connect the following:
MH-Z19 Tx → Wemos pin D5
MH-Z19 Rx → Wemos pin D6
MH-Z19 gnd → Wemos gnd pin
MH-Z19 vin → Wemos 5V pin (Only for MHZ19B, else 3.3V if I remember correctly!)
Excellent description.
Do you have images of the end result of all the sensors in a nice box for example ? :D
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
User avatar
jvdz
Posts: 2441
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: ESP8266 Air quality sensor

Post by jvdz »

sincze wrote: Sunday 17 February 2019 9:44 Do you have images of the end result of all the sensors in a nice box for example ? :D
Nothing fancy really. I've made a small wooden box that allows the air in and painted that white.:
HK-AIR-front.jpg
HK-AIR-front.jpg (7.43 KiB) Viewed 2829 times
HK-AIR-back.jpg
HK-AIR-back.jpg (33.21 KiB) Viewed 2829 times
Jos :-)
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: ESP8266 Air quality sensor

Post by sincze »

It looks promissing at least :lol:
esp-co2.JPG
esp-co2.JPG (22.11 KiB) Viewed 2693 times
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
User avatar
jvdz
Posts: 2441
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: ESP8266 Air quality sensor

Post by jvdz »

mmm 5000ppm is a "little" high. :shock:

Jos
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: ESP8266 Air quality sensor

Post by sincze »

jvdz wrote:mmm 5000ppm is a "little" high. :shock:

Jos
Oh oh. Maybe the thing is broken?Image

Sent from my ONEPLUS A6003 using Tapatalk

Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: ESP8266 Air quality sensor

Post by sincze »

Maybe I need to re-calibrate?? Just got a bit lost here with the 5000 all over the time.


Sensor & ESP are powered with 12v -> 5v powersupply (separate)
esp-co2-v1.JPG
esp-co2-v1.JPG (158.8 KiB) Viewed 2657 times
It now says...
Checksum (pass/fail/reset): 13/1/1


As stated here:
https://www.letscontrolit.com/forum/vie ... 785#p26804

I opened a window.
Waited 20 min.
Then Made a connection with DUPONT cable between HD & GND for 7 seconds.
Wait.....
PPM is now going down 5000 -> 4200 -> 3498.
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
User avatar
jvdz
Posts: 2441
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: ESP8266 Air quality sensor

Post by jvdz »

You might want to switch on the ABC for a while to let it recalibrate and then switch that off again.
I have never had to do that so have no real experience but you can probably find more info here https://gathering.tweakers.net/forum/li ... 3#56801303

Jos
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: ESP8266 Air quality sensor

Post by sincze »

jvdz wrote: Monday 18 March 2019 20:09 You might want to switch on the ABC for a while to let it recalibrate and then switch that off again.
I have never had to do that so have no real experience but you can probably find more info here https://gathering.tweakers.net/forum/li ... 3#56801303

Jos
Used the method to connect the 2 pins together ;-) and voila.
esp-co2-v2.JPG
esp-co2-v2.JPG (17.22 KiB) Viewed 2652 times
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: ESP8266 Air quality sensor

Post by sincze »

Got it :D
Used some rules to siend over the data.

Code: Select all

On System#Boot do     							// When the ESP boots, do
   TimerSet,1,60 							// Set Timer 1 for the next event in 60 seconds
EndOn

on Rules#Timer=1 do  							// When Timer 1 expires, do
	SendToHTTP 192.*.*.*,8080,/json.htm?type=command&param=udevice&idx=21&nvalue=[ESP-CO2#PPM]
	SendToHTTP 192.*.*.*,8080,/json.htm?type=command&param=udevice&idx=22&nvalue=0&svalue=[ESP-CO2#Temperature]
	SendToHTTP 192.*.*.*,8080,/json.htm?type=command&param=udevice&idx=23&svalue=[Sensor_BH1750#Lux]
	SendToHTTP 192.*.*.*,8080,/json.htm?type=command&param=udevice&idx=24&nvalue=0&svalue=[RSSI#RSSI]
	endif
	TimerSet,1,60      							// Set Timer 1 for the next event in 60 seconds
endon
CO2-result.png
CO2-result.png (36.26 KiB) Viewed 2648 times
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
User avatar
sincze
Posts: 1302
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: ESP8266 Air quality sensor

Post by sincze »

To get this to work if the Sensor is in a VLAN is a totally different story.

Code: Select all

SendToHTTP 192.*.*.*,8080,/json.htm?type=command&param=udevice&idx=21&nvalue=[ESP-CO2#PPM]
Does not handle the required authentication.
In addition ESP Easy can not set the nvalue directly from a main device.
https://github.com/letscontrolit/ESPEasy/issues/232

Quick work around...
- Create some Generic Dummy devices in ESPEASY to store the values you want to transfer in an authenticated way.
- Configure the Controller in ESPEASY with appropriate authentication fields (username and password)
- Create a custom sensor in Domoticz and store the PPM there. Have LUA or DZVENTS move it to a real Air Quality meter.
nvalue_cheated.JPG
nvalue_cheated.JPG (28.09 KiB) Viewed 2628 times

Code: Select all

commandArray = {}

-- loop through all the changed devices
for deviceName,deviceValue in pairs(devicechanged) do
    if (deviceName=='PPM_C') then
        devvalue=tostring(deviceValue)
        devidx=** -- your IDX of Dummy Air Quality Meter
        commandArray['UpdateDevice']=devidx .. "|" .. devvalue .. "|0"
    end
end

return commandArray
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
User avatar
jvdz
Posts: 2441
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: ESP8266 Air quality sensor

Post by jvdz »

The version I have made doesn't need the rules and can use the normal domoticz controller config. ;)

Jos
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest