We have moved at community.getvera.com

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

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: openLuup - running unmodified plugins on any machine
« Reply #225 on: October 13, 2015, 06:00:02 pm »
I think I found the issue, I'm executing your shell script from rc.local (startup) and forgot to place the startup.lua behind it. That seemed to correct the issue of deleting scenes. Again, sorry for the confusion (on my part).
openLuup, AltUI, Zway and HomeWave, enough said...

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup - running unmodified plugins on any machine
« Reply #226 on: October 13, 2015, 06:27:16 pm »
I think I found the issue, I'm executing your shell script from rc.local (startup) and forgot to place the startup.lua behind it. That seemed to correct the issue of deleting scenes. Again, sorry for the confusion (on my part).
Good, that's one I won't pursue further, then.

Re /luvd/ it's a throwback to earlier MiOS versions, I believe. Anyway, openLuup steadfastly ignores that part of the path name, so everything (pretty much) should be in /etc/cmh-ludl/.

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 CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: openLuup - running unmodified plugins on any machine
« Reply #227 on: October 14, 2015, 02:30:34 pm »
Perfect, thanks for confirming.

Quote
Re /luvd/ it's a throwback to earlier MiOS versions, I believe. Anyway, openLuup steadfastly ignores that part of the path name, so everything (pretty much) should be in /etc/cmh-ludl/.

Hue bulbs respond faaast, however I haven't had a chance to troubleshoot the color picker - the option exists but fails to function. I'll look into it more tonight as well as testing the Sonos system.
openLuup, AltUI, Zway and HomeWave, enough said...

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup - running unmodified plugins on any machine
« Reply #228 on: October 14, 2015, 03:22:15 pm »
Hue bulbs respond faaast,
That's the plan.

Quote
however I haven't had a chance to troubleshoot the color picker - the option exists but fails to function.
Haven't got one, Haven't tried - except with the RGBController plugin from @vosmont, which, at least for some supported devices, does tricky things directly with Zwave.  Hue should be different, though.

Quote
I'll look into it more tonight as well as testing the Sonos system.
Haven't tried that either - it does clever things with the UPnP plugin.  Happy to help.


New release (5) out tomorrow.
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 CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: openLuup - running unmodified plugins on any machine
« Reply #229 on: October 14, 2015, 11:25:02 pm »
Ran a couple of tests on Sonos.

luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say", {Text="Testing openLuup.", Volume=20}, 131)
luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "PlayURI", {URIToPlay="x-file-cifs://192.168.2.2/vera/wakeup/alarm2.mp3", Volume=20}, 131)

Code: [Select]
2015-10-14 20:36:21.957   luup_log:0: ALTUI: runLua(luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say", {Text="Testing openLuup.", Volume=20}, 131))
2015-10-14 20:36:21.958   luup.call_action:0: 131.urn:micasaverde-com:serviceId:Sonos1.Say
2015-10-14 20:36:21.958   openLuup.context_switch::  ERROR: ./openLuup/luup.lua:310: attempt to index field 'services' (a function value)
2015-10-14 20:36:21.958   openLuup.server:: error in callback: lr_ALTUI_LuaRunHandler, error is ./openLuup/luup.lua:310: attempt to index field 'services' (a function value)

--

2015-10-14 22:04:17.114   luup_log:0: ALTUI: runLua(luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "PlayURI", {URIToPlay="x-file-cifs://192.168.2.2/vera/wakeup/alarm2.mp3", Volume=20}, 131))
2015-10-14 22:04:17.115   luup.call_action:0: 131.urn:micasaverde-com:serviceId:Sonos1.PlayURI
2015-10-14 22:04:17.116   openLuup.context_switch::  ERROR: ./openLuup/luup.lua:310: attempt to index field 'services' (a function value)
2015-10-14 22:04:17.116   openLuup.server:: error in callback: lr_ALTUI_LuaRunHandler, error is ./openLuup/luup.lua:310: attempt to index field 'services' (a function value)

openLuup, AltUI, Zway and HomeWave, enough said...

