We have moved at community.getvera.com

Author Topic: Windows Install Guide?  (Read 4758 times)

Offline scyto

  • Jr. Member
  • **
  • Posts: 88
  • Karma: +1/-0
Windows Install Guide?
« on: March 01, 2016, 01:58:26 pm »
Hi, i was wondering if there was a simple windows install guide.  I followed the links from github and got lost in mingw and compilers and luadist and searched this site can couldn't find anything.

I am using the ISY plugin from mios code site and it used to work fine on UI7 but no longer seems to.  I was hoping to use OpenLuup to validate if the plug-in works there and isolate if this is a UI7 issue.

Does this even make sense?
(sorry for the noob questions)

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: Windows Install Guide?
« Reply #1 on: March 01, 2016, 04:15:05 pm »
Yes, it all makes sense.  I struggled with getting Lua for Windows, but in the end the easiest route, which suited me well, was to install ZeroBrane Studio, which I use all the time on a Mac for code development.

This is an easy install and, AFAIK, gives you all you need to run openLuup, at least to test out your ISY question.  See ZeroBrane
Studio Download


Perhaps others who use Windows can give better advice, I'm certainly not any sort of expert (nor, indeed, for Linux.)

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: Windows Install Guide?
« Reply #2 on: March 01, 2016, 04:33:19 pm »
I do agree with AK on this, Windows is not very friendly and I bailed on a true Windows implementation. I have another option for Window systems but I'll wait to see after you've run Zerobrane.
openLuup, AltUI, Zway and HomeWave, enough said...

Offline scyto

  • Jr. Member
  • **
  • Posts: 88
  • Karma: +1/-0
Re: Windows Install Guide?
« Reply #3 on: March 06, 2016, 09:33:39 pm »
Thanks, i am falling at first hurdle :-(

Ok, i figured out how to logon root to start figuring out how to fetch files.  Perhaps something in the openluup instructions would be good for that! Any ideas how i enable SFTP on the vera?

--edit--
ah one can't - need to use SCP - right WinSCP installed

--edit--
ah it says i can run lua opernLuup_getfiles.lua - i pathed the directory where lau binart is and added the lua extenstions.

I then run into a never ending seeming of missing files messages like such, i have been manually copying files over to meet the requirements. core.lua doesn't exist.  core.dll does.  I put it in that dir and the error still manifests.  I am giving up for now - have other things i need to do :-)

C:\Users\lx_b\Downloads\ZeroBraneStudio\myprograms\openLuup\Utilities>lua openLuup_getfiles.lua
lua: C:\Users\lx_b\Downloads\ZeroBraneStudio\bin\lua\socket.lua:12: module 'socket.core' not found:
        no field package.preload['socket.core']
        no file '.\socket\core.lua'
        no file 'C:\Users\lx_b\Downloads\ZeroBraneStudio\bin\lua\socket\core.lua'
        no file 'C:\Users\lx_b\Downloads\ZeroBraneStudio\bin\lua\socket\core\init.lua'
        no file '.\socket\core.dll'
        no file 'C:\Users\lx_b\Downloads\ZeroBraneStudio\bin\socket\core.dll'
        no file 'C:\Users\lx_b\Downloads\ZeroBraneStudio\bin\loadall.dll'
        no file '.\socket.dll'
        no file 'C:\Users\lx_b\Downloads\ZeroBraneStudio\bin\socket.dll'
        no file 'C:\Users\lx_b\Downloads\ZeroBraneStudio\bin\loadall.dll'
stack traceback:
        [C]: in function 'require'
        C:\Users\lx_b\Downloads\ZeroBraneStudio\bin\lua\socket.lua:12: in main chunk
        [C]: in function 'require'
        ...lx_b\Downloads\ZeroBraneStudio\bin\lua\openLuup\logs.lua:7: in main chunk
        [C]: in function 'require'
        ...lx_b\Downloads\ZeroBraneStudio\bin\lua\openLuup\luup.lua:9: in main chunk
        [C]: in function 'require'
        openLuup_getfiles.lua:8: in main chunk
        [C]: at 0x00402a57
« Last Edit: March 06, 2016, 10:34:39 pm by scyto »

Offline scyto

  • Jr. Member
  • **
  • Posts: 88
  • Karma: +1/-0
Re: Windows Install Guide?
« Reply #4 on: March 06, 2016, 11:51:14 pm »
i gave up with zerobrane and installed luaforwindows https://github.com/rjpcomputing/luaforwindows.  If i run openLuup_check.lua i get:

module 'mime'
module 'socket'
module 'socket.http'
-----------------------
module 'ssl.https' not found:
-----------------------
module 'ltn12'
not found: openLuup
lua: openLuup_check.lua:41: openLuup/ directory is missing
stack traceback:
        [C]: in function 'assert'
        openLuup_check.lua:41: in main chunk
        [C]: ?

I think it may be the openLuup directory error that cause more errors when i try and run openLuup_getfiles

Offline scyto

  • Jr. Member
  • **
  • Posts: 88
  • Karma: +1/-0
Re: Windows Install Guide?
« Reply #5 on: March 07, 2016, 12:01:03 am »
okay here is what i have done:

1) install luaforwindows
2) create a directory called cmh-ldl in the root of c (for now)
3) copied the openLuup_getfiles.lua file to this directory
4) copied openLuup folder from the master branch into this directory
5) from inside c:\cmh-ldl directory ran lua openLuup_getfiles.lua - this copied all the files from my vera into c:\cmh-ldl\files c:\cmh-ldl\icons (it created the dirs for me)
6) copied startup_example.lua to c:\cmh-ldl and ran it  and i get the following error:

