if ( luup.is_night() ) then question

For this Luup statement:

if ( luup.is_night() ) then
return true
else
return false
end

What defines “night”?

@ballroller

I think “night”, “not night” “sunset” and “sunrise” are set based on your regional timezone setting.

According to the wiki ([url=http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_is_night]http://wiki.micasaverde.com/index.php/Luup_Lua_extensions#function:_is_night[/url]) it returns true if time is between sunset and sunrise, which depends on where you set your location (http://wiki.micasaverde.com/index.php/Location).

If this is so (and i agree it is, referring to my own post just below)
Whats the impact of the issue discussed here:
http://forum.mios.com/index.php?topic=6695.0

Some luup variables (f.i. luup.timezone) derive their value from the user_data.
I filed a bug on this issue:
http://bugs.micasaverde.com/view.php?id=1495

Short answer… no impact.

Whilst [tt]luup.timezone[/tt] might not be populated, [tt]luup.is_night[/tt] doesn’t depend upon it to “work out” whether it’s in the Sunset->Sunrise time window. Most of the “[tt]luup.[/tt]” constructs are written directly in C, with no intermediate Lua dependancies, so it’s not generally a problem as they can source the TZ data from elsewhere in your Vera system.

…unless, of course, you actually want the timezone offset value itself for some reason, then you’d be hosed.

Will implementing DAD have any effect on what is and isn’t “night”?

Here is my dilemma. If I use the Lua code in my original post, the scene will NOT fire at night like it’s supposed to. If I remove the Lua code from the scene, it works.

Any thoughts?

A long shot, you’re not running an older MiOS version are you? [tt]luup.is_night()[/tt] wasn’t in the original UI4 builds. It was only documented in the Wiki in January 2011, so probably within that timeframe for it’s addition to the MiOS Luup stack.

If you’re running a build from last yr, it may not have the command at all, and it would error out completely, and probably never fire the scene (day or night)

Do your logs show “errors” when this snippet of code fires?

ie. in [tt]/var/log/cmh/LuaUPnP.log[/tt] (if you can SSH in)

[quote=“ballroller, post:7, topic:168466”]Here is my dilemma. If I use the Lua code in my original post, the scene will NOT fire at night like it’s supposed to. If I remove the Lua code from the scene, it works.

Any thoughts?[/quote]

Same issue here, i added a “not” but lamp still goes ON even when day.
Could this be related to timezone settings variable of luup?

Before and after sunrise settings work fine!

No. I just upgraded to .1245 in the last month or so.

How about a lesson in SSH’ing in? I have a putty client, but I don’t know where to point it to.

[quote=“guessed, post:8, topic:168466”]A long shot, you’re not running an older MiOS version are you? [tt]luup.is_night()[/tt] wasn’t in the original UI4 builds. It was only documented in the Wiki in January 2011, so probably within that timeframe for it’s addition to the MiOS Luup stack.

If you’re running a build from last yr, it may not have the command at all, and it would error out completely, and probably never fire the scene (day or night)

Do your logs show “errors” when this snippet of code fires?

ie. in [tt]/var/log/cmh/LuaUPnP.log[/tt] (if you can SSH in)[/quote]

@ballroller

i created a SSH howto im the howto section of wiki.mios.com
everything you want to know is there!

Let me know of you have questions!

I will check it out, thanks!

[quote=“Henk, post:11, topic:168466”]@ballroller

i created a SSH howto im the howto section of wiki.mios.com
everything you want to know is there!

Let me know of you have questions![/quote]

The wiki says to look for a password under “wifi pass” on the bottom of my Vera2.

I don’t have anything that says “wifi pass” or anything with “pass” in it.

Nevermind. I have a HomeID code.

luup.is_night() is not related to the Timezone variable in user_data, but to the Latitude and Longitude variables in user_data.

Look in LuaUPnP.log for:
[tt]JobHandler_LuaUPnP::GetDayNight[/tt]
or just:
[tt]GetDayNight[/tt]

cat /tmp/log/cmh/LuaUPnP.log | grep -i 'GetDayNight'

You may want to enable verbose logging and leave it on for a while, so that the function will execute. Logging on a memory stick highly recommended.

VerboseLogging enable

Don’t forget to disable verbose logging afterwards:

VerboseLogging disable