HomeGenie Forum

General Category => Troubleshooting and Support => Topic started by: mchias13 on August 22, 2016, 03:37:23 AM

Title: Sunset and Sunrise not updating
Post by: mchias13 on August 22, 2016, 03:37:23 AM
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.
Title: Re: Sunset and Sunrise not updating
Post by: Acorlin on August 22, 2016, 03:44:49 AM
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.
Title: Re: Sunset and Sunrise not updating
Post by: mchias13 on August 23, 2016, 06:54:29 PM
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.
Title: Re: Sunset and Sunrise not updating
Post by: danlewis on August 23, 2016, 07:20:13 PM
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.
Title: Re: Sunset and Sunrise not updating
Post by: mchias13 on August 23, 2016, 09:03:43 PM
Thanks.   @SolarTimes worked.
Title: Re: Sunset and Sunrise not updating
Post by: kevinvinv on August 27, 2016, 11:36:09 PM
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!!!  :)
Title: Re: Sunset and Sunrise not updating
Post by: bkenobi on August 29, 2016, 05:09:27 PM
Post a code snippet.  Perhaps it's just an error in the code?
Title: Re: Sunset and Sunrise not updating
Post by: kevinvinv on August 30, 2016, 04:31:15 AM

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");
        }
Title: Re: Sunset and Sunrise not updating
Post by: bkenobi on August 30, 2016, 05:56:51 AM
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.