C:\cmh-ldl>lua startup_example.lua
lua: startup_example.lua:4: attempt to index global 'luup' (a nil value)
stack traceback:
        startup_example.lua:4: in main chunk
        [C]: ?

(i also got this error when trying to run this inside zerobrane)

7) i ignore all the errors above
8) i ran lua openLuup/init.lua reset - everything worked
9) I ran lua openLuup/init.lua - the app did not teminate
10) http://<YourIP>:3480/data_request?id=alive worked
11) http://<YourIP>:3480/data_request?id=user_data worked
12) http://<YourIP>:3480/icons/VeraBridge.png did not work - but i see that that icon isn't in the folder
13) http://127.0.0.1:3480/icons/binary_light_default.png - did not work, on inspection none of the PNG seems to open in even a local file viewer - i think get files corrupted them in someway
14) http://<YourIP>:3480/data_request?id=exit - worked
15) I ran lua openLuup/init.lua - the app did not teminate
16) Ran http://<YourIP>:3480/data_request?id=altui - the process started installing ALTUI and then exited
17) I  ran lua openLuup/init.lua - the app did not teminate
18) I ran http://<YourIP>:3480/data_request?id=lr_ALTUI_Handler&command=home# - the web browser just shows "No Handler"

discovered i was missing dkjson.lua - downloaded from https://github.com/LuaDist/dkjson
discovered i was missing https.lua - got from zerobrane
discovered I was missing ssl.lua -  found it here https://github.com/brunoos/luasec

now i get this:

016-03-06 22:38:43.984   openLuup.chdev:: .\ssl.lua:7: module 'ssl.core' not found:
   no field package.preload['ssl.core']
   no file '.\ssl\core.lua'
   no file 'C:\Program Files (x86)\Lua\5.1\lua\ssl\core.lua'
   no file 'C:\Program Files (x86)\Lua\5.1\lua\ssl\core\init.lua'
   no file 'C:\Program Files (x86)\Lua\5.1\ssl\core.lua'
   no file 'C:\Program Files (x86)\Lua\5.1\ssl\core\init.lua'
   no file 'C:\Program Files (x86)\Lua\5.1\lua\ssl\core.luac'
   no file '../cmh-lu/ssl\core.lua'
   no file '.\ssl\core.dll'
   no file '.\ssl\core51.dll'

thats it for the night, not sure where this comes from, it may be that i have to compile something as I see there are many core.dll files - I think it is a C component compiled from code, not sure
« Last Edit: March 07, 2016, 03:03:34 am by scyto »

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: Windows Install Guide?
« Reply #6 on: March 07, 2016, 06:06:33 am »
okay here is what i have done:

First of all, congratulations and karma for both your persistence and your level of documentation.  Your troubles arise from a mixture of things that we both have done wrong, so let's try to fix this...

Quote
2) create a directory called cmh-ldl in the root of c (for now)

Do you, in fact, mean /etc/cmh-ludl/?  It doesn't matter at this stage since openLuup can run in any directory, but it may get confusing for some plugins later.

Quote
6) copied startup_example.lua to c:\cmh-ldl and ran it  and i get the following error:

This one's your error!  Nowhere in the User Guide does it say to do that and, in fact, startup.lua is not a stand-alone Lua program, but something loaded by the init routine. 
This explains why you got the same error in ZeroBrane. 

