Announcement

Collapse
No announcement yet.

Minutes until sunrise

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

    Minutes until sunrise

    Hi, I'm looking for an Immediate Script Command to give me the number of minutes from now to sunrise, i.e something like hs.speak(time.of.sunrise - time.now).

    TIA
    Michael
    Regards,
    Michael

    HS3, W10 Home, HSTouch, W800, Z-Stick+

    #2
    Here you go:

    Code:
    &nhs.speak(CInt(hs.SunriseDt.subtract(dateTime.Now).TotalMinutes))
    Jon

    Comment


      #3
      Awesome! Thanks, Jon.

      This is to be run at my normal wakeup time. It does two things: 1) let's me know how much time I have before I actually HAVE to get up and let the cat out and 2) well, when the sun's coming up.

      Final version:

      &nhs.speak("Sunrise is in " + cStr(CInt(hs.SunriseDt.subtract(dateTime.Now).TotalMinutes)) + " minutes.")

      Thanks again!
      Regards,
      Michael

      HS3, W10 Home, HSTouch, W800, Z-Stick+

      Comment


        #4
        I tried that myself. The first time I got "Sunrise is in minus 946 minutes."
        But a minute later, I got..."Sunrise is in minus 947 minutes."

        Something seems a bit off.....


        Jim Speiser
        38-year veteran of Home Automation
        Still don't know squat

        Comment


          #5
          Originally posted by JimSpy View Post
          I tried that myself. The first time I got "Sunrise is in minus 946 minutes."
          But a minute later, I got..."Sunrise is in minus 947 minutes."

          Something seems a bit off.....
          Seems correct to me. As sunrise has passed, the minus value will increase as time passes during the day. It will go positive again after midnight.
          Jon

          Comment


            #6
            Yes, this will only report a positive number if the time now is after midnight and before sunrise which is fine for my purposes.
            Regards,
            Michael

            HS3, W10 Home, HSTouch, W800, Z-Stick+

            Comment


              #7
              Originally posted by jon00 View Post

              Seems correct to me. As sunrise has passed, the minus value will increase as time passes during the day. It will go positive again after midnight.
              Yup. Figured that out after I posted. Then went to write a new post, and my Internet went out. It's been that kind of year.


              Jim Speiser
              38-year veteran of Home Automation
              Still don't know squat

              Comment

              Working...
              X