Where to find the Output of URL query

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
friarJohn
Posts: 6
Joined: 12 Nov 2021 19:21

Where to find the Output of URL query

Post by friarJohn »

This should be an easy answer, but I am not getting it on my own. I have a Yale lock. Looking within the Z-wave controller's EXPERT administration, >_Expert Commands (tab), for the (#2) YALE LOCK, I have this (see image below).
UserCode section's top view
UserCode section's top view
image_2023-07-25_105415916.png (145.51 KiB) Viewed 1650 times
Scrolling down a little further I have a "UserCode" section (containing various commands / Binary settings). I have programmed successfully my User codes using this section. It seems to work great. So my question is where do I see the information from the lock's memory // command an action // check a setting (binary or integer)? For example, there is one button, "MasterCodeGet," which to me means I can use this to query what value the lock has for the Master Code of the lock. This query can be a "HTTP" or "JS" depending on what is selected.
MasterCodeGet
MasterCodeGet
image_2023-07-25_111200959.png (12.38 KiB) Viewed 1650 times
After choosing HTTP in the context box (click on it) the url for the http query is shown (as seen in the image below) and is now in the computer's clipboard (whatever device you are running a web browser to see the Z-wave administration).
MasterCodeGet with http url
MasterCodeGet with http url
MasterCodeGet http.png (30.34 KiB) Viewed 1650 times
Now if I put that http query in another tab of the browser and enter(key) it, the browser screen displays just the text, "null" on a white background (screen). Okay then, a null response to me means it went okay. But where is the Master Code shown for me to see it?
I can further ask how can I see a string of data, like hundreds of User Codes (see the image below)?
UserCode / Get
UserCode / Get
image_2023-07-25_113612569.png (20.53 KiB) Viewed 1650 times
Baffled.
seattleneil
Posts: 172
Joined: 02 Mar 2020 22:41

Re: Where to find the Output of URL query

Post by seattleneil »

You're closer to successfully fetching the data value than you realize.

By way of an example for device ID=26, Z-Way will return the entire JSON object for Command Class User Code (0x63/99) using the following URLs (they are all equivalent):

Code: Select all

http://[IP ADDRESS].lan:8083/ZWave.zway/Run/devices[26].instances[0].UserCode
http://[IP ADDRESS]:8083/ZWave.zway/Run/devices[26].instances[0].commandClasses[99]
http://[IP ADDRESS]:8083/ZWave.zway/Run/devices[26].instances[0].commandClasses[0x63]
Use your favorite JSON pretty printer to format the response into a human-friendly format. I typically copy and paste the response output into an on-line formatter: https://jsonformatter.org/json-pretty-print

By looking at the entire JSON object, you'll be able to identify what information Z-Way has available and how to fetch the data value. For example, to see the data value for the maxUsers parameter in command class 99 for device ID=26, use the following URL (or its equivalents):

Code: Select all

http://[IP ADDRESS]:8083/ZWave.zway/Run/devices[26].instances[0].commandClasses[99].data.maxUsers.valueOf()
One point of confusion is that the Get() method does not return a data value. Instead, it returns the status of Z-Way adding a job to the queue. For example, to cause Z-Way to add jobs for sending a Z-Wave Get message to the device for all user codes (i.e., command class 99), use the following URL:

Code: Select all

http://[IP ADDRESS]:8083/ZWave.zway/Run/devices[26].instances[0].commandClasses[99].Get(0)
Replace the Get(0) with Get(1) if you want to send a single Get message for the first user code. A Get(0) is special in that it will send multiple Get User Code messages, 1 for each possible user code, up to the maxUsers value).

A bigger source of confusion is that many lock vendors will not return user code values for security reasons. They might return a null value or a placeholder value. Personally, I think this vendor behavior makes sense since it avoids compromising user codes.

Hope this helps.
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: Where to find the Output of URL query

Post by PoltoS »

I'll just add to that the data model is described here:
https://z-wave.me/files/manual/z-way/De ... 0000000000
friarJohn
Posts: 6
Joined: 12 Nov 2021 19:21

Re: Where to find the Output of URL query

Post by friarJohn »

Thank you Seattleneil for your informative response.

The online JSON pretty printer (jsonformatter.org) is good to know about, but I figured after trying to use it that it would not be looking within my LAN to obtain data from the Yale lock. So after trying two or three downloadable JSON formatter programs and having difficulty using them, I reverted to a browser plug-in/ extension. That worked for me.

I think you are correct that the Yale locks do not give out the information for security reasons. My question then is how does one work with it? Is there a JSON program "environment" which supplies the MasterCode for the lock thus the lock now "divulges," if you will, the secure information?

I am not sure if it is worth taking the time to write a program that saves all my user codes. In fact, I have my own file keeping up with the user codes. The purpose of all this is to be able to write the user codes back into the lock if the lock has a malfunction or is accidentally wiped of its memory.
friarJohn
Posts: 6
Joined: 12 Nov 2021 19:21

Re: Where to find the Output of URL query

Post by friarJohn »

Thank you PoltoS. That is good to know. I will study it.
seattleneil
Posts: 172
Joined: 02 Mar 2020 22:41

Re: Where to find the Output of URL query

Post by seattleneil »

Since I don't have a Yale lock, the best I can do is make an educated guess in replying to your question:
My question then is how does one work with it? Is there a JSON program "environment" which supplies the MasterCode for the lock thus the lock now "divulges," if you will, the secure information?
To add a user code to a Yale lock where a master code has been configured, first do a mastercode set command with the master code value you've configured. Then do a usercode set command with a user code value and mode=1 for an unused ID. To delete a user code, issue a usercode set command using the ID of the code you want to delete and enter an arbitrary user code value with mode=0. You will need to manually keep track of which ID values are associated with each user code.

You can see what IDs values are "in use" (i.e., configured with mode=1) by looking at the status field for the ID value. You can fetch the ID status information for all of the IDs using the usercode get command (with ID=0).

The z-way-server.log file should show you if the mastercode set command successfully enabled user code management and if the usercode set command was accepted. Keep in mind this response is untested and is merely an educated guess - most likely you'll need to do some experimentation with the expert commands.
edaladst
Posts: 1
Joined: 09 Aug 2023 13:44

Re: Where to find the Output of URL query

Post by edaladst »

I am testing but after few times it still fails.
Post Reply