Question about virtual/dummy devices

Discussions about RaZberry - Z-Wave board for Raspberry computer
Post Reply
rumcooler
Posts: 11
Joined: 08 Sep 2015 18:51

Question about virtual/dummy devices

Post 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
pz1
Posts: 2053
Joined: 08 Apr 2012 13:44

Re: Question about virtual/dummy devices

Post 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
rumcooler
Posts: 11
Joined: 08 Sep 2015 18:51

Re: Question about virtual/dummy devices

Post 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
Post Reply