bonsoir
je met a jour ce post dont je me suis inspiré pour le calcul du rendement
ma version du script est en DZvent
2 commandes manuelles (vitesse lente/rapide et bypass on/off)
2 commandes virtuelles (vitesse et bypass) dans domoticz
4 sondes de T° (air neuf , extrait , vicie et souffle)
la VMC dialogue avec domoticz via un mysensors v2 sur arduino mini pro (qui recupère les temperatures et les ordres des 2 commandes manuelles , et gere egalement les actions bypass et vitesse envoyé par domoticz)
Code : Tout sélectionner
local temp_air_neuf = 'VMC Température Air Neuf' -- temperature device
local temp_air_vicie = 'VMC Température Air Vicié' -- temperature device
local temp_air_extrait = 'VMC Température Air Extrait' -- temperature device
local temp_air_souffle = 'VMC Température Air Soufflé' -- temperature device
local BP_bypass = '$BYPASS IN'
local BP_speed = '$HIGH SPEED IN'
local OUT_bypass = '$BYPASS OUT'
local OUT_speed = '$HIGH SPEED OUT'
local DZ_bypass = 'VMC BYPASS'
local DZ_speed = 'VMC SPEED'
local info_bypass = 'VMC Etat Bypass'
local info_speed = 'VMC Vitesse Ventilation'
local LOGGING = true
return {
on = {
['timer'] = {
'every minute',
},
devices = {
temp_air_neuf,
temp_air_extrait,
BP_bypass,
BP_speed,
DZ_bypass,
DZ_speed
}
},
active = true,
execute = function(domoticz, item)
local mois = domoticz.time.month
local sensor_AN = domoticz.devices(temp_air_neuf).temperature
local sensor_AV = domoticz.devices(temp_air_vicie).temperature
local sensor_AE = domoticz.devices(temp_air_extrait).temperature
local sensor_AS = domoticz.devices(temp_air_souffle).temperature
local sensor_rendement = domoticz.devices('VMC Rendement')
local BPBYPASS = domoticz.devices(BP_bypass)
local BPSPEED = domoticz.devices(BP_speed)
local BYPASSOUT = domoticz.devices(OUT_bypass)
local SPEEDOUT = domoticz.devices(OUT_speed)
local DZBYPASS = domoticz.devices(DZ_bypass)
local DZSPEED = domoticz.devices(DZ_speed)
local infobypass = domoticz.devices(info_bypass)
local infospeed = domoticz.devices(info_speed)
if LOGGING then
domoticz.log('[VMC] ****** TEMPERATURES ****** ', domoticz.LOG_INFO)
domoticz.log('[VMC] ------ sensor_Air Neuf :' ..sensor_AN, domoticz.LOG_INFO)
domoticz.log('[VMC] ------ sensor_Air Vicie :' ..sensor_AV, domoticz.LOG_INFO)
domoticz.log('[VMC] ------ sensor_Air Extrait :' ..sensor_AE, domoticz.LOG_INFO)
domoticz.log('[VMC] ------ sensor_Air Soufle :' ..sensor_AS, domoticz.LOG_INFO)
domoticz.log('[VMC] ****** ACTIONNEURS ****** ', domoticz.LOG_INFO)
domoticz.log('[VMC] ------ BPBYPASS :' ..BPBYPASS.state, domoticz.LOG_INFO)
domoticz.log('[VMC] ------ BPSPEED :' ..BPSPEED.state, domoticz.LOG_INFO)
domoticz.log('[VMC] ------ DZBYPASS :' ..DZBYPASS.state, domoticz.LOG_INFO)
domoticz.log('[VMC] ------ DZSPEED :' ..DZSPEED.state, domoticz.LOG_INFO)
domoticz.log('[VMC] ****** ETAT VMC ******', domoticz.LOG_INFO)
if (BYPASSOUT.state == 'On') then domoticz.log('[VMC] ------ BYPASS : ON', domoticz.LOG_INFO) else domoticz.log('[VMC] ------ BYPASS : OFF', domoticz.LOG_INFO) end
if (SPEEDOUT.state == 'On') then domoticz.log('[VMC] ------ VITESSE : HIGH', domoticz.LOG_INFO) else domoticz.log('[VMC] ------ VITESSE : LOW', domoticz.LOG_INFO) end
domoticz.log('[VMC] ****** CHANGEMENT ETAT ACTIONNEURS ******', domoticz.LOG_INFO)
if DZBYPASS.changed then domoticz.log('[VMC] ------ DZBYPASSchanged : vrai', domoticz.LOG_INFO) else domoticz.log('[VMC] ------ DZBYPASSchanged : Faux', domoticz.LOG_INFO) end
if BPBYPASS.changed then domoticz.log('[VMC] ------ BPBYPASSchanged : vrai', domoticz.LOG_INFO) else domoticz.log('[VMC] ------ BPBYPASSchanged : Faux', domoticz.LOG_INFO) end
if DZSPEED.changed then domoticz.log('[VMC] ------ DZSPEEDchanged : vrai', domoticz.LOG_INFO) else domoticz.log('[VMC] ------ DZSPEEDchanged : Faux', domoticz.LOG_INFO) end
if BPSPEED.changed then domoticz.log('[VMC] ------ BPSPEEDchanged : vrai', domoticz.LOG_INFO) else domoticz.log('[VMC] ------ BPSPEEDchanged : Faux', domoticz.LOG_INFO) end
domoticz.log('[VMC] ****** ACTIONS ******', domoticz.LOG_INFO)
end
-- first check if the sensor got a new reading or the setpoint was changed:
-- //si on est en été
-- // si temperature air neuf < temperature extraite et que temperature extraite >20degres => bypass on //on bypass tant que air interieur est superieur a 20
-- // si on est en automne
-- // si temperature air neuf > temperature extraite et que temperature interieure <23 = bypass on (pour recuperer la chaleur de l'exterieur)
-- // si on est en hivers
-- // si temperature air neuf > temperature extraite et que temperature interieure <25 = bypass on (pour recuperer la chaleur de l'exterieur)
-- // si on est au printemps
-- // si temperature air neuf > temperature extraite et que temperature interieure <23 = bypass on (pour recuperer la chaleur de l'exterieur)
--le bp physique force automatiquement l'inter de domotics dans sont dernier etat
if (BPBYPASS.state=='On' and BPBYPASS.changed) then
DZBYPASS.switchOn()
if infobypass.text ~= 'Action manuelle BP=> Bypass On' then infobypass.updateText('Action manuelle BP=> Bypass On')end
end
if (BPBYPASS.state=='Off' and BPBYPASS.changed) then
DZBYPASS.switchOff()
if infobypass.text ~= 'Action manuelle BP=> Bypass Off' then infobypass.updateText('Action manuelle BP=> Bypass Off')end
end
if (BPSPEED.state=='On' and BPSPEED.changed) then DZSPEED.switchOn()end
if (BPSPEED.state=='Off' and BPSPEED.changed) then DZSPEED.switchOff()end
-- le bp/ou l'inter domoticz est prioritaires sur le fonctionnement automatique du bypass
local hysteresis_air = 0.5
local AN_REGUL_BYPON
local AN_REGUL_BYPOFF
-- gestion du bypass
if (DZBYPASS.state=='On') then
if (BYPASSOUT.state == 'Off') then
BYPASSOUT.switchOn()
if LOGGING then domoticz.log('[VMC] ------ Bypass Action manuelle => Bypass On', domoticz.LOG_INFO) end
end
if infobypass.text ~= 'Action manuelle => Bypass On' then infobypass.updateText('Action manuelle => Bypass On')end
if LOGGING then domoticz.log('[VMC] ------ Bypass On', domoticz.LOG_INFO) end
else
if LOGGING then domoticz.log('[VMC] ------ Bypass Mode Automatique', domoticz.LOG_INFO) end
if (mois <4 and mois>10) then
--mode hivers
AN_REGUL_BYPON = sensor_AN + hysteresis_air
AN_REGUL_BYPOFF = sensor_AN - hysteresis_air
if LOGGING then domoticz.log('[VMC] ------ Bypass Mode Hivers', domoticz.LOG_INFO) end
if (sensor_AE < 25 ) then
if (AN_REGUL_BYPON > sensor_AE ) then
if (BYPASSOUT.state == 'Off') then BYPASSOUT.switchOn()end
if LOGGING then domoticz.log('[VMC] ------ Bypass On => AN > AE', domoticz.LOG_INFO) end
if infobypass.text ~= '[HIVERS] ON => AN > AE' then infobypass.updateText('[HIVERS] ON => AN > AE')end
else if (AN_REGUL_BYPOFF < sensor_AE) then
if (BYPASSOUT.state == 'On') then BYPASSOUT.switchOff()end
if LOGGING then domoticz.log('[VMC] ------ Bypass Off => AN < AE', domoticz.LOG_INFO) end
if infobypass.text ~= '[HIVERS] OFF => AN < AE' then infobypass.updateText('[HIVERS] OFF => AN < AE')end
end
end
else
if (BYPASSOUT.state == 'On') then BYPASSOUT.switchOff()end
if LOGGING then domoticz.log('[VMC] ------ Bypass Off => sensor_AE > 25', domoticz.LOG_INFO) end
if infobypass.text ~= '[HIVERS] OFF => AE > 25' then infobypass.updateText('[HIVERS] OFF => AE > 25')end
end
end
if (mois ==4 or mois==10) then
if LOGGING then domoticz.log('[VMC] ------ Bypass Mode Printemps/Automne', domoticz.LOG_INFO) end
--mode printemps/automne
AN_REGUL_BYPON = sensor_AN + hysteresis_air
AN_REGUL_BYPOFF = sensor_AN - hysteresis_air
if (sensor_AE < 23 ) then
if (AN_REGUL_BYPON > sensor_AE ) then
if (BYPASSOUT.state == 'Off') then BYPASSOUT.switchOn()end
if LOGGING then domoticz.log('[VMC] ------ Bypass On => AN > AE', domoticz.LOG_INFO) end
if infobypass.text ~= '[MI-SAISON] ON => AN > AE' then infobypass.updateText('[MI-SAISON] ON => AN > AE')end
else if (AN_REGUL_BYPOFF < sensor_AE) then
if (BYPASSOUT.state == 'On') then BYPASSOUT.switchOff()end
if LOGGING then domoticz.log('[VMC] ------ Bypass Off => AN < AE', domoticz.LOG_INFO) end
if infobypass.text ~= '[MI-SAISON] OFF => AN < AE' then infobypass.updateText('[MI-SAISON] OFF => AN < AE')end
end
end
else
if (BYPASSOUT.state == 'On') then BYPASSOUT.switchOff()end
if LOGGING then domoticz.log('[VMC] ------ Bypass Off => sensor_AE > 23', domoticz.LOG_INFO) end
if infobypass.text ~= '[MI-SAISON] OFF => AE > 23' then infobypass.updateText('[MI-SAISON] OFF => AE > 23')end
end
end
if (mois >4 and mois<10) then
if LOGGING then domoticz.log('[VMC] ------ Bypass Mode été', domoticz.LOG_INFO) end
--mode été
AN_REGUL_BYPON = sensor_AN + hysteresis_air
AN_REGUL_BYPOFF = sensor_AN - hysteresis_air
if (sensor_AE > 21 ) then
if (AN_REGUL_BYPON < sensor_AE) then
if (BYPASSOUT.state == 'Off') then BYPASSOUT.switchOn()end
if LOGGING then domoticz.log('[VMC] ------ Bypass On => AN < AE', domoticz.LOG_INFO) end
if infobypass.text ~= '[ETE] ON => AN < AE' then infobypass.updateText('[ETE] ON => AN < AE')end
else if (AN_REGUL_BYPOFF > sensor_AE ) then
if (BYPASSOUT.state == 'On') then BYPASSOUT.switchOff()end
if LOGGING then domoticz.log('[VMC] ------ Bypass Off => AN > AE', domoticz.LOG_INFO) end
if infobypass.text ~= '[ETE] OFF => AN > AE' then infobypass.updateText('[ETE] OFF => AN > AE')end
end
end
else
if (BYPASSOUT.state == 'On') then BYPASSOUT.switchOff()end
if LOGGING then domoticz.log('[VMC] ------ Bypass Off => sensor_AE < 21', domoticz.LOG_INFO) end
if infobypass.text ~= '[ETE] OFF => AE < 21' then infobypass.updateText('[ETE] OFF => AE < 21')end
end
end
end
-- gestion vitesse de ventilation
if (DZSPEED.state=='On') then
if (SPEEDOUT.state == 'Off') then
SPEEDOUT.switchOn()
infospeed.updateText('Action manuelle => High Speed')
if LOGGING then domoticz.log('[VMC] ------ Vitesse Action manuelle => High Speed', domoticz.LOG_INFO) end
end
if LOGGING then domoticz.log('[VMC] ------ Vitesse High Speed', domoticz.LOG_INFO) end
else
if (SPEEDOUT.state == 'On') then
SPEEDOUT.switchOff()
infospeed.updateText('Action manuelle => Low Speed')
if LOGGING then domoticz.log('[VMC] ------ Vitesse Action manuelle BP => Low Speed', domoticz.LOG_INFO) end
end
if LOGGING then domoticz.log('[VMC] ------ Vitesse Low Speed', domoticz.LOG_INFO) end
end
--calcul theorique du rendement
local rendement
rendement = (sensor_AS - sensor_AN)/(sensor_AE - sensor_AN)
rendement = domoticz.utils.round(rendement,2)*100
sensor_rendement.updateCustomSensor(rendement)
if LOGGING then
domoticz.log('[VMC] ****** RENDEMENT ****** ', domoticz.LOG_INFO)
domoticz.log('[VMC] ------ rendement :' ..rendement.. '%', domoticz.LOG_INFO)
end
end
}