Standard Variables within Code-App (or other generic apps)

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
klaasjoerg
Posts: 126
Joined: 30 Sep 2016 23:49

Standard Variables within Code-App (or other generic apps)

Post by klaasjoerg »

Quick question to the ones, that developed already apps around zwave-me:
Are there basically a certain number of default variables accessible within a app e.g. specially a code-app?

e.g. If I want to generate a SMS or E-Mail (e.g. by using a URL-call via code device app) I would like to pass over some more dynamic informations e.g. Device-Names that generated/triggered the alert or other things...

How would this be easily possible without having to write a new dedicated app?

Ideas?
BobElHat
Posts: 23
Joined: 27 Dec 2016 21:32

Re: Standard Variables within Code-App (or other generic app

Post by BobElHat »

You can store things in the metrics for the device. e.g. if you create a code device with a toggle button you could store something like so:

Code: Select all

controller.devices.get("Code_Device_toggleButton_118").set("metrics:mydata","whatever I want to store");
klaasjoerg
Posts: 126
Joined: 30 Sep 2016 23:49

Re: Standard Variables within Code-App (or other generic app

Post by klaasjoerg »

Thanks, but I was also wondering if there are default variable/objects I can access from any app/device without "saving/storing" first. Bascially I want to do the opposite. Simply use possibly existing informations to use them within different modules dynamically...
BobElHat
Posts: 23
Joined: 27 Dec 2016 21:32

Re: Standard Variables within Code-App (or other generic app

Post by BobElHat »

Yes, there's a lot you can access. There are links to documentation at the bottom of the Github repo.

I suggest you browse around the API docs to get a feel for what's available, it's trivial to get JSON dumps of the internal state of devices, modules, notifications etc. that way.

If you want to access things with JS from a code device or module have a look at the module developer documentation and maybe browse the code of some of the existing modules to get an idea of the syntax for accessing devices, events etc.
Post Reply