Offline Aaron

  • Hero Member
  • *****
  • Posts: 1985
  • Karma: +61/-193
Re: openLuup - running unmodified plugins on any machine
« Reply #230 on: October 15, 2015, 12:11:10 am »
akboor,
Just curious if you might update the 1st post with the status of how this project is going? It would be cool to be able to run openLUUP on a full PC, in a virtual machine, or on a RPi - and relegate the Vera3 to the closet. I have a Wink which has BT, Zwave & Zigbee so that woul be a much better interface to teh devices while being able to use the Vera plugins to do all the great stuff they do!

thx!

Offline mda

  • Sr. Member
  • ****
  • Posts: 464
  • Karma: +9/-0
Re: openLuup - running unmodified plugins on any machine
« Reply #231 on: October 15, 2015, 02:13:14 am »
I remember having issues setting my Windows system up (it was awhile ago) as well but then I switched over to ZeroBrane and it had the necessary modules. Here's what I have in my dev folder, not sure it will help though. I also included a SSL.dll. 

lmk if that helps...


Thanks @CudaNet - I was able to get luasocket and luasec installed on my Windows 7 machine. I now have Lua installed in C:\Program Files (x86)\Lua\5.1\

and i have openluup installed in C:\etc\cmh-ludl

When i run lua openLuup/init.lua reset it looks correct i think:

Code: [Select]
C:\etc\cmh-ludl>lua openLuup/init.lua reset
device 0 '_system_' requesting reload

but when i then run C:\etc\cmh-ludl>lua openLuup/init.lua i get an error:

Code: [Select]
C:\etc\cmh-ludl>lua openLuup/init.lua
lua: C:\Program Files (x86)\Lua\5.1\lua\socket.lua:29: attempt to call field 'getaddrinfo' (a nil value)
stack traceback:
        C:\Program Files (x86)\Lua\5.1\lua\socket.lua:29: in function 'bind'
        .\openLuup\server.lua:361: in function 'start'
        openLuup/init.lua:176: in main chunk
        [C]: ?

LuaUPnP.log is:

Code: [Select]
C:\etc\cmh-ludl>more LuaUPnP.log
2015-10-14 22:57:23.883   :: openLuup STARTUP ::
2015-10-14 22:57:23.883   openLuup.init::      version 2015.08.30  @akbooer
2015-10-14 22:57:23.903   openLuup.scheduler:: version 2015.08.23  @akbooer
2015-10-14 22:57:23.903   openLuup.server::    version 2015.08.23  @akbooer
2015-10-14 22:57:23.923   openLuup.scenes::    version 2015.08.30  @akbooer
2015-10-14 22:57:23.933   openLuup.chdev::     version 2015.08.26  @akbooer
2015-10-14 22:57:23.933   openLuup.io::        version 2015.08.15  @akbooer
2015-10-14 22:57:23.933   openLuup.luup::      version 2015.08.26  @akbooer
2015-10-14 22:57:23.943   openLuup.rooms::     version 2015.08.15  @akbooer
2015-10-14 22:57:23.943   openLuup.requests::  version 2015.08.24  @akbooer
2015-10-14 22:57:23.943   luup.create_device:: [1] urn:schemas-micasaverde-com:device:ZWaveNetwork:1 / no-implementation-file
2015-10-14 22:57:23.943   luup.create_device:: [2] urn:schemas-micasaverde-com:device:SceneController:1 / no-implementation-file
2015-10-14 22:57:23.943   openLuup.init:: loading configuration user_data.json
2015-10-14 22:57:23.943   openLuup.init:: loading user_data json...
2015-10-14 22:57:23.943   openLuup.init:: loading rooms...
2015-10-14 22:57:23.943   openLuup.init:: ...room loading completed
2015-10-14 22:57:23.943   openLuup.init:: loading devices...
2015-10-14 22:57:23.943   openLuup.init:: [1] 'ZWave', urn:schemas-micasaverde-com:device:ZWaveNetwork:1
2015-10-14 22:57:23.943   openLuup.init:: [2] '_SceneController', urn:schemas-micasaverde-com:device:SceneController:1
2015-10-14 22:57:23.943   openLuup.init:: loading scenes...
2015-10-14 22:57:23.943   openLuup.init:: number of scenes = 0
2015-10-14 22:57:23.943   openLuup.init:: ...scene loading completed
2015-10-14 22:57:23.943   openLuup.init:: ...user_data loading completed
2015-10-14 22:57:23.943   openLuup.init:: running Startup Lua
2015-10-14 22:57:23.943   openLuup.init:: startup completed

