Announcement

Collapse
No announcement yet.

Virtual Device vs. Global Variable

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • waynehead99
    replied
    Wow thanks Jon. That clears it up for me. INI files are still over my head (except for updating the values in an already created one IE. your plugins).

    I like the idea of being able to store Arrays as I have a few scripts doing that already and that is where my experience and learning is right now with scripting in vb.net.

    Thanks again.

    Leave a comment:


  • jon00
    replied
    Virtual devices

    Advantages:
    String/double integer is stored in the Homeseer database and not lost when rebooting.
    Can be read/saved by any script.

    Disadvantages:
    Can only store a single string and/or double Integer
    String will be visible on the web page against this virtual device.

    Global variables

    Advantages:
    Can hold any object (String,Integer,Array etc).
    Can be read/saved by any script once created.
    Unlimited number of variables can be created.

    Disadvantages:
    Variables are lost after each restart of Homeseer and have to be recreated.
    Can only store a single object per variable created.

    Ini files

    Advantages:
    Can hold any string.
    Globally available to be read/written from any script.
    Multiple storage areas available
    Data is never normally lost.

    Disadvantages:
    Can only store strings (but can be converted to Integers etc)
    May be slightly slower in read times than other methods

    Leave a comment:


  • waynehead99
    started a topic Virtual Device vs. Global Variable

    Virtual Device vs. Global Variable

    I am a novice HS scripter and utilize Virtual Devices to hold data that I need for my scripts, but never actually use the virtual device for any other purpose.

    I guess my question is, what is the difference between using a Virtual Device vs a Global variable for this purpose. I know that global variables have to be defined each time HS is started up, but are they easier to use or should I just stick with virtual devices?
Working...
X