openLuup: ZWay plugin for ZWave.me hardware

I’m trying to use the method below in a lua script. It works fine in a browser, but I always get a timeout with a script such as this in the AltUI test code window. Any ideas? Thanks.

local http = require ("socket.http") http.TIMEOUT = 5 local result, status, content = http.request("http://192.168.1.205:3480/ZWaveAPI/Run/devices[17].Alarm.data.V1event") print("Status:" .. status) if status == 200 then local json = require("dkjson") local obj, pos, err = json.decode(result) if err then print("json decode error: " .. err) else print("obj is " .. obj.updateTime) end end

[quote=“akbooer, post:13, topic:193746”]OK, plan B (even better, might actually work, it does for me, but, there again, so did plan A) …

[ol][li]update openLuup from the development branch[/li]
[li]add the attached file as /etc/cmh-ludl/cgi/zway_cgi.lua (NB. with the .lua extension)[/li]
[li]delete /etc/cmh-ludl/cgi/port_8083[/li][/ol]

Now, any Zway-related requests made to port 3480 are simply relayed to the ZWay interface on port 8083, no special syntax required.

http://openLuupIP:3480/ZWaveAPI/Run/devices

Better luck this time.[/quote]

Never use socket.request() in openLuup to access the same IP and port as openLuup itself. It will always deadlock.

It is for this reason that luup.inet.wget() exists, but note that the return parameters are in a different order. Try that instead.

Thank you. That works. This is ridiculously complex, but it works: Door lock Z-wave → Z-way server → Niffler → Z-way server → Z-wave query → Z-way server → openLuup scene → Z-way server query → openLuup scene → openHAB → DSC Alarm panel. :slight_smile:

Hi AK,

With the latest AltUI version (v2129) I noticed that my Z-way communication seems to be having an issue. So I checked the logs (openLuup v17.3.9) after a reload and …

2017-09-20 20:53:20.260   luup.chdev.sync:: [118]  63: Garage  Combo, syncing children
2017-09-20 20:53:20.260   luup.chdev.sync:: [143]  71: Master Dimmable, syncing children
2017-09-20 20:53:20.260   luup.chdev.sync:: [147]  72: Media Dimmable, syncing children
2017-09-20 20:53:20.260   luup.chdev.sync:: [151]  76: Repeater (Den), syncing children
2017-09-20 20:53:20.260   luup.chdev.sync:: [148]  75: Doorbell, syncing children
2017-09-20 20:53:20.260   luup.chdev.sync:: [152]  77: Repeater (Master), syncing children
2017-09-20 20:53:20.260   luup.chdev.sync:: [137]  67: Hallway Plug, syncing children
2017-09-20 20:53:20.261   luup.chdev.sync:: [141]  69: West Landscape, syncing children
2017-09-20 20:53:20.261   luup.chdev.sync:: [145]  74: North Landscape, syncing children
2017-09-20 20:53:20.261   luup.chdev.sync:: [157]  46: Garage Binary, syncing children
2017-09-20 20:53:20.261   luup.chdev.sync:: [146]  73: Laundry Dimmable, syncing children
2017-09-20 20:53:20.261   openLuup.context_switch::  ERROR: ./L_ZWay.lua:1034: attempt to index local 'this' (a nil value)
2017-09-20 20:53:20.261   openLuup.scheduler:: job aborted : ./L_ZWay.lua:1034: attempt to index local 'this' (a nil value)

Lots/perhaps all of my Z-way devices are not reporting but scenes are operating as my outside lights are coming on and off per schedule. Just don’t see updates (all my sensors indicate the last update was yesterday when I performed the AltUI upgrade). Let me know if you need more detail.

Thanks
–CN

(Thanks for your reminder on another thread.)

This appears to be related to a non-existent node. Can you check the attributes of the ZWay child nodes (or maybe just one) and see that the do, indeed, refer to the ZWay device?

