List of switch IDs and sensor ID

Is there a files or table maintained in OpenRemote that lists all the switch Ids , sensor IDs , etc for quick look up? I am asking because I want to be able to use them with rest http commands and currently the way I am finding them is inconvenient by searching through the panel xml file.

You could skip the panel.xml and use the named command REST API (allows you to use the name of the commands as defined in the designer) to call commands rather than messing with volatile IDs.

Richard thanks! That would be nice
I am sure how to use the rest api for named commands

Currently as an example I use
http://192.168.1.30:8688/controller/rest/status/588158
http://192.168.1.30:8688/controller/rest/control/1087/off

What would be the url for the above with commands
Zooz dimmer a status
Zooz dimmed a off

It’s been a while since I’ve looked at OR2 but the key file is:

https://github.com/openremote/Controller/blob/master/controller/src/main/java/org/openremote/controller/rest/CommandRESTServlet.java#L126

So you will need to:

Make a HTTP Post request to: /rest/devices/{device_name}/commands?name={command_name}

Include a Content-Type header (either set to application/json or application/xml depending on how you want to format the body)

for application/json then the body of the request should be like:

{“parameter”: “COMMAND_VALUE_HERE”}

for application/xml then the body of the request should be like:

COMMAND_VALUE_HERE

Use something like postman or DHC restlet plugin for Chrome to test this out. I’m only basing the above info on a quick read of the source code but hopefully it gets you what you want.

Thanks for the info. However I am not have much luck with this

I tried the following:
http://192.168.1.30:8688/controller/rest/devices/Zooz%20dimmer%20zen22/commands?name=zooz%20dimmer%20a%20status

It comes back with a blank screen on the browser

Any suggestions?

Quick update

Looks like the following are working but I just don’t get any ack back whether it was successfully executed or not. Also with the status command there is no value that is returned - just a blank page. Any suggestions on how to get the status ?

http://192.168.1.30:8688/controller/rest/devices/Zooz%20dimmer%20zen22/commands?name=zooz%20dimmer%20a%20off

http://192.168.1.30:8688/controller/rest/devices/Zooz%20dimmer%20zen22/commands?name=zooz%20dimmer%20a%20on

The acknowledgement is the fact that the HTTP request returns a 200 response. For sensors you need to use:

// [HTTP GET] /rest/devices/{device_name}/status?name={sensor_name}&name={sensor_name}

Add the following header for JSON response:

Accept: application/json

Thanks Richards

This format worked for me

http://192.168.1.30:8688/controller/rest/devices/Zooz%20dimmer%20zen22/status?name=zooz%20dimmer%20a%20switch%20status&name=zooz%20dimmer%20a%20switch%20status