Enclencher la VMC

Forum dédié aux problématiques concernant les scripts pour DomoticZ.
Entourez votre code et les logs avec les balises nommées code grâce au bouton <\>.
leraver
Messages : 143
Inscription : 09 oct. 2015, 12:38
Contact :

Enclencher la VMC

Message par leraver »

Bonjour
Je cherche a commander ma VMC, j'ai dai un blocky comme suit:
ScreenShot035.jpg
ScreenShot035.jpg (34.14 Kio) Consulté 10546 fois
Mais il n'a pas l'air de vouloir enclencher .

Auriez vous des idées? de ce qui cloche?
Un jour j'irais vivre en théorie.
Parce que en théorie tous ce passe bien...
Triple0s
Messages : 37
Inscription : 23 sept. 2015, 15:13

Re: Enclencher la VMC

Message par Triple0s »

bonjour

j'ai eut les memes soucis et trouver cette solution:

if humidite cuisine >= 60 or humidite salle bain >=60
do set prise = on
else if humidite cuisine <59 or humidite salle de bain <59
doset prise = off
Domoticz sur Linux Mint
boitier RFXtrx 433 (sondes température, température/hygro, zkp1a, chacon, blyss)
Mysensors (Capteurs PIR, Double relais, relais avec bouton)
leraver
Messages : 143
Inscription : 09 oct. 2015, 12:38
Contact :

Re: Enclencher la VMC

Message par leraver »

yes pas bete ca.
Je teste ce soir
Un jour j'irais vivre en théorie.
Parce que en théorie tous ce passe bien...
vil1driver
Messages : 5661
Inscription : 30 janv. 2015, 11:07
Localisation : Rennes (35)

Re: Enclencher la VMC

Message par vil1driver »

Salut,
Il y a un script sur le wiki qui contrôle une augmentation du niveau d'humidité plutôt qu'une valeur.
Bien plus représentatif car ça ne sert à rien de ventiler s'il pleut dehors, l'humidité sera de toute façon élevée.
Idem l'été, un faible niveau d'humidité ne signifie pas que l'on à pas besoin de ventiler..
MAJ = VIDER LE CACHE(<-Clicable)
/!\Les mises à jour de Domoticz sont souvent sources de difficultés, ne sautez pas dessus
modules.lua

Un ex domoticzien
leraver
Messages : 143
Inscription : 09 oct. 2015, 12:38
Contact :

Re: Enclencher la VMC

Message par leraver »

Ah.... Pas trouvé
Un jour j'irais vivre en théorie.
Parce que en théorie tous ce passe bien...
vil1driver
Messages : 5661
Inscription : 30 janv. 2015, 11:07
Localisation : Rennes (35)

Re: Enclencher la VMC

Message par vil1driver »

Je l'ai par là, je te le mettrai ici..
Le principe est sympa, il prend même en compte le fait que tu ai mis le chauffage, car la chaleur fait baisser l'humidité relative...etc..

Toute une histoire..

Ps:voila pourquoi je préfère lua, sauvegarde/partage rapide et facile
MAJ = VIDER LE CACHE(<-Clicable)
/!\Les mises à jour de Domoticz sont souvent sources de difficultés, ne sautez pas dessus
modules.lua

Un ex domoticzien
vil1driver
Messages : 5661
Inscription : 30 janv. 2015, 11:07
Localisation : Rennes (35)

Re: Enclencher la VMC

Message par vil1driver »

Code : Tout sélectionner



--[[
 
This script controls the humidity in a typical bathroom setting by detecting
relative rises in humidity in a short period.
Of course it requires a humidity sensor and a binary switch controlling a fan/ventilator.
(there is no provision for variable speed ventilators here!)
 
How it works (assuming the default constants as defined below):
Every 5 minutes a reading is done. Every reading is stored together
with the previous reading and is stored in two user variables (humidityTmin5 and humidityTmin10).
So it has two reading over the past 10 minutes.
It then takes the lowest of the two and compares it with the latest reading and
calculates a delta.
If the delta is 3 or higher (see constants) then the fan will be turned
on, it calculates the target humidity and the 'humidity-decrease program' is started (fanFollowsProgram=1).
From then on, every 5 minutes the current humidity is compared to the
stored target humidity. Basically if that target is reached, the fan is turned off
and the 'program' is ended.
Of course, it is possible that the target is never reached (might start raining outside
or whatever). Then there is a failsafe (FAN_MAX_TIME) after which the ventilator
will be turned off.
 
Also, it will detect if the ventilator is manually switched off during a program
or when it is switched on before the program starts.
 
Along the lines it prints to the log and sends notifications
but of course you can turn that off by removing those lines.
 
--]]
 
