Windows LuaUPnP

From MiCasaVerde
Jump to: navigation, search


It is possible to run the MiOS engine, the main software in Vera, on a Windows PC. This is for advanced users only. You will still need the Vera, since that will have the web interface and other necessary CGI scripts that don't run under Windows. The main reason for this is if you're having problems running out of memory on Vera or otherwise suspect there might be hardware problems and want to isolate them. If you have access to a Z-Wave Zniffer (only Z-Wave developers will), it also allows you to run any type of Z-Wave dongle and the Zniffer on the same system together with portmon to capture all Z-Wave traffic. If you don't understand everything in this page, then this isn't for you.

1. Extract this file to your c:\ drive. [1]

2. On your existing Vera, in the UI4 dashboard, choose ZWave Device, Advanced, Backup Dongle. Wait for it to finish. This will write a file on Vera /etc/cmh/dongle.dump that contains an image of all the data in your Z-Wave dongle. We will clone this data into your Windows PC's dongle. Once you do this, your Windows dongle and Vera will have the same house id and node id. Therefore, it's essential that only one or the other be running at at time. Never have both running or it will screw up your Z-Wave network. Alternatively, you could build a new network in the Windows Z-Wave dong and eliminate this problem. If so, eliminate the touch ../data/conf/dongle.restore.go from step # 8 below.

3. Log-in to Vera's console. You will need to use putty and enter the ip of Vera and choose ssh. The username is 'root' and the password is the wi-fi password printed on the bottom of Vera.

4. From's Vera's "root@MiOS_x:~#" prompt in putty, paste this command: killall Start_LuaUPnP.sh LuaUPnP Start_NetworkMonitor.sh NetworkMonitor That will stop the MiOS engine on Vera.

5. Then paste this command, substituting __ip_of_pc__ for the IP of your Windows computer: sed -i 's/127.0.0.1/__ip_of_pc__/g' /etc/lighttpd.conf That will cause Vera's web interface to use the MiOS engine on your Windows PC, rather than the internal one.

6. Then paste this command to restart the web server in Vera: /etc/init.d/lighttpd restart

7. On the Windows PC, open windows explorer, right click my computer, choose properties. Select advanced tab, error reporting. select Disable error reporting and uncheck 'but notify me....'. Save those options. This is needed because the way the UPNP engine terminates itself for Linux causes Windows to report this as an error and popup an 'send this error to microsoft' dialog box. However it runs fine on Windows anyway.

8. Now choose start, run, and enter CMD to open a windows command prompt. Copy/paste the following commands into the command prompt, substituting __ip_of_vera__. The pscp will copy all the config data from Vera to the windows PC, including the dongle.dump from step #2. The touch ../data/conf/dongle.restore.go creates the dongle.restore.go file. When LuaUPnP starts it checks for that file and if it exists, then it restores the dongle.dump into the current dongle. mioslzo decompresses the user_data.jzon.lzo file. On Linux we store it compressed, on Windows we do not. run.bat starts LuaUPnP. Press Ctrl+c to stop it.

c:
cd \luaupnp\commands
pscp -scp -unsafe root@__ip_of_vera__:/etc/cmh/* ..\data\conf\
touch ../data/conf/dongle.restore.go
cd \luaupnp\bin
mioslzo d  ../data/conf/user_data.json.lzo ../data/conf/user_data.json
run.bat

9. Wait a couple minutes for LuaUPnP to finish downloading your plugins. These will go in ..\data\plugins_download. Then open the UI4 web page on Vera like normal. (not on your Windows PC). You will see that Z-Wave didn't start. Choose Z-Wave from the toolbox, Options tab, and in the "Port" input box, change it to the port of the Z-Wave dongle on your Windows PC, like "COM2". Then click save. Windows drivers for the black dongle that comes with Vera 1 are available here: ZWave_Dongle

At this point everything should work ok. If you're not sure if the Windows engine is running, try opening this in your web browser: http://__ip_of_pc__:3480/data_request?id=user_data and you should see your data configuration.

If you want to go back to using Vera like normal, be sure the Windows version isn't running if the dongle was cloned. Then repeat step 6, but reversing the IP's: sed -i 's/__ip_of_pc__/127.0.0.1/g' /etc/lighttpd.conf. Then reboot Vera and everything will start up like normal.

We put the usual linux utilities for viewing log files in the commands subfolder: grep, tail, less, etc. These actually come from cygwin; a Windows version of Linux utilities. So, to filter for lines that start with 03 (start/stop codes), you can open a command prompt, cd \luaupnp\data\logs, and ..\..\commands\grep "^03" mios_10-12-03_18h.log

The 'portmon' utility is also included in \luaupnp\portmon. This captures all raw data on the serial port. You can have it log to a file. If you do, it will fill up the log file with tons of IOCTL_SERIAL_GET_COMMSTATUS entries. You can get rid of them from a command prompt using the Linux grep tool: c:\luaupnp\commands\grep -v IOCTL_SERIAL_GET_COMMSTATUS __input_file__ > __output_file__

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox