When gate is open too long , close it and send notification

Hello,

I tried to use PLEG , and it seems to be working fine (which I cannot believe on the first try), but can someone check if I did it correct.

What I want:

When a device is on for longer as 3 minutes , switch it off and send a notification:
I attached some screenshots:
inputs: I called it gate_open , and “device is turned on”
conditions: gate_open; Now > 03:00 (after the gate is open more than 3 minutes)
action: I selected the device to go “off”
notification: see screenshot , but there is an error in it , even if the device is switched off (within the 3 minutes) , after 3 minutes I still get the notification, and the device is switched off again.

edit … ohw … something horribly wrong; it seems that every 3 minutes the devices switches itself off and sends a notification, it keeps repeating this… it doesn’t look if the device is on or off to activate this PLEG… crap.

But when I think of it… it is not exactly what I want anyway…
maybe someone can think with me…

I have a scene;
It switches a device on, after 90 seconds it switches the device off. For this scene I want to check if the device is still on after 3 minutes, if yes , switch off and send a notification.

If I switch the device on without the scene I don’t want the PLEG to switch the device off again. Is that possible?

Thanks,
Cor

Please use the Output from Report or Status to describe your setup.
There is information that is left out of your scenario.

The condition:
gate_open; Now > 03:00

Is not what you want … This will fire 3 minutes after the gate is opened … even if you close the gate.

You want:
gate_open and (gate_open; Now > 03:00)

hmm,

I changed it now to :

gate_open and (gate_open; Now > 03:00)

But it does nothing now :frowning:

When I get this running, will it be possible to have this only run when the scene switches this device on , and not if the device is turned on without the scene.

Thanks for your help,
Cor

attached the report html file.

According to your status report, gate_open is not now, and has never been, true. Are you sure your trigger is set correctly?

Also do not forget to ARM the PLEG if you want the actions to fire.

Hello,

I tried again, and opened the gate, after about 1 minute I clicked the status button , attached the file.

The device does not switch itself off after the 3 minutes and not notification :frowning:

PLEG is armed

Cor

What type of switch is this ?

The trigger indicates that that the gate is current close … but the Device Property Target indicates that it was subsequently commanded open …

… it is a bit complicated… I will explain the whole idea and setup.

Vera3 in my house
Vera lite at my gate with universal sensor, fibaro relais (2x1,5kw)
I controll the devices on my vera lite via the vera 3.

The scene:
Open gate , after 90 seconds close the gate.

I want after the gate fails to close after 3 minutes ( occasinally happends ) that it tries to close again and report this.

But here is the issue. I use the universal sensor with a microswitch to know if the gate is open or close. Somehow the status is not transferred to my vera 3, So , If I do some PLEG for the universal sensor , this won’t work.

I worked arround this.
The fibaro relais ( on the vera lita ) does show almost immediately the status on my vera 3. So what i did , the second part of the relais ( child2 ) I made a trigger. When the motion sensor is triggered on , the fibaro relais goes on as well, when the motion sensor is off ( gate closed) the fibaro relais goes off again.

Still follow me ? :wink:

Now I see on the UI of vera3 (master) the fibaro child 2 on and off when the gate is open or close ( even when the motion detect (universal sensor) does not change on the UI vera3) … this works very well. ( I use now veraalert for a notification on the fibaro relais child 2)

The next step is for the automatic closure of the gate after the 3 minutes.

What PLEG ( installed on the vera3) needs to do is , when it sees the fibaro child2 which is hooked up on the vera lite , sees the change in status on the vera 3 , count down the 3 minutes and than activate child 1 on the fibaro relais .

It’s complicated … The whole issue is that the sensor does not transfer its status to the master vera 3 somehow.

What I can do is install the pleg on the vera lite and do all the same, … only veraalerts has an issue with the vera lite , I cannot send notification on the installed vera alerts on the vera lite , it has to go via the master vera3.

The last step would be , that only when the gate is activated via the scene ( open and close) PLEG can intervene , if I open the gate by just pushing the on-off switch on the device , and leave the gate open , I don’t want PLEG to do anything.

I hope it is clear what I tried to write :-X

It’s complicated … but I think I understand …

