Announcement

Collapse
No announcement yet.

Global variables

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

    Global variables

    I haven't figured out how to use them on the Zee yet. I'm using a counter instead. I set a counter to one when I activate my alarm system. I set it to zero when I disarm. Seems like a global variable would be better for this. Can anyone help me understand how to use them?

    #2
    Be careful with global variables in that they disappear when the system is shut down (which I appreciate is what you try to avoid with a HS system) and they need to be created again at startup.

    If you want to just hold the state of the alarm you can do it in a device, not all devices need to really correspond to something physical. You can create a device, set it with some value/status pairs and then use this in events.

    Comment


      #3
      If you are aware of your alarm system arming or disarming, isn't that done through a device?

      Yes, global variables are more for keeping information while HomeSeer is running as they do disappear at shutdown. I use one for example to hold the serial port number of my theatre projector. When I need to send a command to it, I can't open a port that is already open, and I don't want HomeSeer to keep closing and re-opening the port, so when I open the port I store the port number in a global variable, then the commands that need to send/receive from the port can look for the global variable. If it is not found (port = 0) then I know it has not yet been opened. If it does find it (port = 8) then I know it is already open and I can just send the command. Shutting down HS closes the port without me having to tell it to, so it works great for tracking the port status.

      So if you need something stored more permanently, create a virtual device, otherwise, the global variables work well for that.
      Regards,

      Rick Tinker (a.k.a. "Tink")

      Comment


        #4
        Is there no way to make things like this (and the logs last over a reboot)? I would rather purge my own logs than have it all disappear if power is lost to the Zee.

        Comment


          #5
          Originally posted by TechFan View Post
          Is there no way to make things like this (and the logs last over a reboot)? I would rather purge my own logs than have it all disappear if power is lost to the Zee.
          The logs ARE permanent. Just change the log filter selection to see log entries from before the last restart. When you click the clear view button in the log, it only changes the date/time for the selection - it does not remove log entries.

          Global Variables are not saved intentionally - been that way since HS 1.6! If you want something saved, then like I said create a device - you can then save information easily in the value or string. (There are other properties that can hold information without having to convert it to a double integer or a string, but that is a little more advanced.)

          You can also explain what you are trying to do and perhaps there is a way to do it without a global variable or a device.
          Regards,

          Rick Tinker (a.k.a. "Tink")

          Comment


            #6
            I don't know what I am trying to do yet. I have been able to use timers for all the rules I have created so far (do they last over reboots?), but I was playing with a few ideas that I was thinking might need a few variables. I will need to figure out how to manually create a device. I tried once but got distracted with something else.

            Good to know the logs are still there. I will check the filtering when I get home.

            Comment


              #7
              I went looking for the logs. . .I am not sure where they should be found, but I found HomeSeerLog.hsd in the logs directory, but it was last updated back at the end of October?? I am not seeing relevant logs in the typical /var/logs location either.

              I found another copy of that file in the Data directory, but it is small and was last modified Dec 1 (probably the last time I rebooted).

              Update: Also, I checked for filtering, I don't have a choice to pick a date earlier than the last reboot??

              Comment

              Working...
              X