Strange behavior MH-Z19B sensor

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
ManS-H
Normal user
Posts: 279
Joined: 27 Dec 2015, 11:26
Location: the Netherlands

Strange behavior MH-Z19B sensor

#1 Post by ManS-H » 18 Apr 2021, 11:53

What is best to use in combination ESPEasy and MH-Z19B and Domoticz, air quality or custom sensor?
I have two CO2 sensors, the first one worked perfectly with air quality from March 18 to April 7, then it did not constantly refresh the data in Domoticz, now switched to custom sensor.
The second one works perfectly with air quality.

My question, what can this be due to and which one is preferred?
Personally, I like the air quality one better because it makes the quality visible.

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Strange behavior MH-Z19B sensor

#2 Post by TD-er » 18 Apr 2021, 13:11

I wonder why it was working as an air quality sensor in the first place.
Domoticz does have a sensor type "CO2", but that one does need "the other" type we're sending (either we're sending the Nvalue and it needs the Svalue or vice verse) so that would not have worked at all.
Not sure what a sensor type "Air quality" in domoticz needs.

Using a "custom" sensor type will work anyway.

User avatar
ManS-H
Normal user
Posts: 279
Joined: 27 Dec 2015, 11:26
Location: the Netherlands

Re: Strange behavior MH-Z19B sensor

#3 Post by ManS-H » 18 Apr 2021, 18:23

TD-er wrote: 18 Apr 2021, 13:11 I wonder why it was working as an air quality sensor in the first place.
Domoticz does have a sensor type "CO2", but that one does need "the other" type we're sending (either we're sending the Nvalue and it needs the Svalue or vice verse) so that would not have worked at all.
Not sure what a sensor type "Air quality" in domoticz needs.

Using a "custom" sensor type will work anyway.
What i read in several fora is that most people used the Air Quality for the MH-Z19b sensor
air.jpg
air.jpg (6.66 KiB) Viewed 7958 times

But what option do you suggest for the MH-Z19B? sensor type "CO2" i can't find in Domoticz

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Strange behavior MH-Z19B sensor

#4 Post by TD-er » 18 Apr 2021, 19:06

Use "Custom" sensor type in Domoticz.
That's working fine for over 3 years on my setup.

User avatar
ManS-H
Normal user
Posts: 279
Joined: 27 Dec 2015, 11:26
Location: the Netherlands

Re: Strange behavior MH-Z19B sensor

#5 Post by ManS-H » 18 Apr 2021, 19:19

TD-er wrote: 18 Apr 2021, 19:06 Use "Custom" sensor type in Domoticz.
That's working fine for over 3 years on my setup.
Ok, thanks.

GravityRZ
Normal user
Posts: 206
Joined: 23 Dec 2019, 21:24

Re: Strange behavior MH-Z19B sensor

#6 Post by GravityRZ » 19 Apr 2021, 18:31

i would use the air quality sensor in domoticz
it's graphs are way better and it actually talks about CO2

this sensor needs the nvalue so you need to use the rules

Publish domoticz/in,'{"idx":349,"nvalue":[Slaapkamer#PPM],"svalue":""}' // CO2 sensor in domoticz needs Nvalue
or
SendToHTTP 192.168.1.50,8084,/json.htm?type=command&param=udevice&idx=349&nvalue=[Slaapkamer#PPM]&svalue=0

now that the weather is getting better i also notice the levels at night rise.
good to know that the sensor is still measuring higher levels

regarding barometer or co2 sensors not working
i have noticed that most of the time they really need both variables so the nvalue as well as the svalue.
even if it only uses the nvalue it is better to also send out the svalue along(as 0)

the barometer sensors especially are sensitive to this because they use the second value as a device status
without this status domoticz will react strange ort not at all

co2.JPG
co2.JPG (38.81 KiB) Viewed 7929 times
air.JPG
air.JPG (20.73 KiB) Viewed 7925 times

User avatar
ManS-H
Normal user
Posts: 279
Joined: 27 Dec 2015, 11:26
Location: the Netherlands

Re: Strange behavior MH-Z19B sensor

#7 Post by ManS-H » 20 Apr 2021, 11:17

GravityRZ wrote: 19 Apr 2021, 18:31 i would use the air quality sensor in domoticz
it's graphs are way better and it actually talks about CO2

this sensor needs the nvalue so you need to use the rules

Publish domoticz/in,'{"idx":349,"nvalue":[Slaapkamer#PPM],"svalue":""}' // CO2 sensor in domoticz needs Nvalue
or
SendToHTTP 192.168.1.50,8084,/json.htm?type=command&param=udevice&idx=349&nvalue=[Slaapkamer#PPM]&svalue=0

now that the weather is getting better i also notice the levels at night rise.
good to know that the sensor is still measuring higher levels

regarding barometer or co2 sensors not working
i have noticed that most of the time they really need both variables so the nvalue as well as the svalue.
even if it only uses the nvalue it is better to also send out the svalue along(as 0)

the barometer sensors especially are sensitive to this because they use the second value as a device status
without this status domoticz will react strange ort not at all


co2.JPG
air.JPG
Thanks for the answer, it was more a Domoticz problem. When i look at the log files of both sensors they working well in ESPEasy. The problem started here when i used the second CO2 sensor. I will try your rule instead of the one i used.
This is my rule: SendToHTTP,192.168.178.53,8080,/json.htm?param=udevice&type=command&idx=4568&nvalue=[CO2#PPM]

TD-er
Core team member
Posts: 8643
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Strange behavior MH-Z19B sensor

#8 Post by TD-er » 20 Apr 2021, 11:25

Yep, you must make sure not to have an IDX conflict or else things may go wrong.

User avatar
ManS-H
Normal user
Posts: 279
Joined: 27 Dec 2015, 11:26
Location: the Netherlands

Re: Strange behavior MH-Z19B sensor [Solved]

#9 Post by ManS-H » 04 May 2021, 13:42

I believe my problem is solved since i unchecked the send to controller box.
MH-Z19B.jpg
MH-Z19B.jpg (127.46 KiB) Viewed 7531 times
Together with this rule,
on CO2#PPM do
SendToHTTP,192.168.178.53,8080,/json.htm?param=udevice&type=command&idx=4578&nvalue=[CO2#PPM]&svalue=0
endon

Now it's works perfect in Domoticz, Air Quality Voltcraft CO-20

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 22 guests