We have moved at community.getvera.com

Author Topic: Question for MCV: Luup/Lua?  (Read 10431 times)

Offline EC

  • Sr. Newbie
  • *
  • Posts: 25
  • Karma: +0/-0
Question for MCV: Luup/Lua?
« on: June 24, 2009, 02:24:25 pm »
Question for MCV:

Been looking for Vera to add the ability to do conditional scences - motion is detected AND it's past 8:00PM.  In the past I've been told that the new LUA will allow this.  However, everything I've read seems to talk about programming and cutting and pasting code.  I was under the impression that the Vera would allow for these more complex scenes so that the average non-programmer/non-techie could do it (which is me).  That was the appel of Vera to me. 

I was imaging clicking the Set up on the interface and the options for more complex scenes were somehow built into the drop downs as they currently are today, just with more choices.

Is the complex scenes really going to require programming, cutting and pasting, testing code...or is that just for now since it's new?  I would hope that these conditional statements for scenes would be easy for the non programmers because they are built into the Vera interface by MCV.  Can anyone or MCV comment please so I understand where LUA/LUUP is headed for the Vera product?

Thanks.

Offline Anthony420

  • Jr. Member
  • **
  • Posts: 52
  • Karma: +0/-0
Re: Question for MCV: Luup/Lua?
« Reply #1 on: June 24, 2009, 05:16:11 pm »
I'm glad someone else shares my concern about Lua as a macro language for non-programmers.  I've been trying to get the answer to this question every day by reading all the Lua messages.   

Does Micasverde believe that everyone who ones a Vera is a Linux programmer?   As for myself, I can write code for industrial PLCs, and have had a fair amount of programming experience with industrial devices.  I am not, however, a programmer for PC systems, and after looking at the Lua instruction set, came to the conclusion there is no way I could do this.

In addition to my Vera, I have an Elk M1 system in another home.  In  Elk, you can find the kind of combinational logic commands, i.e. AND, OR, etc. that enable you to write simple macros from pull-down menus.  Vera does not have to go as far as the pull-downs, but the ability to learn some simple macro commands and program more complex scenes is what many (possibly most) of us are looking for.

Let's start a list of what many of us feel are the minimum capabilities of the macro language we want.  I know this will get out of hand, but let's try.

AND
OR
IF/THEN/ELSE


OK, I started the ball rolling....


Regards and Thanks,
Anthony

Offline 325xi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1101
  • Karma: +0/-0
  • V1, V2, still V2...
Re: Question for MCV: Luup/Lua?
« Reply #2 on: June 24, 2009, 11:46:58 pm »
I don't know what to say - LUA is scripting language, not nearly as complex as "real" programming languages (ex. C++), but it's much more capable then average proprietary set of macros.

Offline EC

  • Sr. Newbie
  • *
  • Posts: 25
  • Karma: +0/-0
Re: Question for MCV: Luup/Lua?
« Reply #3 on: June 25, 2009, 01:24:33 am »
325xi, I can appreciate that LUA is a scripting language that isn't as complex as programming languages, however, if you read this from Vera's website:
"Full-featured home automation made simple
If you thought home automation was complicated then you've never seen Vera. With Vera even a total novice can do everything you'd expect from a high-end home automation system"

ask yourself if you were not at techie or programmer what you would expect?  The issue in the past has always been that Vera can't do it because it doesn't have a powerful enough or the correct internal language to do the more complex scenes.  But now that it does have it, couldn't the current interface be enhanced to include slightly more advanced options to create scenarios?  I'm on the same page as Anthony.  Some common enhancements like And, or, if then else would be a great start to add to the existing interface that would allow the non-programmers the ability to do what they are looking for without much effort (which is the point for non-programmers)

If I asked the original question to MCV, and their answer in the past would have been:  no, you can't do complex scenes today, but in the future the LUA plug in will allow programmers the ability to write complex scripts, I probably wouldn't have purchased Vera.  But the answer by MCV has always been, when the LUA plug in is in place, you will be able to.  The entire aspect of the programming needed to make it happen was missing.  I think it was assumed by me and others that it would be built into the existing interface.


Offline micasaverde

  • Hero Member
  • *****
  • Posts: 1666
  • Karma: +15/-1
Re: Question for MCV: Luup/Lua?
« Reply #4 on: June 27, 2009, 04:06:36 pm »
EC, I did a full walk-through of how to make a conditional scene.  Read it here as walkthrough #1:

http://wiki.micasaverde.com/index.php/Luup_Scenes_Events

