Re: [TUTO] AirCan - Mesure qualité de l'air
Publié : 21 déc. 2017, 20:31
Si l'un d'entre vous se lance, tenez-moi au courant de vos aventures ! 
Reprenez le contrôle de votre domotique
https://easydomoticz.com/forum/


Salut Jeff,Jeff a écrit :Bravo, superbe réalisation![]()
1 question , c'est quoi le bloc orange avec les trous, un bornier de connexion ?
Le boitier est il disponible sans les gravures du dessus : by steph D n'est pas super discret
Exact c'est un minibreadtotof60 a écrit :Je pense que tu parles de la mini breadboard.
C'est utile pour dupliquer le gnd ou le +5v
Mais je conseille au final de souder sur un pcb
le lien tindie vers les pcb : https://www.tindie.com/products/DrAzzy/ ... t-only-6-/
Code : Tout sélectionner
--[[
name : script_time_qualite_air_maison.lua
auteur : Stef D.
Version : 4.0
date de création : 21/12/2017
Date de mise à jour : 25/04/2018
Principe : Ce script récupère les infos de poussières du capteur SDS011 et les envoie dans les bon customs sensor.
Déduit l'indice de qualité de l'air en fonction des poussières et du CO2 en prenant en compte prioritairement le CO2.
Pilote également les LED intégrées au Air Can avec un interupteur virtuel pour les couper la nuit.
URL du projet : https://easydomoticz.com/forum/viewtopic.php?f=24&t=5520
]]--
--------------------------------------------
------------ Variables à éditer ------------
--------------------------------------------
local pm = 'test AirCan' -- renseigner le nom du device température + humidité utilisé pour l'envoie des infos poussière
local pm10 = 1600 -- renseigner l'idx du device taux de particules
local pm25 = 1601 -- renseigner l'idx du device taux de particules
local qualite = 1602 -- renseigner l'idx du device texte
local ip_sens = '192.168.1.21' -- renseigner l'adresse IP de la AirCan
local co2 = 'CO2 AirCan' -- renseigner le nom de votre dummy sensor utilisé pour la valeur CO2
--------------------------------------------
----------- Fin variables à éditer ---------
--------------------------------------------
commandArray = {}
now = os.date("*t")
if now.min%3 == 0 then -- Toutes les 3 minutes
val_PM25, val_PM10, etat1= otherdevices_svalues[pm]:match("([^;]+);([^;]+)")
--print("PM10 : "..val_PM10);
--print("PM2.5: "..val_PM25);
if pm10 ~= nil then
commandArray[1]={['UpdateDevice']= pm10 .. "|0|" .. val_PM10}
end
if pm25 ~= nil then
commandArray[2]={['UpdateDevice']= pm25 .. "|0|" .. val_PM25}
end
val_10 = tonumber(val_PM10)
if (val_10 < 13) then coefpm10 = 1
elseif ( 12 < val_10) and (val_10 < 27) then coefpm10 = 2
elseif ( 26 < val_10) and (val_10 < 34) then coefpm10 = 3
elseif ( 33 < val_10) and (val_10 < 49) then coefpm10 = 4
elseif ( 48 < val_10) and (val_10 < 79) then coefpm10 = 5
elseif ( val_10 > 78) then coefpm10 = 6
end
val_25 = tonumber(val_PM25)
if (val_25 < 23) then coefpm25 = 1
elseif ( 22 < val_25) and (val_25 < 41) then coefpm25 = 2
elseif ( 40 < val_25) and (val_25 < 47) then coefpm25 = 3
elseif ( 46 < val_25) and (val_25 < 58) then coefpm25 = 4
elseif ( 57 < val_25) and (val_25 < 69) then coefpm25 = 5
elseif ( val_10 > 68) then coefpm25 = 6
end
--print("*********************coef PM10 : "..coefpm10)
--print("*********************coef PM2.5 : "..coefpm25)
if (coefpm10 > coefpm25) then val_iqa = coefpm10
elseif (coefpm10 < coefpm25) then val_iqa = coefpm25
else val_iqa = coefpm10
end
val_co2 = tonumber(otherdevices_svalues[co2])
--print(val_co2)
if (val_co2 > 1000) and (val_co2 < 1100) then val_iqa = 3
elseif (val_iqa <= 4) and (val_co2 > 1099) and (val_co2 < 1200) then val_iqa = 4
elseif (val_iqa <= 5) and (val_co2 > 1199) and (val_co2 < 1600) then val_iqa = 5
elseif (val_iqa <= 6) and (val_co2 > 1599) then val_iqa = 6
end
--print(val_iqa)
if val_iqa == 1 and (otherdevices['OnOffLed'] == 'On') then commandArray[3]={['OpenURL'] = ip_sens..'/control?cmd=NeoPixelAll,0,0,255' }
elseif val_iqa == 2 and (otherdevices['OnOffLed'] == 'On') then commandArray[4]={['OpenURL'] = ip_sens..'/control?cmd=NeoPixelAll,0,127,255' }
elseif val_iqa == 3 and (otherdevices['OnOffLed'] == 'On') then commandArray[5]={['OpenURL'] = ip_sens..'/control?cmd=NeoPixelAll,0,125,0' }
elseif val_iqa == 4 and (otherdevices['OnOffLed'] == 'On') then commandArray[6]={['OpenURL'] = ip_sens..'/control?cmd=NeoPixelAll,255,255,0' }
elseif val_iqa == 5 and (otherdevices['OnOffLed'] == 'On') then commandArray[7]={['OpenURL'] = ip_sens..'/control?cmd=NeoPixelAll,231,62,1' }
elseif val_iqa == 6 and (otherdevices['OnOffLed'] == 'On') then commandArray[8]={['OpenURL'] = ip_sens..'/control?cmd=NeoPixelAll,175,0,0' }
elseif (otherdevices['OnOffLed'] == 'Off') then commandArray[9]={['OpenURL'] = ip_sens..'/control?cmd=NeoPixelAll,0,0,0' }
end
if val_iqa == 1 then texte = 'TRES BON'
elseif val_iqa == 2 then texte = 'BON'
elseif val_iqa == 3 then texte = 'MOYEN'
elseif val_iqa == 4 then texte = 'MEDIOCRE'
elseif val_iqa == 5 then texte = 'MAUVAIS'
elseif val_iqa == 6 then texte = 'TRES MAUVAIS'
end
--print(texte)
commandArray['UpdateDevice'] = qualite..'|0|'..texte
end
return commandArrayCode : Tout sélectionner
--[[
name : script_time_qualite_air_maison.lua
auteur : Stef D.
Mise à jour : Rominic
Version : 4.0
date de création : 21/12/2017
Date de mise à jour : 04/02/2019
Principe : Ce script récupère les infos de poussières du capteur SDS011 et les envoie dans les bon customs sensor.
Déduit l'indice de qualité de l'air en fonction des poussières et du CO2 en prenant en compte prioritairement le CO2.
Pilote également les LED intégrées au Air Can avec un interupteur virtuel pour les couper la nuit.
URL du projet : https://easydomoticz.com/forum/viewtopic.php?f=24&t=5520
]]--
--------------------------------------------
------------ Variables à éditer ------------
--------------------------------------------
local pm = 'test AirCan' -- renseigner le nom du device température + humidité utilisé pour l'envoie des infos poussière
local pm10 = 1600 -- renseigner l'idx du device taux de particules
local pm25 = 1601 -- renseigner l'idx du device taux de particules
local qualite = 1602 -- renseigner l'idx du device texte
local ip_sens = '192.168.1.21' -- renseigner l'adresse IP de la AirCan
local co2 = otherdevices_svalues['CO2 AirCan']:match("([^;]+)") -- renseigner le nom de votre dummy sensor utilisé pour la valeur CO2
--------------------------------------------
----------- Fin variables à éditer ---------
--------------------------------------------
commandArray = {}
now = os.date("*t")
if now.min%3 == 0 then -- Toutes les 3 minutes
val_PM25, val_PM10, etat1= otherdevices_svalues[pm]:match("([^;]+);([^;]+)")
--print("PM10 : "..val_PM10);
--print("PM2.5: "..val_PM25);
if pm10 ~= nil then
commandArray[1]={['UpdateDevice']= pm10 .. "|0|" .. val_PM10}
end
if pm25 ~= nil then
commandArray[2]={['UpdateDevice']= pm25 .. "|0|" .. val_PM25}
end
val_10 = tonumber(val_PM10)
if (val_10 < 13) then coefpm10 = 1
elseif ( 12 < val_10) and (val_10 < 27) then coefpm10 = 2
elseif ( 26 < val_10) and (val_10 < 34) then coefpm10 = 3
elseif ( 33 < val_10) and (val_10 < 49) then coefpm10 = 4
elseif ( 48 < val_10) and (val_10 < 79) then coefpm10 = 5
elseif ( val_10 > 78) then coefpm10 = 6
end
val_25 = tonumber(val_PM25)
if (val_25 < 23) then coefpm25 = 1
elseif ( 22 < val_25) and (val_25 < 41) then coefpm25 = 2
elseif ( 40 < val_25) and (val_25 < 47) then coefpm25 = 3
elseif ( 46 < val_25) and (val_25 < 58) then coefpm25 = 4
elseif ( 57 < val_25) and (val_25 < 69) then coefpm25 = 5
elseif ( val_10 > 68) then coefpm25 = 6
end
--print("*********************coef PM10 : "..coefpm10)
--print("*********************coef PM2.5 : "..coefpm25)
if (coefpm10 > coefpm25) then val_iqa = coefpm10
elseif (coefpm10 < coefpm25) then val_iqa = coefpm25
else val_iqa = coefpm10
end
val_co2 = tonumber(co2)
--print(val_co2)
if (val_co2 > 1000 and val_co2 < 1100) then val_iqa = 3
elseif (val_iqa <= 4) and (val_co2 > 1099) and (val_co2 < 1200) then val_iqa = 4
elseif (val_iqa <= 5) and (val_co2 > 1199) and (val_co2 < 1600) then val_iqa = 5
elseif (val_iqa <= 6) and (val_co2 > 1599) then val_iqa = 6
end
--print(val_iqa)
if val_iqa == 1 and (otherdevices['OnOffLed'] == 'On') then commandArray[3]={['OpenURL'] = ip_sens..'/control?cmd=NeoPixelAll,0,0,255' }
elseif val_iqa == 2 and (otherdevices['OnOffLed'] == 'On') then commandArray[4]={['OpenURL'] = ip_sens..'/control?cmd=NeoPixelAll,0,127,255' }
elseif val_iqa == 3 and (otherdevices['OnOffLed'] == 'On') then commandArray[5]={['OpenURL'] = ip_sens..'/control?cmd=NeoPixelAll,0,125,0' }
elseif val_iqa == 4 and (otherdevices['OnOffLed'] == 'On') then commandArray[6]={['OpenURL'] = ip_sens..'/control?cmd=NeoPixelAll,255,255,0' }
elseif val_iqa == 5 and (otherdevices['OnOffLed'] == 'On') then commandArray[7]={['OpenURL'] = ip_sens..'/control?cmd=NeoPixelAll,231,62,1' }
elseif val_iqa == 6 and (otherdevices['OnOffLed'] == 'On') then commandArray[8]={['OpenURL'] = ip_sens..'/control?cmd=NeoPixelAll,175,0,0' }
elseif (otherdevices['OnOffLed'] == 'Off') then commandArray[9]={['OpenURL'] = ip_sens..'/control?cmd=NeoPixelAll,0,0,0' }
end
if val_iqa == 1 then texte = 'TRES BON'
elseif val_iqa == 2 then texte = 'BON'
elseif val_iqa == 3 then texte = 'MOYEN'
elseif val_iqa == 4 then texte = 'MEDIOCRE'
elseif val_iqa == 5 then texte = 'MAUVAIS'
elseif val_iqa == 6 then texte = 'TRES MAUVAIS'
end
--print(texte)
commandArray['UpdateDevice'] = qualite..'|0|'..texte
end
return commandArray


