2 Physical switches (one can be switched by hand in person, the other one switched by my car (home or not))
1 virtual switch (away mode)
i made 3 scenes … 1 does the “comming home”, one “leave home” and another one for “away/sleep mode”
at the moment it works like this
the physical switch turned on … triggers the “sleep scene” … in the sleep scene is a timer wait for 10 minutes … and check then if the car switch is on or of
if off (car not home) the “leave home” will be triggered (this includes the Virtual away switch will be turned on)
also on the end of the timer the physical away button will be turned back off … (since this switch is used to trigger the scene only (has nothing connected))
the virtual switch is used to check on other scenes if they need to run or not.
the car switch turned back on triggers the “comming home scene” and turn off the away switch…
all this has a grown a quite large amount of Luupcode already …
any suggestions on how to make this more “simple” ?
install the ‘program logic event generator’ app and try to put most of your logic in there, that should help you to replace most of the luup-code you currently have. documentation and examples can be found here: Program Logic Event Generator - Vera Plugin
There are quite a few threads about PLEG, there is a child board under programming, in plugin developments just for PLEG. You find quite a few examples there which will get you started.
sorry for the missunderstanding,
the question was more about the logic itself …
on how others accomplish things like that, to share some insights and ideas.
its simple enough to oversee, but on some places more complex to be handled by a plugin.
also iam not really a friend of plugins, unless they do provide some sort of ease.
One of the main advantage to PLEG in your case is that it brings all of the related pieces together into one place … and consequently through the Report and Status commands … its easy to see how the pieces are working together.
It’s very difficult to understand the whole process when the code is spread between multiple scenes, with LUA spread between the scene level scope and the trigger level scope … or trying to understand what actions are accomplished when something happens by looking at the LUA code … I assume you program the device actions in LUA code so that you can reduce the number of required scenes. Without PLEG you have increased complexity resulting in the sprawl of the code or the obfuscation of the logic and actions as a result of the LUA structure.
Think about this … could you explain your logic to another programming literate person ?
If you use PLEG I believe the answer is YES
Best Home Automation shopping experience. Shop at Ezlo!