Page 1 of 1

Question about virtual/dummy devices

Posted: 31 Mar 2016 23:33
by rumcooler
Hello to eveybody
I have created a new dummy device as binary switch and i use it as a trigger for scene ...
How can i check state status of this device from exteranl software like Node js?
From a browser i can see this:
http://myip:8083/ZAutomation/api/v1/dev ... yDevice_44
i get this:

{"data":{"creationTime":1459165644,"creatorId":44,"deviceType":"switchBinary","h":-1669838495,"hasHistory":false,"id":"DummyDevice_44","location":0,"metrics":{"level":"off","title":"Abilita allerta"},"permanently_hidden":false,"probeType":"","tags":[],"visibility":true,"updateTime":1459455031},"code":200,"message":"200 OK","error":null}

I want query level on/off from an external program.
How can i do it?
Thank you
rumcooler

Re: Question about virtual/dummy devices

Posted: 01 Apr 2016 10:22
by pz1
One solution is to use the OpenRemoteHelpers App. That provides a simplified (but also limited access):

Code: Select all

http://myip:8083/OpenRemote/metrics/DummyDevice_44/level/
"off"

To get an overview of all accessible metrics use the call without the metric specifier

Code: Select all

http://myip:8083/OpenRemote/metrics/DummyDevice_44/
{"level":"off","title":"Dummy Device"}

To set your dummy device use SetMetrics as follows:

Code: Select all

http://myip:8083/OpenRemote/SetMetrics/DummyDevice_44/level/on
NOTE: The SetMetrics is not available in the standard distribution. You must upgrade OpenRemoteHelpers from the App store

Re: Question about virtual/dummy devices

Posted: 02 Apr 2016 14:28
by rumcooler
Thank you for your reply.
This is perfect for my application.
Another question: i write this code: http://myip:8083/.../mydevice/alarm.bind(function() ...)
This is ok, but remove bind it's possible whitout restart z-way service?
There is something like unbind function?
It's possible inject the code for bind function automatically after every restart?

Bye
Rumcooler