HomeGenie Forum

General Category => Troubleshooting and Support => Topic started by: David on October 17, 2014, 12:52:49 PM

Title: Global variables
Post by: David on October 17, 2014, 12:52:49 PM
Hi,

 I'm very new to HomeGenie, I'm looking to try and move my current automation system over to this because (1) it looks very impressive and (2) it runs on a Raspberry Pi, which I want to use to get the computing hardware down from a desktop PC to some using less power and space.

 Is there the equivalent of global variables anywhere? I use them on my other system to control various things, for instance to enable automatic lighting, a script that switches on lights based on sunset time checks whether the automatic process is enabled, the advantage being the enable/disable value can be changed on a schedule or manually. There are other variables used to enable/disable processes, to set values used for various things etc.

Regards,
David
Title: Re: Global variables
Post by: mvdarend on October 17, 2014, 05:42:51 PM
I'm not sure if Global variables are available, but one option might be to create a 'virtual' module?

Another example I'm using is to mis-use the 'Security Alarm System' as a switch, (I don't actually have an alarm)

When running scenes I check to see if the Alarm is 'armed', if so do this, else do that etc. This is sufficient for my needs, but you might need something a little more elaborate than a single on/off variable.
Title: Re: Global variables
Post by: David on October 17, 2014, 06:05:08 PM
Thanks for that, I'll look into the idea of a virtual module, I'm guessing this is a bit of code that remains loaded/active whilst HG is running, that may do the trick but it will take some learning on my behalf :-)
Title: Re: Global variables
Post by: bkenobi on October 17, 2014, 07:13:35 PM
The security system in HG is a C# module.  If you need to have a virtual switch of sorts, you could actually write your own using snippets from the security system code.  Virtual modules sound like a good option for some of your needs, but code is infinitely more flexible.