luup.sunset() failed

I have a veralite and I am set up a light to be turned on 15 minutes after sunset, but my veralite thinks my sunset was at 1:51pm today.

So I was trying to test some luup script to print out to the message area what time my veralite thinks tomorrows sunset is.

This code didn’t work
local data = luup.sunset() — Capture the output of the executed command.
luup.task(tostring(data), 1, “Sunset”, -1)

This code works
local data = luup.is_night() — Capture the output of the executed command.
luup.task(tostring(data), 1, “Sunset”, -1)

Any ideas on either the sunset not working on my veralite or what the luup.sunset() command is would be appreciated.

These functions were only recently added to the MiOS documentation. It’s possible they haven’t been released yet.

Where has this been documented? Wow, that would be a really impressive improvement from mcv if they did a proper documentation before releasing…

The functions were added on 27 March, so they aren’t present in 1.5.346.

@chixxi
They are documented here:
http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_sunset_.2F_sunrise

@mcvflorin: Thanks! And an honest compliment to mcv, I like having the documentation before the release.

Thanks for the quick replies, so that brings up my other problem then. Why does my veralite think my sunset is 1:51 pm when I use it in a scene for turning on a light?

Is there anyway to check what time my veralite thinks sunset is?

What timezone/Location is your VeraLite set to use?

@puap
Yes.

  1. Create a scene with a schedule to run at sunset.
  2. Save.
  3. Open the user_data with: http://:3480/data_request?id=user_data&output_format=xml
  4. Search for a tag named . Below this tag search for that scene. You should see a list with the timers. Look for the next_run attribute of that timer (schedule).
  5. Use a web tool like this one to convert the timestamp in a readable local time.

@MCV,

How difficult is it to add the firmware requirements for [tt]luup.sunset/luup.sunrise[/tt] to the wiki documentation?

@Ap15e

I just did, thanks for the suggestion. Didn’t cross my mind. ;D

Ok so here are some details: My timezone set on my veralite is Los Angeles.

<root timezone=“0” PK_City=“29848” longitude=“-117.637000” latitude=“33.568200”

I should be GMT-8 hrs, so not sure what the timezone should be set to in the <root tag.

The longitude and latitude seem correct.

The timestamp seems correct:
1334716706
1334716706 translates to Tuesday, April 17th 2012, 18:38:26 (GMT -8)

The time on my veralite is correct and matches my local time.

We are in PDT right now, so we are actually GMT-7, so your sunset is at 7:38 tonight.

I am in Long Beach, and my “Sunset+30” ran at 19:55:49, which means sunset was at 19:35 (7:35 PM) for me.

@puap

The timezone attribute of the root node is always “0”. Look for the gmt_offset attribute of the root node instead.

Just and update to close the post.

I did run the timezone fixer script, and deleted the scene and re-did it for :15 after sunset and it worked yesterday at the expected time.
Thanks for your help.