Announcement

Collapse
No announcement yet.

Event Time is at (Value from Virtual)

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

    Event Time is at (Value from Virtual)

    Is there a way to set an event run time from a string saved in a Virtual Device?

    My ultimate goal is to have a time which can be set in HSTouch and have an event run based on the time. Yes, I am sure I could do a script to set the time, but I was hoping to do this without a script. And if I did this, I would still end up with something saving a string so I could show the time in HSTouch regardless of who opens the screen on which device. Basically, I can set a start time for an appliance, and if my wife opens the display on her phone, she sees that same start time.

    Karl
    Karl S
    HS4Pro on Windows 10
    1070 Devices
    56 Z-Wave Nodes
    104 Events
    HSTouch Clients: 3 Android, 1 iOS
    Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

    #2
    No there is no way to do this with a script, I have a kitchen timer and have to run an event every minute when it is running to determine whether or not 'Now' is equal to the time I wish for.

    Comment


      #3
      You could potentially create a delayed event using a script and have it execute based on the time in the virtual string. The event can auto-delete when it runs and then when you change the time, the script can create a new event.

      Cheers
      Al
      HS 4.2.8.0: 2134 Devices 1252 Events
      Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

      Comment


        #4
        Originally posted by mrhappy View Post
        No there is no way to do this with a script, I have a kitchen timer and have to run an event every minute when it is running to determine whether or not 'Now' is equal to the time I wish for.
        Does that mean you are just setting a start time in a different event and then setting a virtual device to "Now" in order to fire an event? If yes, why not just set the kitchen timer event directly?
        Karl S
        HS4Pro on Windows 10
        1070 Devices
        56 Z-Wave Nodes
        104 Events
        HSTouch Clients: 3 Android, 1 iOS
        Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

        Comment


          #5
          Originally posted by sparkman View Post
          You could potentially create a delayed event using a script and have it execute based on the time in the virtual string. The event can auto-delete when it runs and then when you change the time, it can create a new event.

          Cheers
          Al
          If I am writing a script, couldn't I set the event start time and not worry about power failures?

          (just trying to think it through and make sure I am as straightforward as possible)
          Karl S
          HS4Pro on Windows 10
          1070 Devices
          56 Z-Wave Nodes
          104 Events
          HSTouch Clients: 3 Android, 1 iOS
          Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

          Comment


            #6
            Originally posted by ksum View Post
            If I am writing a script, couldn't I set the event start time and not worry about power failures?

            (just trying to think it through and make sure I am as straightforward as possible)
            Yes, that should work. However, with delayed events you set a specific start day/time so there's no issue with power failures.

            Here's a script that I use to change the time on an event:

            Code:
            Sub Main(ByVal Parms as String)
            
            	Dim ParmArray() as String
            	ParmArray = Parms.tostring.split(",")
            	dim evtName as String = ParmArray(0)		'name of event
            	dim evtGroup as String = ParmArray(1)		'name of event group
            	dim newTime as Date = CDate(ParmArray(2))	'new time
            
            	dim Debug as Boolean = True
            	Dim evtRef As Double
            	Dim logName = "Event Time Change"			'set log type for HS log
            	Dim success As Boolean
            
            	evtRef = hs.GetEventRefByNameAndGroup(evtName,evtGroup)
            	success = hs.EventSetTimeTrigger(evtRef, newTime)
            
            	If success Then
            		If Debug Then hs.writelog(logName,"Event " & evtGroup & " - " & evtName & " time changed to <font color=red>" & CStr(newTime) & "</font>")
            	Else
            		If Debug Then hs.writelog(logName,"Event " & evtGroup & " - " & evtName & " time <font color=red>NOT</font> changed to <font color=red>" & CStr(newTime) & "</font>")
            	End If
            End Sub
            However, if you are controlling an appliance, I'm not sure if you want it running every day so you should probably have a way to disable the event as well. I pass the time to this script with another script, but you could read the device string instead.

            Cheers
            Al
            HS 4.2.8.0: 2134 Devices 1252 Events
            Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

            Comment


              #7
              However, if you are controlling an appliance, I'm not sure if you want it running every day so you should probably have a way to disable the event as well.
              I had an event in HS2 for this and it would run this script last, which disabled the event:
              Code:
              Sub Main (ByVal Param as object)
              Dim MyEvent as String
              
              MyEvent = Param
              
                   hs.DisableEvent(MyEvent) 
              End Sub
              I am just trying to take advantage of updated possibilities and limit my scripts wherever I can.

              (Yes, I am sadly JUST NOW getting around to upgrading even though I did an early purchase of the upgrade license... )
              Karl S
              HS4Pro on Windows 10
              1070 Devices
              56 Z-Wave Nodes
              104 Events
              HSTouch Clients: 3 Android, 1 iOS
              Google Home: 3 Mini units, 1 Pair Audios, 2 Displays

              Comment


                #8
                Originally posted by ksum View Post
                I had an event in HS2 for this and it would run this script last, which disabled the event:
                Code:
                Sub Main (ByVal Param as object)
                Dim MyEvent as String
                
                MyEvent = Param
                
                     hs.DisableEvent(MyEvent) 
                End Sub
                I am just trying to take advantage of updated possibilities and limit my scripts wherever I can.

                (Yes, I am sadly JUST NOW getting around to upgrading even though I did an early purchase of the upgrade license... )
                That script should work under HS3 as well.

                Cheers
                Al
                HS 4.2.8.0: 2134 Devices 1252 Events
                Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

                Comment

                Working...
                X