We have moved at community.getvera.com

Author Topic: openLuup - running unmodified plugins on any machine  (Read 106112 times)

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup - running unmodified plugins on any machine
« Reply #15 on: July 06, 2015, 10:49:48 am »
Time for an update.

I'm pleased to say that Release 1 of openLuup is on the blocks. 

What openLuup Release 1 does:
  • runs on any Unix machine - I often run it within my development environment on a Mac (makes debugging easy.)
  • includes a bridge app to link to remote Veras (which can be running UI5 or UI7 and require no additional software.)
  • runs many plugins unmodified - particularly those which just create virtual devices (eg. Netatmo, ...)
  • runs the ALTUI plugin to give a great UI experience
  • uses a tiny amount of memory and boots up very quickly (a few seconds)
  • creates all devices on startup (this means they are numbered consecutively for those that worry about these things.)
  • has its own port 3480 server which supports multiple asynchronous client requests
  • has a fairly complete implementation of the luup.xxx API and the HTTP requests
  • has a simple to understand log structure - most events generate just one entry each in the log.
As an existence proof, I attach a parent/child diagram, produced by the splendid ALTUI plugin from @amg0.  It shows openLuup on a BeagleBone Black (might as well be a Raspberry Pi, could be anything really) running Netatmo and DataYours and also four copies of the VeraBridge plugin which connects (both monitoring and control) to three remote VeraLites running UI5 and one Vera Edge running UI7 - some 228 devices in all.  (I posted this on the ALTUI thread too, so apologies if you have seen it there already.)

What it doesn't do:
  • Has no persistence - this is a design feature, not a shortcoming.  Persistence arises from either the remote Veras to which you bridge, or any database applications you may have (eg. DataYours).  Your local device structure is created by the startup code using standard luup calls.
  • Doesn't yet run scenes - I mentioned in an earlier post that I plan to support scene actions and timers (all the infrastructure is already built in) but triggers will be done differently.
  • Doesn't have the luup.io module yet.  So whilst a plugin can use the LuaSocket library (many do) the I/O support from that part of luup (specifically the handling of <incoming> job tags) is not yet supported.
  • because of the above, it doesn't yet run the Arduino plugin, which is really my main goal - to have a Vera-like machine built entirely from third-party (open source) components.
  • Won't run encrypted, or licensed, plugins.  This probably applies to PLEG, sadly, but I will have to talk to Richard about this.
  • Doesn't use lots of memory.  The attached example runs in about 8 Mbytes of Lua address space.
  • Doesn't restart as often as Luup on a Vera - in fact, dare I say it, it doesn't crash at all.
  • Doesn't do UPnP (and never will.)  This actually means that it doesn't use S_xxx.xml files at all, although for full functionality, ALTUI does use them.
I can't release this on the MiOS App Store, of course, since it doesn't run on Vera!  For release 1 I'll post a .zip file with the lua code and the VeraBridge plugin (which, itself,  probably would run on Vera, since it's just a normal plugin) and some initial documentation to get you going.  Just tidying up a few things before I do that.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline mcalistair

  • Full Member
  • ***
  • Posts: 179
  • Karma: +6/-3
  • "Luctor et Emergo"
Re: openLuup - running unmodified plugins on any machine
« Reply #16 on: July 06, 2015, 11:19:35 am »
Kudos & Respect, thanks for all your work!
1x Vera3@UI5 = PROD (1x Edge@UI7 = SandBox ), 15x ZWAVE Devices, 8x 'legacy' X10 devices controlled via Visonic PowerMax Alarm Panel Plugin, 5x Philips HUE devices, 1x iTach IP2CC, 1x Netatmo Weather Station, AltUI

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup - running unmodified plugins on any machine
« Reply #17 on: July 09, 2015, 08:12:21 am »
Here is Release 1 of openLuup.  I have done my best with the documentation (and the code!) but have no doubt that there will be questions.  I'm happy to help, but bear in mind that you're installing a system on hardware that I probably don't have, running under a version of unix that I don't have, on a network that's different from mine, ...

Nevertheless, openLuup is pure Lua (5.1) so should run as expected.

I'm very keen to get any feedback on this.  I'm now regularly using openLuup running on my BeagleBone Black linked to four Veras and running ALTUI as my main system interface.  I have a vested interested in making this work, and making it better.  There is more to do, but this is a start.

Good luck.

------

Edit:  My first erratum... you do also need to install the LuaSocket library on your machine - "apt-get install lua-socket" worked for me.

Edit: Release 2 available here: http://forum.micasaverde.com/index.php/topic,32315.msg243104.html#msg243104
« Last Edit: July 31, 2015, 10:42:16 am by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline nitehawk

  • Sr. Newbie
  • *
  • Posts: 43
  • Karma: +1/-1