and when i run openluup_check, i get an error which i assume has to do with the script using unix syntax vs windows syntax but i am such a windows noob that i don't know what to do :(

Code: [Select]
C:\etc\cmh-ludl>lua openLuup_check.lua
lua: openLuup_check.lua:2: unexpected symbol near '#'

@CudaNet, @akbooer  -- i think i am just not setting something up right on windows... could you please point me in the right direction? Thanks!

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup - running unmodified plugins on any machine
« Reply #232 on: October 15, 2015, 04:46:42 am »
When i run lua openLuup/init.lua reset it looks correct i think:
Yes, that looks file.

Quote
but when i then run C:\etc\cmh-ludl>lua openLuup/init.lua i get an error:
This is clearly a Lua install issue since it comes from the low-level C binding.

Quote
LuaUPnP.log is:
Strangely, that all looks correct, too - I suppose to the point where it crashes?

Quote
and when i run openluup_check, i get an error which i assume has to do with the script using unix syntax vs windows syntax but i am such a windows noob that i don't know what to do :(

Code: [Select]
C:\etc\cmh-ludl>lua openLuup_check.lua
lua: openLuup_check.lua:2: unexpected symbol near '#'
That's really odd,since I don't see that the code has a '#' in it?
openLuup_check.lua is pure Lua and should be totally machine independent (although I can imagine one thing which is - the opening of binary files sometimes requires an 'rb' modified in the open statement.)

Quote
@CudaNet, @akbooer  -- i think i am just not setting something up right on windows... could you please point me in the right direction? Thanks!
I haven't tried on Windows for a while, I will give it a go.  Everything points to a Lua install problem.

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 #233 on: October 15, 2015, 05:43:37 am »
Ran a couple of tests on Sonos.
I just installed this to give it a go.  Wow! It's very chatty in the log file (this may help.)

Tried this:
Code: [Select]
luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say", {Text="Testing openLuup.", Volume=20}, 131)

...it pauses the current play and then resumes it after a short while without saying anything.  There's lots of stuff in the logs, but no errors (I am using the new openLuup release 5).

The only problem I see (apart from it not working!) is an error in the console window:
Code: [Select]
# rm: cannot remove `/www/Say.4.mp3': No such file or directory

So I'm guessing there was a problem creating the speech file in the first place.  Perhaps someone who knows Sonos can help us with this - it is a complex plugin, but I have to say that I'm pleased the basics seem to work.

I'm just about to post Release 5, so install that first and we'll take it from there.  Backup your user_data.json file before you start, just in case.
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 - Release 5
« Reply #234 on: October 15, 2015, 06:54:40 am »
Here is Release 5 - a comprehensive (but not totally complete) implementation of Luup, including a set of features which are generally sufficient to run a number of standard plugins. 

Changes from the previous release include:
  • setup utility to transfer uncompressed device files and icons from any local Vera
  • auto-install and update of the ALTUI interface
  • ALTUI 'device variable watch'-style scene triggers
  • port 3480 server upgraded to HTTP 1.1 and uses chunked data transfers
  • VeraBridge plugin now supports most action requests to remote machines
  • numerous internal enhancements

All you need to do to upgrade is to replace all the files in you openLuup subdirectory with those from the distribution below.  It would also be wise to update your VeraBridge (if you are using it.)  You could also drag down all your device files and icons from your Vera using the new getfiles utility.

