Page 1 of 1

Strange behavior MH-Z19B sensor

Posted: 18 Apr 2021, 11:53
by ManS-H
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.

Re: Strange behavior MH-Z19B sensor

Posted: 18 Apr 2021, 13:11
by TD-er
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.

Re: Strange behavior MH-Z19B sensor

Posted: 18 Apr 2021, 18:23
by ManS-H
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 8227 times

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

Re: Strange behavior MH-Z19B sensor

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

Re: Strange behavior MH-Z19B sensor

Posted: 18 Apr 2021, 19:19
by ManS-H
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.

Re: Strange behavior MH-Z19B sensor

Posted: 19 Apr 2021, 18:31
by GravityRZ
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 8198 times
air.JPG
air.JPG (20.73 KiB) Viewed 8194 times

Re: Strange behavior MH-Z19B sensor

Posted: 20 Apr 2021, 11:17
by ManS-H
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]

Re: Strange behavior MH-Z19B sensor

Posted: 20 Apr 2021, 11:25
by TD-er
Yep, you must make sure not to have an IDX conflict or else things may go wrong.

Re: Strange behavior MH-Z19B sensor [Solved]

Posted: 04 May 2021, 13:42
by ManS-H
I believe my problem is solved since i unchecked the send to controller box.
MH-Z19B.jpg
MH-Z19B.jpg (127.46 KiB) Viewed 7800 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