-
-
Save integrii/021f272f2cad0540fc3c to your computer and use it in GitHub Desktop.
# I had a LOT of trouble finding working examples of the ZAutomation API for RaZberry API. I eventually figured out what exactly to use by combining information from multiple sources and sniffing requests from the 'Expert UI'. Some areas I found information: | |
- http://docs.zwayhomeautomation.apiary.io/ | |
- http://wiki.micasaverde.com/index.php/ZWave_Command_Classes | |
- https://www.npmjs.org/package/mqtt-zway | |
- The included PDFs | |
- The expert API area on the device web UI | |
- https://chrome.google.com/webstore/detail/postman-interceptor/aicmkgpgakddgnaphhhpliifpcfhicfo?hl=en (Postman POST/GET sniffer) | |
# Some general RaZberry API commands: | |
Find information about controller | |
- http://192.168.2.2:8083/ZWaveAPI/Run/controller | |
Add a device to network (start include process) | |
- http://192.168.2.2:8083/ZWaveAPI/Run/controller.SetLearnMode(1) | |
Stop looking for a device to add to the network | |
- http://192.168.2.2:8083/ZWaveAPI/Run/controller.SetLearnMode(0) | |
Find all devices with all their information | |
- http://192.168.2.2:8083/ZWaveAPI/Run/devices | |
Find the command classes available on device 2 | |
- http://192.168.2.2:8083/ZWaveAPI/Run/devices[2] | |
Send on command to device id 3 in group 0 with command class 38: | |
- http://192.168.2.2:8083/ZAutomation/api/v1/devices/ZWayVDev_3:0:38/command/on | |
Send exact level (0-100) to device 3 on channel 0 and command class 38: | |
- http://192.168.2.2:8083/ZAutomation/api/v1/devices/ZWayVDev_3:0:38/command/exact?level=20 | |
Send off command to device id 3 in group 0 with command class 38: | |
- http://192.168.2.2:8083/ZAutomation/api/v1/devices/ZWayVDev_3:0:38/command/off | |
Change blue color on Zipato RGBW light bulb when it is device 3: | |
http://raspberrypi:8083/ZWaveAPI/Run/devices[3].instances[0].commandClasses[0x33].Set(4,255) | |
NOTES: | |
- Your added devices will start out at device id 2 and number upwards. | |
- The command class must be the numerical vaue of the type your device supports on the wiki | |
- The different command options are available on http://docs.zwayhomeautomation.apiary.io/ in the devices section |
Excellent. Do you have any idea how to create virtual devices/sensors using the json api?
I wanted to add some info from my recent experience. These above examples are actually using two different APIs.
http://raspberrypi:8083/ZWaveAPI/Run/devices
This is using the ZWave API / JSON API
http://raspberrypi:8083/ZAutomation/api/v1/devices
This is using the Virtual Device API / HTTP REST API
So to set my Thermostat cooling temp to 74, I can either use:
http://raspberrypi:8083/ZWaveAPI/Run/devices[16].ThermostatSetPoint.Set(2,74)
or
http://raspberrypi:8083/ZAutomation/api/v1/devices/ZWayVDev_zway_16-0-67-2/command/exact?level=74
depending on which API I am going through
Hi
We are trying to update some tempature sensor information through url http://10.200.8.211:8083/ZAutomation/api/v1/devices/ZWayVDev_zway_15-0-49-1/command/update
Problem is, we always end up with a 401 Unauthorized error. Anyone can tell me how do you authentificate through a bash curl call ? Either directly for the update request with some kind of -d auth.json, or with two curl, first one storing auth info in a cookie jar?
Thanks & regards
Same Problem for me when trying to acces ZAutomation API. If i log in and test with the browser, everything works fine. But when i try to access via Raspberry Pi jquery i receive 404 with the same URL :/
I tried this code with basic Auth, but it does not work:
$.ajax({ type: "GET", url: url, dataType: 'jsonp', username: username, password: password, success: function (data){ console.log(data); alert('Query successful'); } });
Also I tried all basic auth mechanisms described here:
http://stackoverflow.com/questions/5507234/how-to-use-basic-auth-with-jquery-and-ajax
Would be very kind If somebody could help me.
EDIT:
Deleted all users in ZWAY but my admin user. As soon as I log out in the webinterface, my script (on the Raspberry) responds 401. When I am logged in I recieve "Uncaught SyntaxError: Unexpected token :"
EDIT2:
Workaroud: Create an "anonymous" user in the webinterface. Then put all devices you want to access via API into a room. Grant the anonymous user access to this room. Very Ugly and insecure, but at least works with jquery.
Hi, Is there any API from which i can get the current status of the devcie
Hi
I can get the events of locks from the doorlocklogging command class.
But the time is incorrect. Also the results are not in good order and I cannot understand how to work with them.
Could you please help me?
Find the command classes available on device 2
- http://192.168.2.2:8083/ZWaveAPI/Run/devices[2]
I had trouble getting this to work with curl
and figured out that I had to encode the square brackets.
So the url became http://192.168.2.2:8083/ZWaveAPI/Run/devices%5B2%5D instead to work correctly.
Nice! Thanks :)