It's now, I think, to a state where we can start compiling a list of compatible plugins.  I'm very happy to help, but it's very hard to debug some problems running under different systems and different hardware.  If you can isolate any difficulties to, say, a system running a single device which fails to work, then so much the better.

--------------------

Tested Plugins:
  • ALTUI - (of course!) Check out the new blockly editor for triggers (see attachment) and also pretty printing in Lua Test
  • VeraBridge - (of course) now supporting a very wide range of remote device actions
  • EventWatcher - although it's not really needed with  simpler logs and ALTUI providing so much good info
  • Netatmo
  • DataYours
  • ...?
« Last Edit: October 15, 2015, 04:35:18 pm 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 akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup - running unmodified plugins on any machine
« Reply #235 on: October 15, 2015, 07:16:51 am »
Just curious if you might update the 1st post with the status of how this project is going? It would be cool to be able to run openLUUP on a full PC, in a virtual machine, or on a RPi - and relegate the Vera3 to the closet. I have a Wink which has BT, Zwave & Zigbee so that woul be a much better interface to teh devices while being able to use the Vera plugins to do all the great stuff they do!

I've updated the first post as you suggest.  I'm not a PC user, generally, nor a VM one either, focusing more on small Linux systems.  I'm now running openLuup on the Linux bit of an Arduino Yun board, with a gateway to MySensors hardware on the Arduino bit of the same board. Don't know anything about Wink, either.

There have been a few problems with PC and VMs, but I hope we can work through those.  openLuup is pure Lua and places very few demands on its environment.
« Last Edit: October 15, 2015, 08:10:45 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 CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: openLuup - running unmodified plugins on any machine
« Reply #236 on: October 15, 2015, 08:47:26 am »
@AK... Wow, you've been busy, this looks great. Will load '5' this morning before I head off to work.
@mda, I have a VM environment (Ubunutu 15.04) at work as well as a Win7 system I can set this up on and test. Will see what I can find today.
openLuup, AltUI, Zway and HomeWave, enough said...

Offline CudaNet

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1401
  • Karma: +42/-11
  • Chimichanga !
Re: openLuup - running unmodified plugins on any machine
« Reply #237 on: October 15, 2015, 09:29:50 am »
My first attempt (w/ v5) was testing via the Lua test code. This returned a result of  "./openLuup/luup.lua:317: attempt to index field 'services' (a function value)".
In v4.5, testing directly within the plugin I never got a result, however today with 5 it worked once. Second attempt failed ...

Code: [Select]
2015-10-15 08:18:01.410   openLuup.server:: /data_request?id=lu_action&output_format=xml&DeviceNum=25&serviceId=urn:micasaverde-com:serviceId:Sonos1&action=Say&Text=Testing%20open%20luup...&Language=en&Engine=OSX_TTS_SERVER&Volume=&GroupZones=&SameVolumeForAll=false tcp{client}: 0x27ed178
2015-10-15 08:18:01.411   luup.call_action:: 25.urn:micasaverde-com:serviceId:Sonos1.Say
2015-10-15 08:18:01.411   luup.call_action:: action will be handled by parent: 4
2015-10-15 08:18:01.413   openLuup.server:: request completed (124 bytes, 1 chunks, 2 ms) tcp{client}: 0x27ed178
2015-10-15 08:18:01.413   luup_log:4: http://192.168.2.189:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:Sonos1&action=Say&DeviceNum=131&DeviceNum=25&action=Say&Language=en&serviceId=urn:micasaverde-com:serviceId:Sonos1&Text=Testing open luup...&Engine=OSX_TTS_SERVER&SameVolumeForAll=false
2015-10-15 08:18:01.428   luup_log:4: failed requests status: 0
[/code]

Ran a couple of tests on Sonos.
I just installed this to give it a go.  Wow! It's very chatty in the log file (this may help.)

Tried this:
Code: [Select]
luup.call_action("urn:micasaverde-com:serviceId:Sonos1", "Say", {Text="Testing openLuup.", Volume=20}, 131)

