HomeGenie Forum
Automation Program Plugins and Wizard Scripting => Help => Topic started by: Ossi_Jr on April 20, 2015, 10:48:47 AM
-
Hi,
I am thinking about some kind of absence mode. Where different nodes in my network behave differently based on the fact I am absent or not. Therefore I'd like to create a global variable which can be used in the triggering section (sth like isAbsent = false).
But I have to idea if there is a way to create such a variable to be available in every program?
Is it achievable? If not via scripting, is it possible to create such a variable with one of the language programming?
Cheers and thanks
-
Am I really the first one thinking about such a requirement?
-
I don't think its posible but i would love that feature.
-
You can access the value of a parameter from any program by properly referencing it. There is no easy way to add such a global variable to the main HG code, but there is really no need for it either.
-
There is a PingMe.AtHome app/program in the Security group which would give you a good starting point of using an event/parameter:
//setup
Program.Parameter("PingMe.AtHome").Value = "1";
//code
if (pinging_buddies > 0 && Program.Parameter("PingMe.AtHome").Value != "1")
{
Program.RaiseEvent("PingMe.AtHome", "1", "Ping Me At Home");
If I understand how this particular app works, you would need to have your router assign a fixed IP to your cellphone so the app could ping it reliably. Also would require WiFi on cellphone to be on as you arrived home.
-
Forgot about that script, but that would definitely get the OP ~95% of the way to where he wants to be. It might require tweaking the script a little to do his task or just writing another script that uses the PingMeAtHome parameters.
-
Another option to have a variable that sticks around and is globally accessible is to write to a file, then read when needed. May be useful, for example, if one wanted to remember if the alarm system was on or not across a reboot/power outage.
-
That would certainly work. If you are writing a value that doesn't change much or need to be accessed quickly, that would work well. If it's being written all the time and/or needs fast access time, that might not be the best option. Good suggestion!
-
Global variable can be access by program. You can create therm by calling :
Setting.Parameter("VariableX").Value = "Any value" ;
It's can be called by any program. Only we cannot access from UI.