Enumerating sensor ids

Discussions about Z-Way software and Z-Wave technology in general
erozen
Posts: 14
Joined: 12 Apr 2020 03:21

Enumerating sensor ids

Post by erozen »

I'm using the sensor logging app to export some data to a remote HTTP server. That is working great, but the only data I can get out is sensor id and sensor value, which leaves me with data points like:

Code: Select all

ZWayVDev_zway_3-0-50-2:0
Is there a way to enumerate the sensor ids, so I can map them to the friendly names I've given them in the interface? I've been able to get it from the API like such - is this the best way, or am I missing something?

Code: Select all

http://127.0.0.1:8083/ZWaveAPI/Run/devices[4].data.givenName.value
http://127.0.0.1:8083/ZWaveAPI/Run/devices[4].instances[0].commandClasses[49].data[3].sensorTypeString.value
erozen
Posts: 14
Joined: 12 Apr 2020 03:21

Re: Enumerating sensor ids

Post by erozen »

I've just noticed that this only gives the devices built-in strings, not the ones I've assigned. In some places this is fine, but in others it requires esoteric logic to correctly enumerate - e.g. when the type is just 'Electric', so you need to extract 'ScaleString' and know that the 'V' means volts.

The ZAutomation API looks like a promising alternative, but I can't find a URL format that returns data. If I format using the data in my log - i.e. something like

Code: Select all

http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_2:0:50/command/update
it returns

Code: Select all

{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_2:0:50 doesn't exist"}
I haven't yet found a format or device that works.
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: Enumerating sensor ids

Post by PoltoS »

The id is ZWayVDev_zway_3-0-50-2

To use low level you can parse it to:

Code: Select all

ZWayVDev_                      - just a prefix for all devices created by the Z-Wave Binding App
         zway                  - Z-Wave Binding instance ID (configured in the app settings)
              3                - Z-Wave node ID
                0              - Channel ID
                  50           - CC Id (Meter in this case)
                      2        - scale Id
erozen
Posts: 14
Joined: 12 Apr 2020 03:21

Re: Enumerating sensor ids

Post by erozen »

Cool, cheers. I've managed to work out what the numbers mean, what I need is a way to map this back to the actual device name. Is there some part of the API where I can pass in those numbers and get back a string telling what device it is? I haven't yet found one.

Chopping the numbers and changing formatting isn't a problem, I just need a way to pass the numbers in and get back 'Living room light', 'Garage temperature' or whatever.
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: Enumerating sensor ids

Post by PoltoS »

/ZAutomation/api/v1/devices/ZWayVDev_zway_3-0-50-2 gives you all the info
erozen
Posts: 14
Joined: 12 Apr 2020 03:21

Re: Enumerating sensor ids

Post by erozen »

With that URL string I get 'Invalid ZAutomation request'. I have more luck if I change the 'API' to 'api', in that it no longer reports Invalid request, but no matter how I format the string I can't get anything other than "Device doesn't exist".

First I verify the device exists and zway knows about it using another interface:

Code: Select all

$ curl -gL 'http://127.0.0.1:8083/ZWaveAPI/Run/devices[3].instances[0].commandClasses[50].data[2]'
{"invalidateTime":1587450600,"updateTime":1587450602,"type":"empty","value":null,"sensorType":{".........
But we when I try to get data for the same device using ZAutomation, no matter how I ask, I get nothing:

Code: Select all

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_cen_3_0_50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_cen_3_0_50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_cen_3_0_50_2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_cen_3_0_50_2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_cen_3-0-50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_cen_3-0-50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_cen_3-0-50-2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_cen_3-0-50-2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_cen_3.0.50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_cen_3.0.50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_cen_3.0.50.2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_cen_3.0.50.2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_cen_3:0:50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_cen_3:0:50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_cen_3:0:50:2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_cen_3:0:50:2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_CEN_3_0_50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_CEN_3_0_50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_CEN_3_0_50_2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_CEN_3_0_50_2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_CEN_3-0-50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_CEN_3-0-50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_CEN_3-0-50-2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_CEN_3-0-50-2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_CEN_3.0.50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_CEN_3.0.50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_CEN_3.0.50.2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_CEN_3.0.50.2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_CEN_3:0:50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_CEN_3:0:50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_CEN_3:0:50:2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_CEN_3:0:50:2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_zway_3_0_50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_zway_3_0_50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_zway_3_0_50_2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_zway_3_0_50_2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_zway_3-0-50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_zway_3-0-50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_zway_3-0-50-2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_zway_3-0-50-2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_zway_3.0.50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_zway_3.0.50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_zway_3.0.50.2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_zway_3.0.50.2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_zway_3:0:50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_zway_3:0:50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_zway_3:0:50:2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_zway_3:0:50:2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_ZWAY_3_0_50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_ZWAY_3_0_50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_ZWAY_3_0_50_2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_ZWAY_3_0_50_2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_ZWAY_3-0-50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_ZWAY_3-0-50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_ZWAY_3-0-50-2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_ZWAY_3-0-50-2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_ZWAY_3.0.50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_ZWAY_3.0.50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_ZWAY_3.0.50.2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_ZWAY_3.0.50.2 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_ZWAY_3:0:50:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_ZWAY_3:0:50 doesn't exist"}

Trying http://127.0.0.1:8083/ZAutomation/api/v1/devices/ZWayVDev_ZWAY_3:0:50:2:
{"data":null,"code":404,"message":"404 Not Found","error":"Device ZWayVDev_ZWAY_3:0:50:2 doesn't exist"}
Is there some formatting trick I'm missing, or something I need to do to enable this? Reading the doc, it looks like it should just work - it doesn't for me so I must be missing something, but I can't work out what!
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: Enumerating sensor ids

Post by PoltoS »

Sorry, of course api and not API in the URL.

What is _cen_ ??

Please try just /ZAutomation/api/v1/devices to see all devices and check their names/IDs
erozen
Posts: 14
Joined: 12 Apr 2020 03:21

Re: Enumerating sensor ids

Post by erozen »

Among other things, I tried renaming my device while debugging some issues, to see if it helped - it's now called 'cen', not the default 'zway'.

That URL gives me:

Code: Select all

$ curl -vgL 'http://127.0.0.1:8083/ZAutomation/api/v1/device'
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 8083 (#0)
> GET /ZAutomation/api/v1/device HTTP/1.1
> Host: 127.0.0.1:8083
> User-Agent: curl/7.52.1
> Accept: */*
> 
< HTTP/1.1 404 Not Found
< Server: Mongoose/6.4
< Content-Type: text/plain; charset=utf-8
< Connection: close
< Content-Length: 9
< 
* Curl_http_done: called premature == 0
* Closing connection 0
Not Found
User avatar
PoltoS
Posts: 7579
Joined: 26 Jan 2011 19:36

Re: Enumerating sensor ids

Post by PoltoS »

deviceS
erozen
Posts: 14
Joined: 12 Apr 2020 03:21

Re: Enumerating sensor ids

Post by erozen »

Mu apologies, I misread. Devices gives:

Code: Select all

{"data":{"structureChanged":false,"updateTime":1587932081,"devices":[]},"code":200,"message":"200 OK","error":null}
Post Reply