So gate_open is the proxy relay (#2) for the Vera Lite Gate Sensor that does not report properly. So it looks like a switch on Vera 3.

Why does the Action try to send a SetTarget to this same device ? or do you have two devices named range extender on Vera 3 ? One of the proxy relays should control the gate … and the other record the state.

The Status Report will not show the results when the conditions are changed by NOW. Believe me there is a reason. If you want to see the status when the timeout has expired … Add another trigger to the PLEG. i.e. for the light in the room you are working. You do not need to include this trigger in any conditions. Then just toggle the light then do a Status command. The state of the PLEG will be recorded as a result of this trigger … then the Status command will see the results of your timeout expression.

:smiley:

Yes, that is correct, since the sensor does not report properly on the master vera , I used another device which is switched on and off when the motion detect sensor is on or off. that other device reports properly to vera3 the master.

Forget the extender, I was doing some tests with another device (range extender, near my gate on the vera lite) ,since I didn’t want the gate to open and close all the time .
It is the fibaro child2 which is controlling the PLEG , when the device is on , start the countdown , when it is off within 3 minutes , do nothing , when it is outside the 3 minutes , switch on fibaro child1 ( that’s the gate controll).

This I don’t understand.

I will try again tonight , I will setup the correct devices and will post the report again.

Is it correct what I was doing:

Input >>name= gate_open , description: the fibaro child2
conditions>> gate_open and gate_open; Now > 03:00
action >> select the fibaro child 1 ( to close the gate again.)

Thanks,
Cor

I am doing something horribly wrong I think.

I did some test with some lights ( also fibaro relais).

name = test
I used the fibaro relais called “front door light” and the trigger when it is on.
conditions I inserted : test and (test; Now > 01:00)

Action , I selected 2 lights to come on after one minute when the front door light is on…nothing happends and the PLEG is armed.

What am I doing wrong? :-s

Thanks,
Cor

@Cor
You need to cycle your logic once. … i.e. toggle the front door in order to initialize it’s state after defining the trigger. It’s done now.

Also I indicated previously … the Status report will NEVER show updates based on evaluating the NOW clause (Every Minute). So you only see the State from when the Switch was turned OFF. So you should never be able to see the condition test as TRUE.

Add another light … that’s NOT part of your logic as an input trigger. Then Change it’s state.
It will cause the conditions to evaluate … and the PLEG state to be recorded … and then you can issue a Status report and see the current state of the test condition.

If you still have problems then I will need you to turn on debugging for the PLEG instance and send me the log … Starting before you turn the switch on … to 2 minutes after.

For details see:
http://forum.micasaverde.com/index.php/topic,14385.0.html

Not the log (yet) , since I got it working … well… almost.
but still some issues.

I was doing some tests with light, the same condition and trigger as before, A light (front door) is on , when the light is still on after 1 minute , switch the light off , switch on another light and wallplug on and send a notificication.

Attached the report (2.jpg).

2 issues:

The biggest one now is , the notification, all my other notifications (message override) are gone ( and I had a lot) , even the android veraalerts ID was removed … why? is this a one time event ,or will it happen every time?:-s (a partly screenshot 1.jpg)

Second issue ; the notification keeps on repeating. After every minute , I get a veraalerts notification.
the trigger is front door light, when the light is on for more than 1 minute. I see that the light is switched off by PLEG , and another light and wallplug is switched on … but every minute the notification again.

Thanks,
Cor

Thought I’d butt in really quick since I noticed this. In a previous post you put the condition as:

test and (test; Now > 01:00)

but in your report, you only have

test; Now > 01:00

it is my understanding that it will run every minute because test was last true over a minute ago. You need to keep the " test and (test; Now > 01:00) " because it says “test is true, and test was last true more than one minute ago”. You are turning off the front light, so as long as you put the condition back to include the test and (… ) , you should be good on that part.

I hope this helps you out. I’m still a newbie with PLEG, but I’m picking things up here and there.

@ SirMeili , You’re absolutely right. Since I delete the PLEG everytime , I inserted the wrong code for testing this time… I tried again with the

test and (test; Now > 01:00)

Nothing happends.

So when I use test; Now > 01:00 something is doing something , but with the "test and … " in there as well no joy…Is there maybe somewhere an errror with a space?

Attached the status report after toggling the front door light and trying it twice.

I also did the debug log , that one is attached as well , the txt-file

Thanks,
Cor

This is a bug of mine and yours.

You called the condition the same name as the trigger. I did not protect this … and I should have.

Until I saw the report I did not notice that!
Call your condition something like AutoOff

@ RichardTSchaefer : ahhhhh , I thought they had to be the same name :slight_smile:

I just did the test with the lights and it worked perfectly, tonight I will try it with the gate-doors , but that will be the same , so I don’t expect an issue…

The next step is using this PLEG condition-action only for the scene , how do I have to implement this?

A quick explanation;

I open my gate with 2 different ways ;
1: with a scene, activating the scene will open the gate and after 90 seconds it will close the gate.
2: manuel selecting the device >> gate stays open.

In case of the second option , I want the gate to remain open.
But in the first option , I always want the gate to close , sometimes the gate doesn’t close automatically, that’s where this Pleg stuff has to come in.

On the gate is a sensor, and this will be the trigger for the PLEG. But if I open the gate with the scene or manuel ,PLEG doesn’t know this , and will close the gate if it didn’t close by itself.

How can I incorporate this , that PLEG will only look at the sensor when the gate is open when the scene is activated and not when the gate is has been opened manually.

Thanks,
Cor

Cor,

What I do is I use a virtual switch for this application. So for instance in my “party mode”, I don’t want my door to lock automatically after 5 minutes. I used the virtual switch plugin to create a switch called “lock door”. In Pleg I created an input for when “Lock door is on” (true when the virtual switch is on) called LockDoor. Then in my condition I added …“And LockDoor”.

What this does is when I activate the scene “Party mode”, it turns that switch OFF. PLEG now won’t lock my door. In my “good night script”, I have that switched turned back to on, so that basically every night the switch is reset for me (so I don’t accidentally leave that off). Also note that this doesn’t prevent me from locking the door manually. It just prevents the auto locking action I set up.

In your case, I would use the same virtual switch, and just turn that switch On when you start your scene, then when you have PLEG close the gate automatically, turn the virtual switch back off. This way it will always be reset to off when the gate is closed automatically and you won’t have to worry about anything when you open it directly from the device.

I hope that helps and that it makes sense.

@ SirMeili, yes indeed it does make sense and sounds like a good idea. I wait a little implementing this , maybe there is an option not to use a virtual switch, and controll all via the scene/PLEG.

Good to know there is at least one solution.

Cor