print('Fan control')
 
commandArray = {}
 
-- declare some constants
-- adjust to your specific situation
SAMPLE_INTERVAL = 5                 -- time in minutes when a the script logic will happen
FAN_DELTA_TRIGGER = 3               -- rise in humidity that will trigger the fan
FAN_MAX_TIME = 24                   --  maximum amount of sample cycles the fan can be on, 
                                    -- in case we never reach the target humidity
TARGET_OFFSET = 2                   -- ventilator goes off if target+offset is reached 
                                    -- (maybe it takes too long to reach the true target due to wet towels etc)
FAN_NAME = 'vmc'             -- exact device name of the switch turning on/off the ventilator
SENSOR_NAME = 'salle de bain'      -- exact device name of the humidity sensor
 
TEST_MODE = false                   -- when true TEST_MODE_HUMVAR is used instead of the real sensor
TEST_MODE_HUMVAR = 'testHumidity'   -- fake humidity value, give it a test value in domoticz/uservars
 
-- get the global variables:
-- this script runs every minute, humCounter is used to create SAMPLE_INTERVAL periods
humCounter = tonumber(uservariables['humCounter'])
humidityTmin5 = tonumber(uservariables['humidityTmin5'])                -- youngest reading
humidityTmin10 = tonumber(uservariables['humidityTmin10'])              -- oldest reading
targetFanOffHumidity = tonumber(uservariables['targetFanOffHumidity'])  -- target humidity
fanMaxTimer = tonumber(uservariables['fanMaxTimer'])
fanFollowsProgram = tonumber(uservariables['fanFollowsProgram'])        -- marker indicating that the 
                                                                        -- decrease program is started
 
target = 0 -- will hold the target humidity when the program starts
 
-- get the current humidity value
if (TEST_MODE) then
    current = tonumber(uservariables[TEST_MODE_HUMVAR])
else
    current = otherdevices_humidity[SENSOR_NAME]
end
 
-- check if the sensor is on or has some weird reading
if (current == 0 or current == nil) then
    print('current is 0 or nil. Skipping this reading')
    return commandArray
end
 
print('Current humidity:' .. current)
print('targetFanOffHumidity:' .. targetFanOffHumidity)
print('humidityTmin5: ' .. humidityTmin5)
print('humidityTmin10: ' .. humidityTmin10)
print('fanMaxTimer: ' .. fanMaxTimer)
print('humCounter:' .. humCounter)
print('fanFollowsProgram:' .. fanFollowsProgram)
 
-- increase cycle counter
humCounter = humCounter + 1
 