...it pauses the current play and then resumes it after a short while without saying anything.  There's lots of stuff in the logs, but no errors (I am using the new openLuup release 5).

The only problem I see (apart from it not working!) is an error in the console window:
Code: [Select]
# rm: cannot remove `/www/Say.4.mp3': No such file or directory

So I'm guessing there was a problem creating the speech file in the first place.  Perhaps someone who knows Sonos can help us with this - it is a complex plugin, but I have to say that I'm pleased the basics seem to work.

I'm just about to post Release 5, so install that first and we'll take it from there.  Backup your user_data.json file before you start, just in case.
openLuup, AltUI, Zway and HomeWave, enough said...

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup - running unmodified plugins on any machine
« Reply #238 on: October 15, 2015, 10:08:43 am »
My first attempt (w/ v5) was testing via the Lua test code. This returned a result of  "./openLuup/luup.lua:317: attempt to index field 'services' (a function value)".
Interesting.  That line of code contains the comment: 
-- TODO: fix error on missing device access
This is, then, a badly-flagged error meaning: there is no such device.

Quote
In v4.5, testing directly within the plugin I never got a result, however today with 5 it worked once.
Curiouser and curiouser.

Quote
Second attempt failed ...

Code: [Select]
2015-10-15 08:18:01.410   openLuup.server:: /data_request?id=lu_action&output_format=xml&DeviceNum=25&serviceId=urn:micasaverde-com:serviceId:Sonos1&action=Say&Text=Testing%20open%20luup...&Language=en&Engine=OSX_TTS_SERVER&Volume=&GroupZones=&SameVolumeForAll=false tcp{client}: 0x27ed178
2015-10-15 08:18:01.411   luup.call_action:: 25.urn:micasaverde-com:serviceId:Sonos1.Say
2015-10-15 08:18:01.411   luup.call_action:: action will be handled by parent: 4
2015-10-15 08:18:01.413   openLuup.server:: request completed (124 bytes, 1 chunks, 2 ms) tcp{client}: 0x27ed178
2015-10-15 08:18:01.413   luup_log:4: http://192.168.2.189:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:Sonos1&action=Say&DeviceNum=131&DeviceNum=25&action=Say&Language=en&serviceId=urn:micasaverde-com:serviceId:Sonos1&Text=Testing open luup...&Engine=OSX_TTS_SERVER&SameVolumeForAll=false
2015-10-15 08:18:01.428   luup_log:4: failed requests status: 0

AHA!  Now it makes more sense. 
You didn't tell me:  this looks like you are actually issuing an HTTP request to openLuup to invoke Sonos installed on a remote Vera through the VeraBridge? 

We're trying to run before we can walk here - there's so many steps in this chain!  Let's see how we can break it down.  Can you confirm this IS what's you're doing and that
  • device 4 (on openLuup) is the VeraBridge
  • device 25 (on openLuup) is the bridged Sonos
  • device 131 on the remote Vera is the actual Sonos

The error is clear in this line of the log:
Code: [Select]
2015-10-15 08:18:01.413   luup_log:4: http://192.168.2.189:3480/data_request?id=action&serviceId=urn:micasaverde-com:serviceId:Sonos1&action=Say&DeviceNum=131&DeviceNum=25&action=Say&Language=en&serviceId=urn:micasaverde-com:serviceId:Sonos1&Text=Testing open luup...&Engine=OSX_TTS_SERVER&SameVolumeForAll=false

...notice this bit: DeviceNum=131&DeviceNum=25... duplicate device numbers!  This is an error (I think) introduced somehow by the VeraBridge, but I need to investigate more.

All I was doing in my previous testing was to install Sonos on openLuup.  It works fine except for TTS - I suspect I've not got that set up right:  I don't know, I've never tried to use it before.

« Last Edit: October 15, 2015, 12:03:52 pm 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 akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup - running unmodified plugins on any machine
« Reply #239 on: October 15, 2015, 10:15:04 am »
@CudaNet

Here's a possible fix for the VeraBridge error.  If you could confirm this works, then I will replace it in the release.

Thanks
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.