Announcement

Collapse
No announcement yet.

Kitchen timer?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Kitchen timer?

    Does anyone have a kitchen type timer script?
    I looked at the alarm clock stuff, but it triggers on the next day, and I can't figure out how to make it trigger the same day.
    One that when you push a button in HST it would increment the timer by 1 min, then push "Start" and when it's done make an announcement. ie-"Your cake is done"

    Thanks
    Tim
    FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

    HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

    #2
    Hey fungun,

    This sounds a lot like the "sleep timer" my wife has been asking me to create. What kind of parameters do I need to consider?

    What's the max timer value? Could I assume less than 12 hours? Would the timing ever cross over midnight? Would you want separate hour and minute incr/decr buttons? Do you need to see the time counting down while the timer is running? If yes, would a minute-by-minute display be good enough or would you want to see the seconds displayed as well? Would you want to be able to stop/start/restart/cancel the timer?

    I'll start working on the base code and I can add the other features in if needed.

    Also, it's probably not going to be .NET since I don't have enough experience with that yet.

    Ken
    "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

    Comment


      #3
      Originally posted by kenm View Post
      Hey fungun,

      This sounds a lot like the "sleep timer" my wife has been asking me to create. What kind of parameters do I need to consider?

      What's the max timer value? 1 hour would be good Could I assume less than 12 hours? Would the timing ever cross over midnight?I wouldn't think so, unless your up making a midnight snack of cookies LOL Would you want separate hour and minute incr/decr buttons?I think just mins would be good enough. Do you need to see the time counting down while the timer is running?Yes If yes, would a minute-by-minute display be good enough or would you want to see the seconds displayed as well?either would be ok Would you want to be able to stop/start/restart/cancel the timer?Yes to all.

      I'll start working on the base code and I can add the other features in if needed.

      Also, it's probably not going to be .NET since I don't have enough experience with that yet.

      Ken
      Very cool thank you much.
      Tim
      FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

      HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

      Comment


        #4
        I created this kitchen countdown timer. kind of crude.(but it works)
        You can only enter the total minutes then the enter button. NO stop at this time.
        You can hit the clear and change the minutes before you hit enter.
        It allows you to enter the timer in minutes and then it counts down minute by minute.
        you need to create 2 virtual devices and the 2 small scripts (below) in the Hs script directory.
        I used t10 and t67.
        Also the timer.xml file is included.

        Stuart

        Timerkeystrokes.txt

        Sub Main
        dim digit
        digit = hs.devicevalue ("t66")
        digit = (digit * 10)+ hs.devicevalue ("t67")
        hs.setdevicevalue "t66", digit
        End Sub



        Timerbutton.txt

        sub main()
        dim maxsecs,totalmins,delaysecs
        totalmins = hs.devicevalue("T10")
        maxsecs = hs.devicevalue("T10")
        delaysecs= 60 * totalmins
        hs.delaytrigger delaysecs,"completed message"
        if totalmins = 0 then
        exit sub
        end if
        for maxsecs = totalmins to 1 step -1
        hs.setdevicevalue("T10"),maxsecs
        hs.waitsecs 60
        next

        hs.speak "your time has completed, your time is up."
        end sub
        Attached Files

        Comment


          #5
          hs.setdevicevalue("T10"),maxsecs
          hs.waitsecs 60
          next
          Does the waitsecs 60 bog things down any?
          I was under the assumtion you shopuldn't go longer than 30.
          Thanks,
          Tim
          FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

          HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

          Comment


            #6
            Stuart,

            Do you run that code regularly? I would think it would be hard for your system to get much done while it was running. With an "hs.waitsecs 60" in a "for" loop the only time your system would be able to get anything done would be while it was decrementing the loop counter and updating t10.

            My approach is to setup a recurring event that fires off once a minute, checks the status of the timer, and reacts if the timer has reached zero. I would then enable or disable the recurring timer check event depending on whether or not the timer was running. I'm going to steal some code from my sprinkler control script so I should have something to post sometime tomorrow afternoon unless the weather is really nice...

            Ken
            "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

            Comment


              #7
              I would recommend the following logic:

              1.) Create a drop down element with predefined the options (see the "Values" area in the editor - lower right).

              2.) The script takes the requested time and creates a new event based on the desired new time.

              3.) The event will trigger and execute the requested step.

              This architecture is sound without extra delay and processing.
              HomeSeer 2, HomeSeer 3, Allonis myServer, Amazon Alexa Dots, ELK M1G, ISY 994i, HomeKit, BlueIris, and 6 "4k" Cameras using NVR, and integration between all of these systems. Home Automation since 1980.

              Comment


                #8
                The wait didnt seem to impact system performance. I guess I've been hoping that Hs had a countdown timer built in. It would make it a lot easier to display this then to come up with some round about way to make it work. If anyone makes anything better, please post it as I would be interested in it.
                Stuart

                Comment


                  #9
                  My recommendation is not round about. It's architecturally sound and does not need extra processing as a wait loop would. Ugly.
                  HomeSeer 2, HomeSeer 3, Allonis myServer, Amazon Alexa Dots, ELK M1G, ISY 994i, HomeKit, BlueIris, and 6 "4k" Cameras using NVR, and integration between all of these systems. Home Automation since 1980.

                  Comment


                    #10
                    Originally posted by fungun View Post
                    Does the waitsecs 60 bog things down any?
                    I was under the assumtion you shopuldn't go longer than 30.
                    Thanks,
                    Tim
                    His system will run just fine using hs.WaitSecs - this is exactly what hs.WaitSecs was provided for!
                    From the scripting help:
                    WaitSecs
                    Purpose
                    This function waits a number of seconds. This will also allow other operations to take place in HomeSeer by giving up the CPU. It will also keep a script from timing out. The function will not return until the number of seconds have elapsed.
                    If you need to actually do something in a loop while waiting then use hs.WaitEvents so that HS doesn't get blocked by your script.

                    Sometimes I use the event architecture that Krumpy outlined for timer-based things and other times I just use hs.WaitSecs. Both methods work fine.
                    Best regards,
                    -Mark-

                    If you're not out on the edge, you're taking up too much room!
                    Interested in 3D maps? Check out my company site: Solid Terrain Modeling

                    Comment


                      #11
                      Krumpy,
                      I'm not referring to your approach as round about. I was referring to mine. Usually when I can figure out something and code it, I'm happy. But I'm always willing to learn.
                      Stuart

                      Comment


                        #12
                        Originally posted by Krumpy View Post
                        I would recommend the following logic:

                        1.) Create a drop down element with predefined the options (see the "Values" area in the editor - lower right).

                        2.) The script takes the requested time and creates a new event based on the desired new time.

                        3.) The event will trigger and execute the requested step.

                        This architecture is sound without extra delay and processing.
                        Hi Krumpy,

                        As it turns out that's exactly the approach I took with my sprinkler control script. I hadn't looked at that script for a couple of years and when I went back to it to grab the code for the kitchen timer I realized I was setting events in the future and having them trigger.

                        This approach would work fine from a functional standpoint but one of the goals is to provide a countdown display of the timer. If there was a "Time until Trigger" function that allowed you to get the time between current time and the trigger of a timed event that would work but the only other way I can figure out how to do it is to run a recurring event and decrement the timer value and use that as the data displayed on the HST screen.

                        Please let me know if you can think of a way to display the "time remaining" using the timed event approach.

                        Ken
                        "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

                        Comment


                          #13
                          Originally posted by mfisher View Post
                          His system will run just fine using hs.WaitSecs - this is exactly what hs.WaitSecs was provided for!
                          From the scripting help:
                          If you need to actually do something in a loop while waiting then use hs.WaitEvents so that HS doesn't get blocked by your script.

                          Sometimes I use the event architecture that Krumpy outlined for timer-based things and other times I just use hs.WaitSecs. Both methods work fine.
                          Hi Mark,

                          Thanks for pointing this out. I'll have to go back and investigate these functions further when I get a few minutes. In the past (1.x days) scripts and HS ran in the same thread and it was my understanding that nothing else happened while a script was in an hs.Waitsecs. I know that the architecture of HS has changed with 2.x but I still thought that scripts not written in vb.net ran in a single thread which meant that an hs.Waitsecs would block any non-vb.net script from running while it was waiting.

                          Thanks again for the clarification,
                          Ken
                          "if I have seen further [than others], it is by standing on the shoulders of giants." --Sir Isaac Newton (1675)

                          Comment


                            #14
                            I tried Stuart's approach and had to constantly run to the HS pc and click the script control box to continue or end the script. Hung everything up. Also the countdown always shows 0. Unless I am not setting it up right

                            Thanks,
                            Tim
                            FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

                            HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

                            Comment


                              #15
                              Originally Posted by mfisher
                              His system will run just fine using hs.WaitSecs - this is exactly what hs.WaitSecs was provided for!
                              From the scripting help:
                              If you need to actually do something in a loop while waiting then use hs.WaitEvents so that HS doesn't get blocked by your script.

                              Sometimes I use the event architecture that Krumpy outlined for timer-based things and other times I just use hs.WaitSecs. Both methods work fine.
                              Isn't this a contadiction??
                              By what you wrote, we should be using hs.WaitEvents instead of hs.WaitSecs. True?

                              Tim
                              FB Page - https://www.facebook.com/pages/Capt-Tim/209398425902188

                              HSTouch Layouts - https://www.facebook.com/media/set/?...5902188&type=3

                              Comment

                              Working...
                              X