Quote
7) i ignore all the errors above

So you were quite right to ignore it and continue, in the circumstances.

Quote
12) http://<YourIP>:3480/icons/VeraBridge.png did not work - but i see that that icon isn't in the folder
13) http://127.0.0.1:3480/icons/binary_light_default.png - did not work, on inspection none of the PNG seems to open in even a local file viewer - i think get files corrupted them in someway

The VeraBridge.png file is, in fact, in the VeraBridge directory, but does need to be moved to the icons/ directory, as described on page 6 of the User Guide.

However, the corruption of the icon files is entirely my fault and it's because you are running on windows.  I had fixed (thanks to @vosmont) an I/O  error with binary files on Windows within openLuup, but failed to apply the same remedy to the get_files utility.  I'll patch the GitHub master and perhaps you can try again (should just be that file to replace.)

Quote
discovered i was missing dkjson.lua - downloaded from https://github.com/LuaDist/dkjson
discovered i was missing https.lua - got from zerobrane
discovered I was missing ssl.lua -  found it here https://github.com/brunoos/luasec

now i get this:
016-03-06 22:38:43.984   openLuup.chdev:: .\ssl.lua:7: module 'ssl.core' not found:

You are quite likely to run into trouble just copying modules from elsewhere.  The low-level modules have .dll files as well as .lua ones, and that seems to be what's missing.  ZeroBrane has a simple way to compile and install them, but for LuaForWindows I don't know what the procedure is.   

Actually, only a few plugins require SSL, and I'm really surprise to see this error raised on line 7 of openLuup.chdev, since it doesn't require SSL either.

However, you've made great progress.  I'll retry all of the above on my Windows machine and see what I can find out.

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 scyto

  • Jr. Member
  • **
  • Posts: 88
  • Karma: +1/-0
Re: Windows Install Guide?
« Reply #7 on: March 07, 2016, 11:23:44 pm »
Thanks!

I didn't copy the Vera bridge stuff because I wasn't planning to use the bridge - as such I considered the instruction optional (in general it was hard for me to grok what was required vs optional).

I didn't know where to put the startup_example it didn't seem clear to me, but I also realised it didn't matter for where I had got to so didn't troubleshoot / figure it out.

I am pretty certain the SSL.core is actually an sll.dll, I tried to compile in VS but it failed, I fixed the include errors but could not fix the critical errors / syntax errors as I am not a programmer. I was going to look at luarocks as it has a definition for the dll. I know the dll is dependent on installing OpenSSL on Windows.

I will try the get files again.

I will let you know how I get on.  I didn't see the option in zerobrane for finding / compiling missing things? It just had awful issue locating lies (it didn't set any path variables on install, I think that might be issue?).
« Last Edit: March 07, 2016, 11:27:39 pm by scyto »

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: Windows Install Guide?
« Reply #8 on: March 08, 2016, 02:50:19 am »
Have you seen this old post?

For the moment, I use openLuup on Windows.

Install http://luadist.org/ (contains Lua 5.1 and all the needed librairies)

Copy this file "openLuup_reload.bat" in "openLuup\etc\cmh-ludl", and change "LUA_DEV" according to LuaDist folder.
Code: [Select]
@ECHO OFF
SETLOCAL
SET LUA_DEV=D:\devhome\app\LuaDist\bin
SET CURRENT_PATH=%~dp0
ECHO Start openLuup from "%CURRENT_PATH%"
ECHO.
CD %CURRENT_PATH%
"%LUA_DEV%\lua" openLuup\init.lua %1

:loop
IF NOT %ERRORLEVEL% == 42 GOTO exit
"%LUA_DEV%\lua" openLuup\init.lua
GOTO loop

:exit

ENDLOCAL
PAUSE

...perhaps luadist is worth a try?

Otherwise I can supply a dummy SSL module which will at least get you up and running.
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: Windows Install Guide?
« Reply #9 on: March 08, 2016, 09:19:02 am »
Does this help (post 196) ?  It's an old post but I believe mda had similar issues...
http://forum.micasaverde.com/index.php/topic,32315.msg251064.html#msg251064
openLuup, AltUI, Zway and HomeWave, enough said...

Offline scyto

  • Jr. Member
  • **
  • Posts: 88
  • Karma: +1/-0
Re: Windows Install Guide?
« Reply #10 on: March 08, 2016, 08:05:36 pm »
Try #2  - using lua for windows and luarocks