Instead of doing Lua, we could have done a page that builds a condition with pull-down menu options.  I'm not sure that it would be really any easier, though.  Using Lua, you copy/paste the code:

Quote
if( tonumber(lu_GetVariable("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature",3))<26.6 ) then
   return false
 end

and replace the service/variable/device id with your real one.  If we had a GUI to build a conditional expression, it would need to account for nesting, and/or/else cases like if( this and (that or that) ) then whatever else somethingelse...  It's true that it would save you from copy/pasting the service/variable names from http://wiki.micasaverde.com/index.php/Luup_Variables.  But, it would also be a lot more limited in terms of what you could do.  For example, let's say you have several scenes/events you want to run when certain conditions are met (like it's freezing), with this approach you could put the if inside a function block, like this:

Quote
function MyCondition
  if( whatever complex statement ) then
    return true
  else
    return false
  end
end

Now, with any scene or event which you want to run based on that condition, you just click "Luup" and type in: return MyCondition()

So it might be slightly easier to build a very simple condition if we did it interactively using pull-downs, but it would be much less powerful and flexible.  Since the concept of conditional expressions are already too complicated for the tech novice, and our "normal non-techie" users don't even know what a conditional expression is and won't ever use one, we figured that for someone with enough technical skills to understand what a conditional expression is and what he wants to do with it, he could probably figure out how to copy/paste from a sample like this one just as easily as build an expression with a GUI tool, and, it opens the possibilities to do almost anything with Lua.  Remember, if we had take the route where we used a GUI tool instead of a script language, you wouldn't be able to do things like control rs232 devices, check online weather reports, etc.

Our hope is that some of the people who create neat stuff with Lua will post it in the Luup gallery, and then even total novices can use it.

Offline Anthony420

  • Jr. Member
  • **
  • Posts: 52
  • Karma: +0/-0
Re: Question for MCV: Luup/Lua?
« Reply #5 on: June 28, 2009, 10:48:54 am »
Well, I'm going to give it a try!  I can see that the Vera community does not agree all that much with EC and I, so I guess I need to learn Lua.

I did read the detailed response / tutorial from MCV, and found several websites with decent Lua tutorials.
http://lua.gts-stolberg.de/en/Editor.php  "Lua for Beginners"
http://lua-users.org/wiki/TutorialDirectory  Lua wiki tutoria

I also downloaded a good Lua editor/debugger that has allowed me to practice writing simple scripts:
http://luaedit.luaforge.net/

Maybe, with enough cutting and pasting, I can learn enough to get by.  My only concern is being 750 miles from my Vera's reset button, I need to make sure I'm not going to lock myself out, which seems easy to do. 

Is there a way to simulate vera on a local PC for purposes of testing my scripts?  I do have a Linux machine (ubuntu) available for playing around.

Regards,
Anthony


Offline drzeller

  • Full Member
  • ***
  • Posts: 103
  • Karma: +1/-0
Re: Question for MCV: Luup/Lua?
« Reply #6 on: June 28, 2009, 10:29:56 pm »
... Since the concept of conditional expressions are already too complicated for the tech novice, and our "normal non-techie" users don't even know what a conditional expression is and won't ever use one...

As an IT manager with programming background, I don't expect to have an issue with writing the code, but I do think that the original poster has a valid point.

A user may not know what a "conditional expression" is, but they certainly know what it means to want to do something if motion is detected and it is after 8pm.

If you had asked what I would have expected from Vera in the mid- to long- term, I would have included GUI creation of simple conditions like the one above.  If it were limited to simple compound conditions, that would be ok - with more complex conditions requiring coding.  If you were take a look at some simple graphical SQL tools or mathematical software for typesetting and/or entering equations, you could probably find some inspiration for ways to allow users to enter more complex conditions. (Perhaps the Vera code to create these complex conditions may need to be written in java or other cross-platform tools and run on a person's PC/Mac/etc if necessary.)

David

Offline 325xi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1101
  • Karma: +0/-0
  • V1, V2, still V2...
Re: Question for MCV: Luup/Lua?
« Reply #7 on: June 28, 2009, 11:10:58 pm »
So far I haven't seen any graphical  tool allowing building complex conditions in clear and simple way. If it's more then just "a AND b" any grafical representation becomes bulky and unreadable.

But I too agree that the original poster has a valid point.

I however would vote for a set of oversimpified macro's: let user give the devices his preferred names/IDs, and let him write complex conditions in simple BASIC-like form. Basically, take what it looks in LUA, and remove or wrap implementation details, simplify terms, eliminate fields or translate field names into clear words, etc.

IF THERMOSTAT.TEMP < 80 AND TODAY == FRIDAY THEN
   SET HALL_LAMP ON FOR 1 HOUR;
   SET THERMOSTAT.TEMP = 84
ENDIF
  
« Last Edit: June 28, 2009, 11:14:10 pm by 325xi »

Offline EC

  • Sr. Newbie
  • *
  • Posts: 25
  • Karma: +0/-0
Re: Question for MCV: Luup/Lua?
« Reply #8 on: June 29, 2009, 02:52:42 am »
Hi folks, I'm the original poster.   Thanks for the support in understanding my point of view from both the non-techie side as well as I.T. skills side.  The message from drzeller hits exactly what I'm feeling on the head.  I'm looking for very simple improvements to the power of the interface.  I know what a conditional expression is based upon reading and reading all the postings, but what it comes to actual coding, it's somewhere I don't think I can or want to go.  I will work with whatever comes thru in the end, even if it's a simplified form as described by 325i.  I just would prefer not.  What if I do some programming, and then there is a software update, and it wipes out all the coding I slaved over to make it work.  I just want it to work like it does now, just with a few more choices on when a scene triggers.

MCV - I'm not a programmer or techie as you know, but I am a business man.  If MCV is expecting people to program things that in my/our non-techie heads don't look at as complex, you are going to have a very difficult time getting mass adoption of your product.  Think about it, most people that will want Vera a few years from now will not be programmers.  So maybe Vera really isn't meant for the masses, but only for a limited few who love to experiment, code check, program, etc, but then I can't imagine MCV creating a business model like this that would not be liked by the masses over the long run.  Don't get me wrong, I love the Vera product so far.  It just isn't finishing the vision that I had for the product after reading the original advertising website.  I just assumed it was a matter of time until the Vera was improved.  Please give my opinion some consideration for the sake of creating a superior product that has a strong competitive advantage.

Regards,

EC

Offline micasaverde

  • Hero Member
  • *****
  • Posts: 1666
  • Karma: +15/-1
Re: Question for MCV: Luup/Lua?
« Reply #9 on: June 29, 2009, 11:08:52 pm »
EC, We're on the same page for sure.  But remember we have to put the cart before the horse.  Step 1 is doing all the low-level code to integrate a complete scripting engine to allow for conditional expressions.  Step 2 is, once that's all done, trying to figure out how to create the most user-friendly front-end for it.  We can't do the latter until the former is completed.  So we have to first get the Luup engine released to the public and rock-solid and stable.

We're not going to stop there, we will work on Step 2.  We don't disagree that it needs to be more user friendly.  But we're simply pointing out that Step 2 is not so easy.  I've seen the kind of SQL tools Dr. Zeller is talking about.  And, it's true that they're somewhat simpler than a script.  But, imho, they're still not simple enough for the mainstream non-techie user.  A non-techie user is definitely *not* building SQL queries.  I like 325xi's suggestion about the macros.  But, still, we can't make macros that go on top of the Luup engine until the Luup engine is done.  So, it still goes back to needing to finish up and release the Luup engine.  The macro idea would make things somewhat simpler, but all it's really saving is the need to copy/paste long strings, and using shorter ones instead.  The user still needs to understand the concept of scripting and building a conditional if statement, and, if he got that far, he'd probably be able to do it the normal way.

I think it will be possible to make a GUI tool that does very basic conditional expressions in a web ui for the non-techie.  In the meantime, though, if you tell us here in the forum what you want your conditional expression to do, we can post the sample Lua code here for you to copy/paste.

Offline 325xi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1101
  • Karma: +0/-0
  • V1, V2, still V2...
Re: Question for MCV: Luup/Lua?
« Reply #10 on: June 29, 2009, 11:19:43 pm »
...but all it's really saving is the need to copy/paste long strings, and using shorter ones instead.  The user still needs to understand the concept of scripting and building a conditional if statement, and, if he got that far, he'd probably be able to do it the normal way.

Usability is not about function, it's all about perception.

:)

Offline EC

  • Sr. Newbie
  • *
  • Posts: 25
  • Karma: +0/-0
Re: Question for MCV: Luup/Lua?
« Reply #11 on: June 29, 2009, 11:34:38 pm »
thanks for the explanation MCV.  I just wanted to know where Vera was headed, and you now made it clear that there will be a step 2.  Your last explanation stopped at step 1, so I was unaware of any future improvements.  I have no problem waiting for everything to stabilize before starting to build a more user friendly interface, as long as you are heading down that path.  I think there are more of the non-programmers that want this conditional ability than you might realize, so don't forget about us.

Best,

EC