Re: openLuup - running unmodified plugins on any machine
« Reply #18 on: July 09, 2015, 10:41:07 am »

awesome, will try this next weekend.

I will let you know the results

Offline vosmont

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 687
  • Karma: +60/-8
Re: openLuup - running unmodified plugins on any machine
« Reply #19 on: July 09, 2015, 11:36:45 am »
Great !

I've tried to install it and run with ZeroBrane Studio on Windows 7 64bit :
Code: [Select]
error loading module 'openLuup.init' from file './openLuup\init.lc':
./openLuup\init.lc: cannot load incompatible bytecode

It seems that you have compiled with your Mac, perhaps is it the problem ?
http://stackoverflow.com/questions/1047236/lua-compiled-scripts-on-mac-os-x-intel-vs-ppc

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup - running unmodified plugins on any machine
« Reply #20 on: July 09, 2015, 11:55:32 am »
@vosmont

Make sure that in ZeroBrane Studio you have selected the "Lua"  (not 5.2 or 5.3) interpreter under the Project menu.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline vosmont

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 687
  • Karma: +60/-8
Re: openLuup - running unmodified plugins on any machine
« Reply #21 on: July 09, 2015, 11:59:27 am »
Yes, it's Lua (5.1)

If I choose Lua 5.2, the error is :
Code: [Select]
error loading module 'openLuup.init' from file './openLuup\init.lc':
./openLuup\init.lc: version mismatch in precompiled chunk

The version of ZeroBrane is 1.10

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup - running unmodified plugins on any machine
« Reply #22 on: July 09, 2015, 12:03:42 pm »
It seems that you have compiled with your Mac, perhaps is it the problem ?
http://stackoverflow.com/questions/1047236/lua-compiled-scripts-on-mac-os-x-intel-vs-ppc

Ah!  Interesting read - I had hoped for more portability than that!

At a pinch, I could provide modules compiled on a PC.

I run ZBS on a Mac (as you can tell) and openLuup runs fine within it - except that you must bear in mind that the Port:80 server directories are not likely to be correctly configured so the ALTUI interface will almost certainly not work.

 
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup - running unmodified plugins on any machine
« Reply #23 on: July 09, 2015, 01:05:18 pm »
OK.  Here's the files compiled on a Windows machine.  I hope this is right...

... I had to find a PC, install Lua 5.1.4, and generate the files!

3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline vosmont

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 687
  • Karma: +60/-8
Re: openLuup - running unmodified plugins on any machine
« Reply #24 on: July 09, 2015, 01:37:24 pm »
Sorry, it does the same.

My config : Windows 7 64bit / ZeroBrane 1.10 32bit

I will try on a linux VM

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup - running unmodified plugins on any machine
« Reply #25 on: July 09, 2015, 01:46:20 pm »
Sorry, it does the same.

My config : Windows 7 64bit / ZeroBrane 1.10 32bit

I will try on a linux VM

Ah, OK.  Sorry.  In fact, I now recall that these were compiled on my BeagleBone Black, not the Mac at all!  Linux may be good (fingers crossed.)

3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline vosmont

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 687
  • Karma: +60/-8
Re: openLuup - running unmodified plugins on any machine
« Reply #26 on: July 10, 2015, 11:27:35 am »
I've not yet tried on a Linux VM, but I think the problem under Windows and ZeroBrane is that the embeded Lua is in 32bit.

I've tried with the Lua 5.1 64bit, but there's problems with the socket.lua, which is for 32bit.
Perhaps could you compile with a Lua 32bit version ?
« Last Edit: July 10, 2015, 01:17:48 pm by vosmont »

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup - running unmodified plugins on any machine
« Reply #27 on: July 10, 2015, 11:37:23 am »
No, can't be having that... I just thought that compiled code would be worth a try.  Nothing to hide, although these bits of the system are liable to change (come to think of it, all of it is!)

Here's the sources.  Would still be interested in whether anyone can, in fact, use the .lc files.  But it's more important to get feedback on a working system!

Thanks - sorry for the inconvenience.

« Last Edit: July 10, 2015, 11:47:12 am by akbooer »
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline mvader

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: +29/-75
Re: openLuup - running unmodified plugins on any machine
« Reply #28 on: July 10, 2015, 11:55:47 am »
this looks like a great start to the project.. thanks for taking it on.
I'll be looking to run this once you can make the arduino plugin work as i'd like to offload that from the vera.

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup - running unmodified plugins on any machine
« Reply #29 on: July 10, 2015, 12:13:34 pm »
this looks like a great start to the project.. thanks for taking it on.
I'll be looking to run this once you can make the arduino plugin work as i'd like to offload that from the vera.

Thanks indeed.  Sorry to disappoint with Release 1 not supporting Arduino.  I'm wondering how many people use a serial connection versus IP - I'd rather do internet since it involves fewer hardware issues.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.