1) install LuaForWindows - during install do not select LuaRocks
2) install LuaRocks with default options- check paths as per end of install (but these should have be added by LuaForWindows abive
3) run admin command prompt
4) luarocks install dkjson - this install missing dkjson files
5) created c:\etc\cmh-ldl
6) copied over openLuup directory from openLuup-master file to c:\etc\cmh-ldl dir
7) copy openLuup_getfiles.lua to c:\etc\cmh-ldl
8) ran lua openLuup_getfile.lua  - was prompted for IP addreess, it copied over PNG OK but i note in the copy output this, not sure if it matters?

error   I_BrultechPowerMeter1.xmlenc
error   I_BrultechPowerMeterRaw1.xmlenc
error   I_DSCAlarmPanel1.xmlenc
error   I_EchoEnergyManager.xmlenc
error   J_EchoEnergyManager.jsenc
error   J_EchoEnergyManager2.jsenc
error   L_BrultechMeter1.luaenc
error   L_EchoEnergyManager.luaenc

9) copied vera bridge icon file into icons directgory and rest of vera bridge files into openLuup folder
10) i ran lua ./openLuup/init.lua reset - everything worked
11) http://<YourIP>:3480/data_request?id=alive worked
11) http://<YourIP>:3480/data_request?id=user_data worked
12) http://<YourIP>:3480/icons/VeraBridge.png worked
13) http://<YourIP>:3480/data_request?id=altui worked and put the altui files in the c:\etc\cmh-ldl dir not the c:\etc\cmh-ldl\openLuup dir - is that correct?
14) i note that even though i installed dkjson with luarocks it still couldn't be accessed by openLuup so i copied the dkjson.lua file over
15) i tried to install luasec with luarocks but it says that it needs luasocket, it attempts to download source and fails to compile with same error in the thread cudanet posted above, using that zip i copied the https.lua, ssl.lua and ssl.dll to one of the dirs indicated in the log file each time i ran it
16) now i am being blocked by ssl.x509 not found - sigh looks like LUA on windows is just a no go, gonna look at zerobrane again and see if i can figure out how to make it find and compile missing modules

--edit--
i re-read the post cudanet linked to, i realized two things - the build of luarocks was looking for an app called cl.exe (found it and added to the path) and i put all the files from ssl.zip into my lua/include directory (there wasn't much it in it).  now when i try and luarocks install luasocket it fails as follows:

Code: [Select]
Using https://luarocks.org/luasocket-3.0rc1-2.src.rock... switching to 'build' mode
cl /nologo /MD /O2 -c -Fosrc/mime.obj -IC:/Program Files (x86)/Lua/5.1/include/ src/mime.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DNDEBUG -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mime.c
src/mime.c(5): fatal error C1083: Cannot open include file: 'string.h': No such file or directory

Error: Failed installing dependency: https://luarocks.org/luasocket-3.0rc1-2.src.rock - Build error: Failed compiling object src/mime.obj

ooh there is a thing called the VS2015 command prompt... when i run the install i get this instead:

Code: [Select]
Installing https://luarocks.org/luasocket-3.0rc1-2.src.rock...
Using https://luarocks.org/luasocket-3.0rc1-2.src.rock... switching to 'build' mode
cl /nologo /MD /O2 -c -Fosrc/mime.obj -IC:/Program Files (x86)/Lua/5.1/include/ src/mime.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DNDEBUG -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport)
mime.c
link -dll -def:core.def -out:mime/core.dll C:/Program Files (x86)/Lua/5.1/lua5.1.dll src/mime.obj
Microsoft (R) Incremental Linker Version 14.00.23506.0
Copyright (C) Microsoft Corporation.  All rights reserved.

C:\Program Files (x86)\Lua\5.1\lua5.1.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2B8

Error: Build error: Failed compiling module mime/core.dll
i guess string.h was a common library - oh i am so close to getting this to work, but oh so close to giving up and moving to my pi
« Last Edit: March 08, 2016, 09:50:37 pm by scyto »

Offline scyto

  • Jr. Member
  • **
  • Posts: 88
  • Karma: +1/-0
Re: Windows Install Guide?
« Reply #11 on: March 08, 2016, 10:11:34 pm »
As a sanity check i followed the instructions in the PDF on my wheezy raspbian pi.

1) AltUI shows 'No handler' in the browser just like on windows - but give 3) below i assume this is just because of incomplete modules?

2) when i do checkfiles I get the following (so i am off to install luarocks on pi - hopefully it works better than windows!)

