Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: use environment or global variable to set location #55

Closed
drmibell opened this issue Jul 30, 2022 · 3 comments
Closed

Comments

@drmibell
Copy link

I have home automation flows with solar events that I would like to use at several locations. Editing schedules to change lat/lon can get tedious, so I wonder if a shell environment variable or a global defined in settings.js could be used.

@Steve-Mcl
Copy link
Owner

Have you tried using ${MY_SHELL_ENV_VAR} ?

@drmibell
Copy link
Author

drmibell commented Aug 1, 2022

Yes, but I got errors because I was using an old version, 1.3.0, I think. Updating fixed it. Only a few small issues. I get a pop-up saying "Error: Cannot get description from node-red" as soon as I start typing in that field, even if everything works after I close the dialog. Also, the node accepts a single string like ${LOCATION} but not ${LAT} ${LON} or anything else I've tried with two separate variables. (The second is no big deal.) Finally, because I was running NR on a Pi as a systemd session, I had trouble getting it to pick up my environment variables. I ended up using process.env.LOCATION= "38.897517, -77.036542" in the settings.js file. Is there a better way?

@Steve-Mcl
Copy link
Owner

In v2.0.0 (just released), a default location (for all schedules in a node) can be set by ENV VAR.

NOTE: Env vars can be picked up by setting them in the TAB, a group or the new global env vars in NR 3.1.0 (due very soon)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants