Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team

Question
Jay Ess 6
i have a function wI which computes sun angles, i have an array called sunposition where i am storing the sun angles i want to compute. i would like to get back 6 values, which are the six values in the sunposition array, i am unsure how to set up the results part of this please?
sunPosition = {
{-0.833, "sunrise", "sunset"},
{-0.3, "sunriseEnd", "sunsetStart"},
{-8, "blueHourDawn", "blueHourDuskEnd"}
}
function QuickApp:GetTimes()
local tb = {}
for k,v in pairs(sunPosition) do tb[#tb+1]={name=k,angle=v} end
table.sort(tb,function(a,b) return a.angle > b.angle end)
for _,a in ipairs(tb) do
R = a.angle
--print(R)
hour = "12"
minute = "00"
local returnTime
if R == -8 then
returnTime = wI(T,"U")
print("Shabbos Out Time",returnTime)
if fibaro.getGlobalVariable("shabbosEndTime") ~= returnTime then
print("Updating Variable "..returnTime)
fibaro.setGlobalVariable("shabbosEndTime", returnTime)
self:updateProperty("log", returnTime.." "..os.date("%x %H:%M:%S"))
end
--self:updateView("lblShabbosOut", "text", "Shabbos Goes Out At "..returnTime)
elseif R == -0.8333 then
--shabbosStartTime
returnTime = sec2str(str2sec(wI(T,"D"))-(15*60))
print("Shabbos In Time",returnTime)
if fibaro.getGlobalVariable("shabbosStartTime") ~= returnTime then
print("Updating Variable "..returnTime)
fibaro.setGlobalVariable("shabbosStartTime", returnTime)
end
--self:updateView("lblShabbosIn", "text", "Shabbos Comes In At "..returnTime)
end
end
--self:updateView("lblShabbosIn","visible",false)
--self:updateView("lblShabbosOut", "text", "Shabbos Goes Out At "..fibaro.getGlobalVariable("shabbosEndTime"))
self:UpdateLabelView()
end
7 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.