Code : Tout sélectionner
--[[
name : script_time_qualite_air_maison.lua
auteur : Stef D.
Version : 3.1
date de création : 21/12/2017
Date de mise à jour : 21/12/2017
Principe : Ce script récupère les infos de poussières du capteur SDS011 et les envoie dans les bon customs sensor.
Déduit l'indice de qualité de l'air en fonction des poussières et du CO2 en prenant en compte prioritairement le CO2.
Pilote également les LED intégrées au Air Can.
URL du projet : https://easydomoticz.com/forum/viewtopic.php?f=24&t=5520
]]--
--------------------------------------------
------------ Variables à éditer ------------
--------------------------------------------
local pm = 'AirCan - PM' -- renseigner le nom du device température + humidité utilisé pour l'envoie des infos poussière
local pm10 = 225 -- renseigner l'idx du device taux de particules
local pm25 = 224 -- renseigner l'idx du device taux de particules
local qualite = 235 -- renseigner l'idx du device texte
local ip_sens = '192.168.1.28' -- renseigner l'adresse IP de la AirCan
local co2 = 'AirCan - CO2' -- renseigner le nom de votre dummy sensor utilisé pour la valeur CO2
--------------------------------------------
----------- Fin variables à éditer ---------
--------------------------------------------
commandArray = {}
now = os.date("*t")
if now.min%3 == 0 then -- Toutes les 3 minutes
val_PM25, val_PM10, etat1= otherdevices_svalues[pm]:match("([^;]+);([^;]+)")
print("AirCan : PM10 = "..val_PM10);
print("AirCan : PM2.5 = "..val_PM25);
if pm10 ~= nil then
commandArray[1]={['UpdateDevice']= pm10 .. "|0|" .. val_PM10}
end
if pm25 ~= nil then
commandArray[2]={['UpdateDevice']= pm25 .. "|0|" .. val_PM25}
end
val_10 = tonumber(val_PM10)
if (val_10 < 13) then coefpm10 = 1
elseif ( 12 < val_10) and (val_10 < 27) then coefpm10 = 2
elseif ( 26 < val_10) and (val_10 < 34) then coefpm10 = 3
elseif ( 33 < val_10) and (val_10 < 49) then coefpm10 = 4
elseif ( 48 < val_10) and (val_10 < 79) then coefpm10 = 5
elseif ( val_10 > 78) then coefpm10 = 6
end
val_25 = tonumber(val_PM25)
if (val_25 < 23) then coefpm25 = 1
elseif ( 22 < val_25) and (val_25 < 41) then coefpm25 = 2
elseif ( 40 < val_25) and (val_25 < 47) then coefpm25 = 3
elseif ( 46 < val_25) and (val_25 < 58) then coefpm25 = 4
elseif ( 57 < val_25) and (val_25 < 69) then coefpm25 = 5
elseif ( val_25 > 68) then coefpm25 = 6
end
print("AirCan : *********************coef PM10 = "..coefpm10)
print("AirCan : *********************coef PM2.5 = "..coefpm25)
if (coefpm10 > coefpm25) then val_iqa = coefpm10
elseif (coefpm10 < coefpm25) then val_iqa = coefpm25
else val_iqa = coefpm10
end
--val_co2 = tonumber(otherdevices_svalues[co2])
val_co2_1 = otherdevices_svalues[co2]:match("([^;]+);([^;]+)")
val_co2 = tonumber(val_co2_1)
print("AirCan : CO2 = "..val_co2)
if (val_co2 > 900) and (val_co2 < 1000) then val_iqa = 3
elseif (val_iqa <= 4) and (val_co2 > 999) and (val_co2 < 1100) then val_iqa = 4
elseif (val_iqa <= 5) and (val_co2 > 1099) and (val_co2 < 1500) then val_iqa = 5
elseif (val_iqa <= 6) and (val_co2 > 1499) then val_iqa = 6
end
print("AirCan : IQA = "..val_iqa)
if (otherdevices['Crépusculaire'] == 'On') then
if val_iqa == 1 then os.execute('curl "'..ip_sens..'/control?cmd=NeoPixelAll,0,0,255"')
elseif val_iqa == 2 then os.execute('curl "'..ip_sens..'/control?cmd=NeoPixelAll,0,127,255"')
elseif val_iqa == 3 then os.execute('curl "'..ip_sens..'/control?cmd=NeoPixelAll,0,125,0"')
elseif val_iqa == 4 then os.execute('curl "'..ip_sens..'/control?cmd=NeoPixelAll,180,120,0"')
elseif val_iqa == 5 then os.execute('curl "'..ip_sens..'/control?cmd=NeoPixelAll,231,62,1"')
elseif val_iqa == 6 then os.execute('curl "'..ip_sens..'/control?cmd=NeoPixelAll,255,0,0"')
end
elseif (otherdevices['Crépusculaire'] == 'Off') then os.execute('curl "'..ip_sens..'/control?cmd=NeoPixelAll,0,0,0"')
end
if val_iqa == 1 then texte = 'TRES BON'
elseif val_iqa == 2 then texte = 'BON'
elseif val_iqa == 3 then texte = 'MOYEN'
elseif val_iqa == 4 then texte = 'MEDIOCRE'
elseif val_iqa == 5 then texte = 'MAUVAIS'
elseif val_iqa == 6 then texte = 'TRES MAUVAIS'
end
if val_iqa == 1 then alert = '1'
elseif val_iqa == 2 then alert = '1'
elseif val_iqa == 3 then alert = '2'
elseif val_iqa == 4 then alert = '3'
elseif val_iqa == 5 then alert = '4'
elseif val_iqa == 6 then alert = '4'
end
-- récupération du texte qualité
recup_texte = otherdevices_svalues['AirCan - Qualité']
print("AirCan : Qualité = "..texte)
if texte ~= recup_texte then
commandArray['UpdateDevice'] = qualite..'|'..alert..'|'..texte
end
end
return commandArray


