If door is open for 10 minutes and it's between ...then

Edit
Try out this beta scene scripting plugin [url=http://forum.micasaverde.com/index.php/topic,9770.msg65609.html#msg65609]http://forum.micasaverde.com/index.php/topic,9770.msg65609.html#msg65609[/url]d see if it helps…possibilities are
If the door is open for 10 minutes turn off air conditioning
If the temperature is above 80 for ten minutes then send me a text message
If the garage door is open for more than one hour and it’s after 11:00pm then …
If the lights are on for one hour and it’s between 12:00 am and 5:30 am then turn them off

Add timers to events and add between time and time b comparisons.

Give me some feedback…this is work in progress.

End Edit

I am working on a new plug in and added an interesting feature to it:
I have four virtual switches …
First one is named Trigger
Second one is named On For
Third One is named It’sBetween
Last one is called All True

This is how it works…setup a scene event of whatever you want to turn on “Trigger”
“On For” will turn on when “Trigger” has been on for X number of minutes
“It’s Between” goes on and off from time X to time Y (all the variables are setup in the advanced tab…you can also disable the switch and keep it on)
“All True” comes on when all the other lights are on “logical and”

You can then create a scene that is triggered by “All True”

It helped me create more complex events with no code.
I could strip out the code for this and turn it into a plugin if it seems useful…
Let me know.
Regards
Tim Alls

I think it could be useful.

I take it that this device will recognize only switch devices. That isn’t a limitation because users can always plant a virtual switch in between to translate their own events into a switch state.

To truly make this user-friendly we’d probably want to make a JavaScript tab to configure it. Want help?

I agree that this could be very useful. Personally I wouldn’t replace all the “and” I have in my luup code since then I would have to create quiet a few of these “and devices”. But I see some use cases where I’d like to manually interfere…

Especially I see great advantages for users which are not into coding (and code usually scares normal people). Being able to create and cases by mouse-clicks without having to search for lua examples is surely a great function for not so advanced users.

It’s almost like all plugins, of course you could do it with luup code, but it’s just so much simpler and nicer by plugin. :wink:

I think something like it should be in the interface, UI6? After all MCV markets the device for ‘normal’ users.

Personally I can manage with code but the advanced scene interface of the Home Center 2 really seems user friendly. I think your suggestions are very useful and you should proceed with the plug-in if you want.

[quote=“futzle, post:2, topic:170789”]I think it could be useful.

I take it that this device will recognize only switch devices. That isn’t a limitation because users can always plant a virtual switch in between to translate their own events into a switch state.

To truly make this user-friendly we’d probably want to make a JavaScript tab to configure it. Want help?[/quote]
They are all standard BinarySwitches so they show up in the Scene menus.
The trigger scene can be anything…temperature is above or below…door is open…anything that is available in a scene Event. The scene then turns the trigger light on. The nice thing is that it is visual, just look at the lights and see if they are all on.
Help would be great…the part I am struggling with is the UI…Java…etc…lua has become pretty easy but I really get frustrated with the rest!
I will post a simple version after work tonight and maybe you can help dress it up ;D
Regards
Tim Alls

Here is the quick and dirty…I did not have time to remove all the references.
I could use help on the JSON…right now variables are updated through the advanced tab…Java would be better.
Take a look …I know it’s rough but it works!
Regards
Tim

For Newbies…
Under Mios Tab/Files…scroll to bottom and upload all of the files
Under Mios Tab/create new device …enter a description and the D_Alls.xml for the next line…press Create
Restart the Vera
The Parent is the device with your Description…under its advanced tab at the bottom are the variables that control the logic…beginning time and ending time are in a 24 hour format…HH.mm
The counter is set here as well, Initialized as a zero …set it for as many minutes as you want (right now it updates every 30 seconds for easier debugging so it will count faster than normal)
Press the REDsave button …top right corner of the UI to save the changes and restart Vera.
To use this Plugin…
The trigger can come from any event you can generate inside a scene…the action should turn on the Trigger.
Once Triggered the counter starts incrementing until it matches your OnFor variable…then it switches on the OnFor Light.
The Between light operates all the time…if its between your two times then it is on…if you don’t need it leave it set like it is…from 00:01 to 23:59
The last light watches A B And C…if all are on it switches on. Use this light to generate an event in a new scene … Then pick what you want it to do.
Thats it…
Please give feedback while we are tuning it up…it need to make sense to all!

and the S file

Ok, downloaded and being studied. It’s quite possible that it’ll be unrecognizable by the time I’m done with it. :slight_smile:

Ha…don’t worry about it…it is the concept that counts. Things I like are the left to right logic, seeing the lights going on and off so you know what is going on and the end result of a complex scene with no code!
Things I would love to fix…
I would love it if the Between had its Begin, Current, End times above the switch for easy reference
It would be great if the OnFor had the same thing, plus an indication if it were counting or not
This clip of code came from a Temperature Plugin…so the Parent should be changed to not show up as a temperature module or be using the temperature variables
The variables for time are under the advance tab…to change them is a little unfriendly…maybe a Java update table…that one is beyond me
Feel free to strip out unused references…this was a cut and paste plugin so it’s messy…Ten minute Hack!

I see questions about coding ALL the time on the forum that this simple Plugin will eliminate…for some it’s a fun challenge…others are very frustrated!

Have fun
Regards
Tim