ZWaveAPI

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
User avatar
SparkyRih
Posts: 17
Joined: 21 Dec 2016 21:42

ZWaveAPI

Post by SparkyRih » 24 Jan 2017 17:37

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?

User avatar
PoltoS
Posts: 4251
Joined: 26 Jan 2011 19:36

Re: ZWaveAPI

Post by PoltoS » 24 Jan 2017 19:19

Your URL is wrong. Remove Data/ from it. Aither ZWaveAPI/Data/... or ZWaveAPI/Run/

User avatar
SparkyRih
Posts: 17
Joined: 21 Dec 2016 21:42

Re: ZWaveAPI

Post by SparkyRih » 24 Jan 2017 19:43

That did the trick...

BTW, isn't this a huge security flaw? I can read an control everything via that API without authenticating...

User avatar
PoltoS
Posts: 4251
Joined: 26 Jan 2011 19:36

Re: ZWaveAPI

Post by PoltoS » 25 Jan 2017 03:21

Have you checked "Allow public access to ZWaveAPI" ? ;)

User avatar
SparkyRih
Posts: 17
Joined: 21 Dec 2016 21:42

Re: ZWaveAPI

Post by SparkyRih » 03 Feb 2017 02:06

Ah ok :D

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 :)

Json
Posts: 1
Joined: 04 Feb 2017 20:17

Re: ZWaveAPI

Post by Json » 04 Feb 2017 20:33

PoltoS wrote:Have you checked "Allow public access to ZWaveAPI" ? ;)
Where do I find this setting? I have looked everywhere ...

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

ScotsDon
Posts: 16
Joined: 28 Jul 2015 20:55

Re: ZWaveAPI

Post by ScotsDon » 09 Aug 2018 17:39

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.

ScotsDon
Posts: 16
Joined: 28 Jul 2015 20:55

Re: ZWaveAPI

Post by ScotsDon » 09 Aug 2018 17:48

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!

Post Reply