if (humCounter >= SAMPLE_INTERVAL) then
 
    if (humidityTmin5 == 0) then
        -- initialization, assume this is the first time
        humidityTmin5 = current
        humidityTmin10 = current
    end
 
    humCounter = 0 -- reset the cycle counter
 
    -- pick the lowest history value to calculate the delta
    -- this also makes sure that two relative small deltas in the past 2*interval minutes are treated as one larger rise
    -- and therefore will still trigger the ventilator
    -- I don't want to use a longer interval instead because I want the ventilator to start as soon as possible
    -- (so rather after 5 minutes instead of after 15 minutes because the mirrors in the bathroom become kinda useless ;-)
    delta = current - math.min(humidityTmin10, humidityTmin5)
    print('Delta: ' .. delta)
 
    -- pick the lowest history value
    target = math.min(humidityTmin10, humidityTmin5) + TARGET_OFFSET
 
    -- shift the previous measurements
    humidityTmin10 = humidityTmin5
    -- and store the current
    humidityTmin5 = current
 
    if (otherdevices[FAN_NAME]=='Off' or (otherdevices[FAN_NAME]=='On' and fanFollowsProgram==0)) then
        -- either the fan is off or it is on but the decrease program has not started
        -- in that latter case we start the program anyway. This could happen if someone turns on the ventilator
        -- manually because he/she is about to take a shower and doesn't like damp mirrors.
        -- I don't do this because the ventilator removes heat from the bathroom and I want this to happen
        -- as late as possible ;-)
 
        if (fanFollowsProgram == 1 and otherdevices[FAN_NAME]=='Off') then
            -- likely someone turned off the ventilator while the program was running
            fanFollowsProgram = 0
        end
 
        -- see if we have to turn it on
        if (delta >= FAN_DELTA_TRIGGER) then
            -- time to start the fan
            commandArray[FAN_NAME] = 'On'
			 
            targetFanOffHumidity = target
 
            if (fanFollowsProgram == 1) then
                print('Ventilator was already on but we start the de-humidifying program')
            end
 
            fanFollowsProgram = 1
 
            -- set the safety stop
            fanMaxTimer = FAN_MAX_TIME
 
            print('Rise in humidity. Turning on the vents. Delta: ' .. delta)
            print('Target humidity for turning the ventilator: ' ..targetFanOffHumidity)
            commandArray['SendNotification'] = 'Ventilator is on#The ventilator was activated at humidity level ' .. current .. '#0'
        end
 
    else
        if (fanMaxTimer > 0) then
            -- possible that someone started the ventialator manually
            fanMaxTimer = fanMaxTimer - 1
        end
 
 
        if (fanFollowsProgram == 1) then -- not manually started
 
            if (delta >= FAN_DELTA_TRIGGER) then
                -- ok, there is another FAN_DELTA_TRIGGER rise in humidity
                -- when this happen we reset the fanMaxTimer to a new count down
                -- because we have to ventilate a bit longer due to the extra humidity
                print('Another large increase detected, resetting max timer. Delta: ' .. delta)
                fanMaxTimer = FAN_MAX_TIME
            end
 
            -- first see if it can be turned off
            if (current <= targetFanOffHumidity or fanMaxTimer==0) then
                commandArray[FAN_NAME] = 'Off'
				  
                msg = ''
 
                if (fanMaxTimer == 0 and current > targetFanOffHumidity) then
                    msg = 'Target not reached but safety time-out is triggered.'
                    print(msg)
                else
                    msg = 'Target humidity reached'
                    print(msg)
                end
 
                print('Turning off the ventilator')
                msg = msg .. '\nTurning off the ventilator'
 
                targetFanOffHumidity = 0
                fanMaxTimer = 0
                fanFollowsProgram = 0
                -- reset history in this case.. we start all over
                -- Tmin10 is still in the 'ventilator=On'-zone
                humidityTmin10 = humidityTmin5
                commandArray['SendNotification'] = 'Ventilator is off#' .. msg .. '#0'
 
            else
                -- we haven't reached the target yet
                print('Humidity delta: ' .. delta)
            end
        end
    end
 
    print('New values >>>>>>>>>>>')
    print('humidityTmin5: ' .. humidityTmin5)
    print('humidityTmin10: ' .. humidityTmin10)
    print('fanMaxTimer: ' .. fanMaxTimer)
    print('humCounter:' .. humCounter)
    print('fanFollowsProgram:' .. fanFollowsProgram)
    print('------ target: ' .. targetFanOffHumidity)
 
end
 
-- save the globals
commandArray['Variable:humCounter'] = tostring(humCounter)
commandArray['Variable:humidityTmin10'] = tostring(humidityTmin10)
commandArray['Variable:humidityTmin5'] = tostring(humidityTmin5)
commandArray['Variable:targetFanOffHumidity'] = tostring(targetFanOffHumidity)
commandArray['Variable:fanMaxTimer'] = tostring(fanMaxTimer)
commandArray['Variable:fanFollowsProgram'] = tostring(fanFollowsProgram)
 
return commandArray
MAJ = VIDER LE CACHE(<-Clicable)
/!\Les mises à jour de Domoticz sont souvent sources de difficultés, ne sautez pas dessus
modules.lua

Un ex domoticzien
leraver
Messages : 143
Inscription : 09 oct. 2015, 12:38
Contact :

Re: Enclencher la VMC

Message par leraver »

Merci
je fais regarder ce que je peu faire evec cela.
Deja le traduire...
Un jour j'irais vivre en théorie.
Parce que en théorie tous ce passe bien...
deennoo
Messages : 4036
Inscription : 25 janv. 2015, 02:00

Re: Enclencher la VMC

Message par deennoo »

Si je peux me permettre une chose, il ne faut pas couper la VMC, un courant d'air prend du temps a ce mettre en place, une salle de bains est par définition une pièce constamment plus humide que les autres il vaut mieux jouer sur la vitesse.

En normal : petite vitesse
en demande de ventilation : Grande vitesse

idem pour une hotte aspirante de cuisson, pour un bon fonctionnement il faut la mettre en route avant cuisson et encore 10 minutes aprés.
De quoi se faire Plaisir et essayer d'aider...
http://www.domo-attitude.fr
leraver
Messages : 143
Inscription : 09 oct. 2015, 12:38
Contact :

Re: Enclencher la VMC

Message par leraver »

Bien sur c'est claire.
Me concernant c'est du on ou off ( cause renovation... par organisme de HLM...) et de nuit il faut avouer que le bruit est plutot penible.
Sachant que nous somme passé d'une ventilation "naturel" a une forcée, si je peu la couper lorsque elle n'est pas vital...
Un jour j'irais vivre en théorie.
Parce que en théorie tous ce passe bien...
Répondre