Announcement

Collapse
No announcement yet.

Two script questions

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

    Two script questions

    Two scripting questions.

    1) I want to control the log entries when my script runs. I'd like to disable logging of commands generated by my script and instead issue hs.writelog strings. This way I can cut down on the number of log entries and have the entries make more sense. I experimented with LogFileAccess (see below), but it did not seem to do anything. I would like just one log entry from this script instead of the 8 entries I currently get. Am I using the command wrong or should I be using something else?

    Sub Main
    hs.logfileaccess FALSE
    hs.writelog "Info", "Running Hallway Lamp (H3) Control..."
    if hs.isoff("H3") then hs.execx10 "H3", "on",0,0
    hs.execx10 "P1", "off",0,0
    hs.execx10 "P2", "off",0,0
    hs.logfileaccess TRUE
    End Sub

    2) What is the script command for Device Command Off with a Delay? Event version shown below.
    Attached Files

    #2
    1)
    Change Sub Main to Sub Main()
    Remove the hs.logfileaccess lines - they are not needed.
    On your devices H3, P1 and P2, make sure the checkbox "do not log commands from this device is checked".
    On your event that runs the script, make sure "do not log this event" is checked.
    You should end up with a single line in your log - the hs.writeLog

    2) Look up NewTimeEvent - this will create an event to do something in the future, then remove the event - in your case, :30 seconds later. An alternative that is not recommended is to use waitsecs. It's not recommended for events that get called in quick succession.

    Hope this helps...
    HS4Pro on a Raspberry Pi4
    54 Z-Wave Nodes / 21 Zigbee Devices / 108 Events / 767 Devices
    Plugins: Z-Wave / Zigbee Plus / EasyTrigger / AK Weather / OMNI

    HSTouch Clients: 1 Android

    Comment


      #3
      Originally posted by rmasonjr View Post
      On your devices H3, P1 and P2, make sure the checkbox "do not log commands from this device is checked".
      I don't want the devices themselves to never issue log entries, only in some of my scripts. I still want them to show up in the log when executed in other ways. Therefore I can use the command execx10nolog instead for a more targeted effect.

      The checkbox for Do Not Log This Event is what I needed the most. However it does not suppress all the log messages, only some. For example, here is my current Event Action. Due to retriggering, I need to remove any existing delayed event.

      Sub Main()
      hs.removedelayedevent "H3",""
      if hs.isoff("H3") then hs.execx10NoLog "H3", "on",0,0
      hs.execx10NoLog "P1", "off",0,0
      hs.writelog "Info", "Running upstairs hallway sconce lite control: H3 ON"
      End Sub

      Device Command: 2nd Floor Upstairs Hallway Stairs Sconce Lite Off Delay: 00:00:30

      An example of a log file entry is below. Not all the commands get suppressed as expected. The Motion Sensor (P1) is the trigger and I expect it to show up in the log. I also expect the writelog statement to show up. But I don't expect the "Delayed Device Action Removed" entries from retriggering nor do I expect to see the final/delayed H3 OFF.

      Why aren't they suppressed? Is this the best I can do?

      Regarding the second question...

      I looked at NewTimeEvent. This is a fairly complicated command. To set it up for a 30 second OFF delay is difficult, I'll need to construct a time string and date string for 30 seconds in the future for insertion into the command. Will this work with the removedelayedevent command? I know the waitsecs command does not.

      Is there an easier way?
      Attached Files

      Comment


        #4
        Reviving an old thread.

        I have the same issue than Mr Spock.

        I have Virtual Devices for which I checked "Do not log..."

        I have Events acting on these devices for which I also checked "Do not log..."

        However, Using RemoveDelayedEvent for the events creates entries in the Homeseer log that I don't want, like so:

        PHP Code:
        15/12/2010 9:34:27 PM     Event     Delayed Trigger Event Removedkitchen link reset (delayed event)
        15/12/2010 9:34:36 PM     Event     Delayed Trigger Event Removedhome_automation link reset (delayed event)
        15/12/2010 9:35:32 PM     Event     Delayed Trigger Event Removedmedia link reset (delayed event
        The problem is that my scripts generate a lot RemoveDelayedEvent commands and my logs fill up with these entries unnecessarily.

        Is there a way to avoid creating these log entries while removing delayed events ?

        Comment


          #5
          bump...

          Comment


            #6
            I'm convinced you used to not be able to get rid of these (and Rupp confirmed it), but they are no longer appearing in my log (and I rely on them heavily for my lighting, I never noticed they had gone really) - i'm using them from events as opposed to scripts.

            What version of HS are you using? I'm on 2.5.0.1...perhaps may have changed somewhere along the beta line?

            Comment


              #7
              Just to satisfty myself i'm not going insane...http://forums.homeseer.com/showthrea...hlight=delayed

              Comment

              Working...
              X