more G-Labs products

Author Topic: Sunset and Sunrise not updating  (Read 1333 times)

August 22, 2016, 03:37:23 AM
Read 1333 times

mchias13

  • **
  • Information
  • Jr. Member
  • Posts: 45
For some reason, my sunset and sunrise times have not been updating.  The WU app shows the correct sunset time for 19:38, but the schedule shows the sunset time as 20:08.  It's like it hasn't updated in almost a month.  I'm on r252.  The sunrise is showing similar issues.

August 22, 2016, 03:44:49 AM
Reply #1

Acorlin

  • **
  • Information
  • Jr. Member
  • Posts: 44
I had a similar problem. I switched to Edge and JKUTILS for timing. I gave up on WU. BTW Thank you for all your help to me in the past.

August 23, 2016, 06:54:29 PM
Reply #2

mchias13

  • **
  • Information
  • Jr. Member
  • Posts: 45
are you able to use jkutils with the new scheduler?  I tried linking it like I did with @Sunrise and it didn't work.  I tried @Evening.Sunset.Start and no go.

August 23, 2016, 07:20:13 PM
Reply #3

danlewis

  • *
  • Information
  • Newbie
  • Posts: 4
If you're using build 525, use @SolarTimes.Sunrise and @SolarTimes.Sunset.  These variables are now built right into the scheduler.  No need for jkutils or for a Weather Underground API key.

August 23, 2016, 09:03:43 PM
Reply #4

mchias13

  • **
  • Information
  • Jr. Member
  • Posts: 45
Thanks.   @SolarTimes worked.

August 27, 2016, 11:36:09 PM
Reply #5

kevinvinv

  • ****
  • Information
  • Sr. Member
  • Posts: 196
Hello,  I am trying to use @SolarTimes.Sunset in my C# code.

I see this error from the compiler

Error
×
Line 20, Column 34 (Code):
    An object reference is required to access non-static member `Innovative.SolarCalculator.SolarTimes.Sunrise'


can anyone decipher this ?   Thanks!!!  :)

August 29, 2016, 05:09:27 PM
Reply #6

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
Post a code snippet.  Perhaps it's just an error in the code?

August 30, 2016, 04:31:15 AM
Reply #7

kevinvinv

  • ****
  • Information
  • Sr. Member
  • Posts: 196

Here ya go  :)


 if (module.Is("BackPorchMotion"))
     { 

        [email protected];
        [email protected];
     

        if (DateTime.Compare(DateTime.Now, time_sunrise)<0 || DateTime.Compare(DateTime.Now, time_sunset)>0)
        {
          Night = true;
          //Log("Night");
        }
        else
        {
          Night = false;
          //Log("Day");
        }

August 30, 2016, 05:56:51 AM
Reply #8

bkenobi

  • *****
  • Information
  • Global Moderator
  • Posts: 1525
I don't think you can use that declaration for time_sunset.  For my Advanced Smart Lights code, I use a different approach.

Code: [Select]
    time_sunrise = DateTime.ParseExact(Program.WithName("jkUtils - Solar Altitude").Parameter("jkUtils.SolarAltitude.Morning.Sunrise.Start").Value, "H:mm", System.Globalization.CultureInfo.InvariantCulture);
    time_sunset = DateTime.ParseExact(Program.WithName("jkUtils - Solar Altitude").Parameter("jkUtils.SolarAltitude.Evening.Sunset.End").Value, "H:mm", System.Globalization.CultureInfo.InvariantCulture);

The important part is that I use ".Parameter("jkUtils.SolarAltitude.Morning.Sunrise.Start").Value".  You might be able to use your "@SolarTimes.Sunrise" assignment, but I think you will need to use quotes at a minimum.