Code: [Select]
root@raspberrypi:/etc/cmh-ludl# lua ./openLuup_check.lua
module 'mime'
module 'socket'
module 'socket.http'
module 'ssl.https'
module 'ltn12'
-----------------------
module 'dkjson' not found:
-----------------------
not found: /www
... port 80 HTTP server may not work properly
not found: /www/cmh/skins/default/icons
... UI5 icon directory missing
not found: /www/cmh/skins/default/img/devices/device_states
... UI7 icon directory missing
root@raspberrypi:/etc/cmh-ludl#

3) i logged in as root rather than pi, then did sudo apt-get install luarocks, once it was installed i did luarocks install dkjson, when i restarted the init file altui came up with no device.  Yay!

My advice, stop saying anywhere this works on windows (and this isn't your fault) as Lua on windows seems to be nightmare of a mess :-(  i would advise no one to use it.

 (btw those non-dkjson errors in 2 above don't seem to have any adverse affect?)
« Last Edit: March 08, 2016, 10:43:45 pm by scyto »

Offline paulclinger

  • Jr. Member
  • **
  • Posts: 84
  • Karma: +5/-0
Re: Windows Install Guide?
« Reply #12 on: March 09, 2016, 12:22:44 am »
C:\Users\lx_b\Downloads\ZeroBraneStudio\myprograms\openLuup\Utilities>lua openLuup_getfiles.lua
lua: C:\Users\lx_b\Downloads\ZeroBraneStudio\bin\lua\socket.lua:12: module 'socket.core' not found:

@scyto, this doesn't seem to be ZeroBraneStudio fault as you don't even use it; you simply run your Lua script from ZBS folder. If you run the script *from* ZeroBrane Studio, it will find luasocket without any manual changes required.

ZeroBrane Studio doesn't add associations as it minimizes any changes to your computer during the install; there is a plugin that does the registration for you: https://github.com/pkulchenko/ZeroBranePackage/blob/master/extregister.lua

> I then run into a never ending seeming of missing files messages like such, i have been manually copying files over to meet the requirements. core.lua doesn't exist.  core.dll does.  I put it in that dir and the error still manifests.

You shouldn't put core.dll in the current folder; it's expected to be available as socket/core.dll, so when you "require" it as "socket.core" (this is what socket.lua does), it's properly found and loaded by Lua.

luasec is not bundled with ZeroBrane Studio, but I have luasec compiled for Lua 5.1, 5.2, and 5.3 available in the download section for ZeroBraneStudio: https://download.zerobrane.com/luasec-0.6alpha-openssl-1.0.2f.zip. You'll need ssl.dll for the corresponding Lua version (in your case 5.1) as well as ssleay32.dll/libeay32.dll. It's likely that luasec will be included with ZeroBrane Studio in the future. Paul.
« Last Edit: March 09, 2016, 02:39:36 am by paulclinger »

Offline scyto

  • Jr. Member
  • **
  • Posts: 88
  • Karma: +1/-0
Re: Windows Install Guide?
« Reply #13 on: March 09, 2016, 02:01:52 am »
Thanks Paul,

In the second try with ZeroBrane i didn't manually move anything. And in both runs at it using ZeroBrane was always from UI - never from the command line.

The command line was when i tried luaforwindows / luarocks combination; which i have to say was quite nice way to run things - just a shame their instructions also didn't talk about how to setup the path to git or the path to the CL compiler or the paths for the standard includes.  I guess running it from the VS command prompt is key.... this stuff might be fun for developers when poorly documented but is mucho frustrating from us folks mostly interested in getting a runtime up. (luapower looks like it might be interesting in the future if they get more modules)

I had already used luarocks/luaforwindows to construct most of what i needed, but the missing SSL.DLL stopped me cold - thanks for the link might give it another go, but bottom line the Pi install was way easier and way faster and has moved me on to the point of this - a quick way to start to understanding and troubleshooting the ISY mios plugin.

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +291/-70
  • "Less is more"
Re: Windows Install Guide?
« Reply #14 on: March 09, 2016, 02:46:15 am »
@paulclinger

Thanks so much for stepping in and clarifying the ZBS approach.

@scyto

Sorry Windows hasn't worked out for you... others do use it successfully.

Note that a copy of dkjson.lua needs to be in the /etc/cmh- ludl/ directory or on the Lua path for plugins to find it.

The two errors regarding the icon directories are my fault... I did not update the check routine since changing the way icons are handled.  I will fix that.

Better luck with RPi.
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.