I’m a bit stumped as to how an AltUI version change can do this, but…

(I’m running the latest AltUI in my development system, but not currently with ZWay.)

Here are the details from a Leviton switch… ZWay Parent id is indeed ‘5’.

[quote=“akbooer, post:45, topic:193746”](Thanks for your reminder on another thread.)

This appears to be related to a non-existent node. Can you check the attributes of the ZWay child nodes (or maybe just one) and see that the do, indeed, refer to the ZWay device?

I’m a bit stumped as to how an AltUI version change can do this, but…

(I’m running the latest AltUI in my development system, but not currently with ZWay.)[/quote]

What version of my ZWay plugin are you running?

168 vDevs, 50 nodes
127.0.0.1

v16.10.17

@AK

I rolled back the AltUI version this morning, I’ll report back if everything is working well…

Thanks,
CN

Update: Nope, the error is still there… I noticed this, maybe nothing… I’m at a loss, I might have to restore a working user_data…

Restored from previous user_data, error is still present on reload. Cannot imagine what happened, I’m out of ideas… Maybe it’s time for a drink !

[quote=“CudaNet, post:49, topic:193746”]@AK

I rolled back the AltUI version this morning, I’ll report back if everything is working well…

Thanks,
CN

Update: Nope, the error is still there… I noticed this, maybe nothing… I’m at a loss, I might have to restore a working user_data…[/quote]

Fresh install and the issues still persist. Perhaps the ZWay API has changed somehow… Issue shows on 2.3.5 and this morning I tried 2.3.6 beta and the issue still persists.

2017-09-20 20:53:20.261   openLuup.context_switch::  ERROR: ./L_ZWay.lua:1034: attempt to index local 'this' (a nil value)
2017-09-20 20:53:20.261   openLuup.scheduler:: job aborted : ./L_ZWay.lua:1034: attempt to index local 'this' (a nil value)

I’ll take a look.

This seems to be a problem with not finding the right device IDs for the child devices. Can you delete the parent device and reload. Create another instance of the device, and try again. Which version of the ZWay plugin are you running?

[hr]

Edit: You DO have the right IP address, username, and password set?

Hi AK,

All credentials are good. This was a totally clean install (openLuup_install) of openLuup/AltUI where only the ZWay plugin/devices were being loaded. It appears to have retrieved them all despite the error on startup but there is no status updates for any of the z-wave devices. I attempted to eliminate all possible causes but I’m just not sure what’s going on here or why. I’m attaching the startup log as well as the log data leading up to the error and after the error.

If all else I can always provide full access to the system.

Thanks…
CN

[quote=“akbooer, post:53, topic:193746”]This seems to be a problem with not finding the right device IDs for the child devices. Can you delete the parent device and reload. Create another instance of the device, and try again. Which version of the ZWay plugin are you running?

[hr]

Edit: You DO have the right IP address, username, and password set?[/quote]

The log is (of course) a good start. I will chew on this a bit…

Much appreciated… As always just let me know what I can do to help… Update: Added data from http://IP:8083/ZWave.zway/Data/0%20result

That was the next thing I was going to ask for!

Yes, this seems to be the case. I will now go looking for the latest docs/change notices. Sigh…

No, I may be wrong… it’s been a while since I looked at this.

What, in fact, I need is the output this:

http://openLuupIP:3480/data_request?id=lr_zNNN

…replacing openLuupIP with your system’s IP and NNN with the device number of the ZWay plugin.

Morning AK, so hoping this is what you were expecting…

http://10.0.4.45:3480/data_request?id=lr_z5
[]

Update: Added AltUI’s debug All Devices just incase…

No, I may be wrong… it’s been a while since I looked at this.

What, in fact, I need is the output this:

http://openLuupIP:3480/data_request?id=lr_zNNN

…replacing openLuupIP with your system’s IP and NNN with the device number of the ZWay plugin.[/quote]