According to the Z-Way documentation the URL below should turn on a binary switch (device 20, instance 1 do obviously exist), but it doesn't... It just returns a fairly large JSON output with pretty much all the controller data...
http://ip:8083/ZWaveAPI/Data/Run/device ... ].Set(255)
When I use the python code in the link below, it appears to return "Ok", but still doesn't turn the LED on or off...
https://github.com/AmI-2015/python-zway
Any suggestions?
ZWaveAPI
Re: ZWaveAPI
Your URL is wrong. Remove Data/ from it. Aither ZWaveAPI/Data/... or ZWaveAPI/Run/
Re: ZWaveAPI
That did the trick...
BTW, isn't this a huge security flaw? I can read an control everything via that API without authenticating...
BTW, isn't this a huge security flaw? I can read an control everything via that API without authenticating...
Re: ZWaveAPI
Have you checked "Allow public access to ZWaveAPI" ?
Re: ZWaveAPI
Ah ok
Well I'm done with Z-Wave for now... I just did this for a class in university... I don't really see any use for it in my own projects
Well I'm done with Z-Wave for now... I just did this for a class in university... I don't really see any use for it in my own projects
Re: ZWaveAPI
Where do I find this setting? I have looked everywhere ...PoltoS wrote:Have you checked "Allow public access to ZWaveAPI" ?
Perhaps it's in a newer version, I have v2.2.5 ...
Edit: sorry, found it. Had to go to "My Settings - Show system apps" , then access the now visible "Z-Wave Network Access" app.
cheers
Re: ZWaveAPI
Just to say that I have been looking everywhere to find either:
a) How to authenticate ZWaveAPI from Python so I can issue commands via the ZWayAPI
or
b) How to disable ZWaveAPI authentication.
Although the above post solved (b) - many thanks for that - I want to say how difficult this setting is to find. I would never have come across it if I hadn't stumbled across this post. Why is the setting not put in a more obvious place?
As for (a), and again after hours of searching, I have managed part of this. I have the Cookie. But I have no idea what to do with it in order to get past the "Not logged in" scenario. Being an amateur, I find much of the suggestions incomprehensible, and difficult to implement. Zway should publish the Python code to do this. My code is (short and simple):
import requests
import json
payload = {'form': 'True','login':'admin','password':'password','keepme':'false','default_ui':'1'}
r = requests.post('http://192.168.1.30:8083/ZAutomation/ap ... s(payload))
cookie = r.json()['data']['sid']
However, as I have a Raspberry Pi operating on my private network at home, I have opted for solution (b) - disable authentication. My ZWave network has been running like this for years before I upgraded the "firmware", so it is not a problem.
a) How to authenticate ZWaveAPI from Python so I can issue commands via the ZWayAPI
or
b) How to disable ZWaveAPI authentication.
Although the above post solved (b) - many thanks for that - I want to say how difficult this setting is to find. I would never have come across it if I hadn't stumbled across this post. Why is the setting not put in a more obvious place?
As for (a), and again after hours of searching, I have managed part of this. I have the Cookie. But I have no idea what to do with it in order to get past the "Not logged in" scenario. Being an amateur, I find much of the suggestions incomprehensible, and difficult to implement. Zway should publish the Python code to do this. My code is (short and simple):
import requests
import json
payload = {'form': 'True','login':'admin','password':'password','keepme':'false','default_ui':'1'}
r = requests.post('http://192.168.1.30:8083/ZAutomation/ap ... s(payload))
cookie = r.json()['data']['sid']
However, as I have a Raspberry Pi operating on my private network at home, I have opted for solution (b) - disable authentication. My ZWave network has been running like this for years before I upgraded the "firmware", so it is not a problem.
Re: ZWaveAPI
For some reason, the url after "post" has been destroyed. It keeps getting chopped up (not me), so I'll try in segments:
r = requests.post('http://192.168.1.30:8083
/ZAutomation/api/v1
/login',data=json.dumps(payload))
It's all one line, so join it up again!
r = requests.post('http://192.168.1.30:8083
/ZAutomation/api/v1
/login',data=json.dumps(payload))
It's all one line, so join it up again!