Announcement

Collapse
No announcement yet.

Countdown timer?

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

    #16
    Thanks for updating the script but I want to be able to reset the values without requiring the timer to reach the max value. In some instances, the timer will be stopped and I then want to reset the value of the virtual device back to 60 /& "60 seconds". Oddly, this script doesn't do it.

    Sub Main(ByVal Parms As Object)
    hs.SetDeviceValueByRef(439, 60, True)
    hs.SetDeviceString(439, 60 & " seconds", True)
    end sub

    Any ideas why not?

    -Mike

    Comment


      #17
      Your script will reset the virtual device as you've written. Are you disabling the 'Countdown Update Timer' event (if not already timed out) prior to updating the virtual?
      Mike

      Comment


        #18
        ah! I was stopping the timer but not resetting it. Once I reset it back to 60, the device changed as well.

        Thanks for everyone's help.

        -Mike

        Comment


          #19
          Is there any way someone could assist me by adapting it so that it shows minutes and seconds? I need to display count downs that are as many 50 minutes.

          In a perfect world I would like to just set up one device and have an event set the starting point. (I would never have more than one timer running at a time.)

          Any assistance would be greatly appreciated.
          HomeSeer Version: HS3 Pro Edition
          Operating System: Microsoft Windows 10 Pro
          Processor Type and Speed: i7 - 3.26 GHz
          Total Physical Memory: 16Gig

          Plugins: BlBackup | EasyTrigger | FitbitSeer | HSTouchServer | Insteon | WeatherXML

          Comment


            #20
            I wanted to thank you for a very cool countdown timer!
            I couldn't get the while way to work but I achieved it another way.
            After all there are many ways to achieve something and wanted to share.

            Thank you
            Chris

            I have uploaded my script and method, but thank you mwaite and others

            Code:
            Public Sub Main(param As Object)
                Dim StartVar as integer = 567  ' Set this to the countdown starting value
                Dim x as Integer 
                x = Convert.ToInt32(hs.TimerValue("Utility Fan Countdown").TotalSeconds)
                hs.SetDeviceValueByRef(1186, StartVar - x, True)
                hs.SetDeviceString(1186, StartVar - x & " seconds", True)
            	'hs.writelog("Utility Countdown","Updating")
            	
            	Dim hms as TimeSpan = TimeSpan.FromSeconds(StartVar - x)
            		Dim h = hms.Hours.ToString
            		Dim m = hms.Minutes.ToString
            		Dim s = hms.Seconds.ToString
            	'hs.SetDeviceString(1187, h & ":" & m & ":" & s, True)
            	hs.SetDeviceString(1187, m & " min " & s & " sec", True)
            	hs.SetDeviceValueByRef(1187, StartVar - x, True)
            	
                If x = StartVar then
                    hs.WaitSecs(1)
                    hs.SetDeviceValueByRef(1186, StartVar, True)
                    hs.SetDeviceString(1186, StartVar & " seconds", True)
            		
            		Dim hmsSV as TimeSpan = TimeSpan.FromSeconds(StartVar)
            		Dim hSV = hmsSV.Hours.ToString
            		Dim mSV = hmsSV.Minutes.ToString
            		Dim sSV = hmsSV.Seconds.ToString
            		hs.SetDeviceValueByRef(1187, StartVar, True)
            		hs.SetDeviceString(1187, mSV & " min " & sSV & " sec", True)
                End If
            End Sub
            .
            Attached Files
            Last edited by smokeycoles; August 19, 2016, 05:28 PM.

            Comment


              #21
              Hi.

              Since countdown is a common and I guess widely used task, wouldn't is be simpler to implement the feature along the timers in HS and make it easier for non programmers to use?

              Thank you
              Br,
              Dali


              Comment


                #22
                Originally posted by Kdiamond View Post
                . . .wouldn't is be simpler to implement the feature along the timers in HS and make it easier for non programmers to use?
                Of course. But, how patient are you? (Note that this thread is over two years old.)

                Mike____________________________________________________________ __________________
                HS3 Pro Edition 3.0.0.548, NUC i3

                HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

                Comment


                  #23
                  Or maybe just to allow for negative numbers, so the timer could start at - and go towards zero.

                  Br,
                  Dali

                  Comment


                    #24
                    Since these forums are primarily for user to user communication and not regularly monitored by HST staff, any bug reports or requests for enhancements should be sent to support@homeseer.com

                    As Michael suggests, the requests will go into a queue and there is no way of knowing where your request will land in the queue, if at all. I know the programming staff's plates are quite full.
                    HS4 Pro, 4.2.19.16 Windows 10 pro, Supermicro LP Xeon

                    Comment

                    Working...
                    X