read the value of an environment var into Code-device

Discussions about Z-Way software and Z-Wave technology in general
Post Reply
rocus
Posts: 3
Joined: 19 Mar 2018 16:27

read the value of an environment var into Code-device

Post by rocus »

I am trying to read an environment variable (with a real value) into a Code-device. The value comes from a two-wire temperature
sensor already hanging on a (the) raspberry. I tried : parseFloat( os.system.getenv ( "var-name" ) ), but I get an error message:

Reference error , (os/system/getenv) ... not defined.

I know, I am not an experienced Java programmer (and I don't want to be one), but some examples of javascript code (for the Code-device) would be very welcome (in this forum or the Zway manual).

Integrating already present sensors and actuators in this z-wave world is, in my opinion, a must. There should be a Howto (integrate other sensors) somewhere.

Also the HTTP device is hardly documented. Some examples would be welcome.

Thanks for any help!!
User avatar
PoltoS
Posts: 7565
Joined: 26 Jan 2011 19:36

Re: read the value of an environment var into Code-device

Post by PoltoS »

Environment variables live in the context of bash. You can not use them to do your task.

Better push them via /JS/Run API in the JS engine or read them via system("some shell command") from JS code
Post Reply