more G-Labs products

Author Topic: Global variables  (Read 1224 times)

October 17, 2014, 12:52:49 PM
Read 1224 times

David

  • *
  • Information
  • Newbie
  • Posts: 2
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

October 17, 2014, 05:42:51 PM
Reply #1

mvdarend

  • *****
  • Information
  • Hero Member
  • Posts: 431
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.
« Last Edit: October 17, 2014, 05:44:23 PM by mvdarend »

October 17, 2014, 06:05:08 PM
Reply #2

David

  • *
  • Information
  • Newbie
  • Posts: 2
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 :-)

October 17, 2014, 07:13:35 PM
Reply #3

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
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.