Hi,
I am writing code for my touchscreen computer that will add conditional logic in a visual form…no scripting!
I have the basic code written which will give the user visual timers, logic LEDs, and more but I need real examples of events you would like to create without writing code.
EG: send me a text messagage when the door is opened between 12:00am and 5:00 am AND the alarm is not armed. (for parents with teens that sneak out!)
Flash the porch lights on and off on two second intervals for the next 15 minutes so our guest can identify our home.
You get the idea. Please post some more…Thanks
Tim
Have the foyer light check the front door lock at 11pm- if the door is unlocked- turn the foyer light on as a reminder to go lock the front door.
I have this scene currently running on my system.
Thanks…good start. I will post the displays when I am done. It is easy to ask MCV to add conditional Logic without writing code but it is more difficult than you would think. If all of you would take a minute and give me a few more examples then I can work out a visual method that MCV might take into consideration as a possible new feature. Well I can dream right?
Regards
Tim
Turn lights on (maybe only to a specific % of full brightness) when a pin code is entered only after sunset and only if the light is already off.
Thanks,
The code I have will do this except for the “only if the light is off”.
I will look at adding another set of “Ands” just to cover this kind of scene.
Tim
The most requested “and” for those that don’t want to even touch Luup is:
Turn light on if motion is sensed AND it is dark outside.
That alone would make a lot of basic users happy.
Are you making a webpage that will generate the Luup code for you (once you enter some specific information and check a few choices)? Then you just copy paste the generated code into your scene (MCV was going to make that available many moons ago).
Or is yours going to be part of the UI where your user will never see Luup code?
either way best of luck, and I hope we can be of some help
I am making my code apart of the touchscreen interface and the users will never have to write any code. The first version is with Labview and after I have proved out the interface then I will be rewriting the interface in another language that I can distribute. Using Labview will allow me to write all the code in the next week or so. I don’t have the same hardware as everyone else so my code will not be proved out for all users…but it proves out that conditional logic can be made user friendly.
It has been tougher than I thought to make it work but I am getting close.
The interface uses events that are created by different devices like door open, with an optional timer.
The logic from the events is visually displayed so the user can watch the logic in process using simple Red and Green LEDs. The timers are visual as well…you can see the count down in progress.
This is where it gets tricky…another set of visual condition sequences are setup with drop down boxes to choose the event or events. A picture is worth a thousand words…I will post it when I get further along.
Regards
Tim Alls
Regards
Tim Alls
AllSeas Yachts
@MCV
Why not use RPN to implement boolean logic?
not ((A and B) or (C and D))
would be decomposed by the user into:
A
B
and
C
D
and
or
not
Pro:
Very easy to implement (the ‘Advanced’ tab for scenes uses a similar concept).
Con:
Not quite intuitive from the user’s perspective.
From How can I implement user-friendly boolean logic in a web form GUI? - Stack Overflow
When I see a problem like this, I can't help but thinking about implementing it as a stack, similar to how RPN would solve this problem.The problem here is that it doesn’t seem too intuitive
Sample UI: ([Button] {list}
Value : < > [Push] [And] [Or]
Stack {
} (HP RPN calculators put the stack above the editing area)
So, if I wanted to write the expression ((A and B) or (C and D)), I would do this: A [push] (stack would contain “A”) B [push] (stack would contain “B”, “A”) [and] (stack would contain “(A and B)”) C [push] (stack would contain “C”, “(A and B)”) D [push] (stack would contain “D”, “C”, “(A and B)”) [and] (stack would contain “(C and D)”, “(A and B)”) [or] (stack would contain “((A and B) or (C and D)”)
if you wanted to add other operators, and there weren’t too many, you could just add additional buttons, or make a separate textbox for the operator
Value: < > [Push] Operator < > [Combine]
If you wanted to support unary operators, you’d need to keep track of whether it’s a prefix or postfix operator, or just assume prefix (the boolean unary operator “not” is generally prefix). Ternary operators generally have two infix designators, so there’s more complexity if you want to support them. Some binary (and n-ary)operators have a prefix, infix, and suffix component “CallMethod(A,B)” So it really comes down to how complex you want to make it.
Just one idea.
Why doesn’t Vera have conditional logic to begin with?
Ap15e,
Interesting…takes me back to my younger days where I started out writing assembly language for the 6502 processor (now you know old I am!). Thanks for the input, this has been a challenging bit of code, not difficult to program, just hard to make a simple interface.
More to come…
Regards
Tim Alls
S-F
Maybe if more people asked for it they would put it on the list. I think they are very busy dealing with new hardware…