Page 1 of 1

read the value of an environment var into Code-device

Posted: 19 Mar 2018 16:44
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!!

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

Posted: 20 Mar 2018 12:36
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