Jump to content

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


  • 0

Why didnt it work?


Guest David R

Question

Guest David R
Posted

Can some one point me in the right direction? I wrote my first code today simple on/off lights scene. It showed no errors and debug was showing it was running. All devices numbers were correct so I sat back and waited for the lights to come on and.....nothing lol! Does anyone know where I went wrong? Thanks

--[[

%% autostart

%% properties

%% globals

--]]

if (fibaro:countScenes() > 1) then

fibaro:abort()

end

while true do

local currentDate = os.date("*t");

local theTime = (string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min))

fibaro:debug(theTime)

if (theTime == "06:00") then

fibaro:call(96, "turnOn")

fibaro:call(100,"turnOn");--turn table lamps on at 6am--

elseif (theTime == "06:30") then

fibaro:call(108, "turnOn"); --turn outside light on at 6.30am--

elseif (theTime == "07.30")

then fibaro:call (96, "turnOff")

fibaro:call (100, "turnOff")

--turn table lamps off @ 7.30am--

elseif (theTime == "8.00")

then fibaro:call (108, "turnOff") --turn outside light off at 8.00am--

--evening on/off--

elseif (theTime == "17.00")

then fibaro:call (96, "turnOn")

fibaro:call (100, "turnOn")--turn lamps on at 5pm--

elseif (theTime == "17.45")

then fibaro:call (108, "turnOn") -- turn outside light on at 5.45pm--

elseif (theTime == "23.00")

then fibaro:call (100, "turnOff")

fibaro:call (96, "turnOff")--turn off table lamps at 11pm--

elseif (theTime == "23.30")

then fibaro:call (108, "turnOff")--turn outside light off at 11.30pm--

end

fibaro:sleep(60 * 1000)

end

2 answers to this question

Recommended Posts

  • 0
Posted

you used . instead of : in the times you compared with. eq 17.00 instead of 17:00.

[ Added: 2014-10-18, 20:38 ]

for the current time, i always use:

local currentTime = os.date("%H:%M");

  • 0
Guest David R
  • Inquirer
  • Posted

    Ok thanks mate!

    [ Added: 2014-10-18, 23:06 ]

    Ok script worked now. Only my time in the top corner says correct time as in London GMT but wrong time in set time so all my timers are an hour out. But I guess this is a beta issue.

    [ Added: 2014-10-18, 23:18 ]

    uk.pool.ntp.org shows it an hour in front of actual UK time?

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...