ventilation logic

Hello.
I have been trying to make a code that will turn my ventilation system on high when humidity rises over a set point.
It seams to be working but I have strange problem. When I try to switch the high ventilation manually in vera it never turns on.
I looks like the off command from Pleg is telling the switch to be turned off. But in my “VentOff” condition I use a “and” operator so that it wont turn off before 60 minutes and only if vent is high.

I have been scratching my head but I cant see it… :slight_smile:

Anyone have an idea?

More detailed info below:

Schedules
Name Type Time Days

Device Properties
Name Device Name Device Variable
VentStatus Forsering ventilasjon Status
Fukt Luftfuktighet familiebad CurrentLevel
VentTimer Ventilasjon timer Status

Conditions
Name Expression
VentON Fukt > 79 AND VentStatus < 1
VentOff (VentON; NOW > 60:00) and (VentStatus > 0)
TimerOn VentTimer > 0
TimerOff (TimerOn) and (TimerOn; NOW > 60:00)

Actions

Actions for Condition: VentON
Device Action Arguments
Forsering ventilasjon SetTarget newTargetValue=1

Actions for Condition: VentOff
Device Action Arguments
Forsering ventilasjon SetTarget newTargetValue=0

Actions for Condition: TimerOn
Device Action Arguments
Forsering ventilasjon SetTarget newTargetValue=1

Actions for Condition: TimerOff
Device Action Arguments
Forsering ventilasjon SetTarget newTargetValue=0
Ventilasjon timer SetTarget newTargetValue=0

I have also found out that if I change the off condition to this:
(VentON; NOW > 60:00) and (VentON > 0)
It works the way it should do.
But I intentionally wanted to link the off command to a device property and not a pleg condition assuming this would be better…??
Now off course I am most of all wondering why it wont work the way I thought it would.

But I intentionally wanted to link the off command to a device property and not a pleg condition assuming this would be better...??

Note that a Sequence expression does not care about the current state of the elements of the expression but only the times associated with the elements. So the expression:
(VentON; NOW > 60:00)

Will always be true 60 minutes after VentON turned true. If this was yesterday it would still evaluate to true and that’s why your original logic did not work.

You wanted to AUTO turn off if it was AUTO turned on … and ignore it if you are running manually.
That’s what your second modification did.

Or maybe you want it to AUTO turn off after 60 minutes after your manually turn it on as well.
In this case I would code the conditions as:

VentON (Fukt > 79 AND VentStatus < 1) OR (VentStatus > 0)
VentOff VentON and (VentON; NOW > 60:00)

Note: This will send the start Vent commands again when you manually start the Vent … but that should not hurt.

Thank you for your reply! That clarifies a lot!
Good to know how it works…

Regards

Due to PLEG upgrades I have modified my ventilation logic.
I now use a Timer insted of the “now” command.
It is working fine for me and it is used every time someone takes a shower.
In my setup I have a humidity sensor above the shower, and a Fibaro relay connected to the ventilation override circuit.
So I thought I could update this thread in case someone want to use the same logic.

Triggers
Name Description
VentHigh Forsering ventilasjon is turned on
HighHumidity Humidity reported by Luftfuktighet familiebad go above 80

Schedules

Name Type Time Days Random On Delay Off After Type Off Time Off Days Random Off Delay
VentTimer Self ReTrigger None Interval 60:00 None

Conditions
Name Repeat Expression
VentOn No !VentHigh and HighHumidity and (!VentHigh; HighHumidity)
VentOff No VentHigh and !VentTimer

Actions
Actions for Condition: VentOn
Immediate
Device Action Arguments
Forsering ventilasjon SetTarget newTargetValue=1
HVAC og Temp StartTimer timerName=VentTimer intervalTime=

Actions for Condition: VentOff
Immediate
Device Action Arguments
Forsering ventilasjon SetTarget newTargetValue=0