Technically this is easy as pie. Connect Vcc (5V!) and ground, and the two data lines to two GPIO's (D7 and D8 in my setup).
In Domoticz create an "Air quality" device, and in ESP Easy a device for the hardware (using the idx from Domoticz). Looking at the ESP Easy interface I could see the Co2 value, in Domoticz it stayed zero.
Then tried a "custom sensor" in Domoticz, and the value came in very nicely. But not in the correct format where a value gets a textual property: excellent, fair, etcetera.
So I created a small script that copies the value into the "air quality" device. That works. Not a real solution, but more of a workaround. OK for now.
Here's the script:
Code: Select all
-- this script will copy CO2 values from the hidden custom-sensor device into the AIrQuality device
commandArray = {}
if devicechanged['$Dummy CO2'] then
val = tonumber(otherdevices_svalues['$Dummy CO2'])
commandArray['UpdateDevice'] = otherdevices_idx['SenseAir S8 CO2']..'|'..val..'|0'
end
-- commandArray['UpdateDevice'] = otherdevices_idx['SenseAir S8 CO2']..'|999|0'
return commandArray
![Lach :)](./images/smilies/icon_e_smile.gif)
Here's the rule (including a line for my BMP085):
Code: Select all
On System#Boot do
timerSet,1,30
endon
On Rules#Timer=1 do
SendToHTTP,10.0.0.199,8080,/json.htm?type=command¶m=udevice&idx=1808&nvalue=0&svalue=[BMP085#Temperature];[BMP085#Pressure];0
SendToHTTP,10.0.0.199,8080,/json.htm?type=command¶m=udevice&idx=1806&nvalue=[S8#PPM]
timerSet,1,30
endon
I put the whole setup in my living room and let it measure for a while.
What strikes me is how easy it is to draw conclusions. Also, how "different" this sensor is. I don't know for sure, but I suspect many of us are "techies": we love to play around with things and make it work, and then sort-of loose interest. The fun is in the building of the unit.
But this is different.
I can draw conclusions from the measurements, and can see new applications on the horizon.
Look at the graph below, specifically the last two days (the graph before that is contaminated by measurements during setup).
![Image](%5Battachment=0%5DSchermafdruk%202017-08-21%2023.38.54.png%5B/attachment%5D)
I can see the CO2 value being low, until the evening starts (this is when we are in the living room, two adults). Then around midnight we turn in and the value slowly drops. In the morning, I get up and open up the large doors to the garden to let the summer in: the CO2 value immediately sharply drops.
How can we use this: rising CO2 value indicates people present, and could influence the switching of lights (OK, I admit: there are better ways to do this). But more importantly, I could link the value of the CO2 level to a ventilation system: turn it on when the value rises above a set value, turn it off when it is under another set level.
The only downside of this sensor: it is not cheap. I found prices in China of $54 and up. A steep price, but when you think of what this little device does...
![Lach :)](./images/smilies/icon_e_smile.gif)
(As soon as I have some time, I will update the Wiki page for this setup)