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

[SOLVED]Scene - turn on only once at a specific time


Question

Posted

Hello

 

I need to create a scene that will be every day in the morning between 7.30 and 9.30 checking if the motion detector is violated, if so it will trigger some reaction, but only once a day.

Therefore, it is definitely necessary to make a variable that will change the value after the violation from 0 to 1

Unfortunately, my beginnings with Lua are difficult if anyone could help me to sort it out to start working?

 

--[[
%% properties
%% events
%% globals
--]]
if fibaro:countScenes() > 1 then 
 fibaro:debug("SCENE ABORT --------------------------") 
end

function toMinutes(czasHHMM) 
local a 
if type(czasHHMM) => "07:30"
if type(czasHHMM) =< "09:30"

end 
      then 
      fibaro:setGlobal("rano", "0") 
      else 
      fibaro:setGlobal("rano", "1") 
    end 
  
fibaro:sleep(60*1000) 
    
end 

Recommended Posts

  • 0
Posted

omg! ok!

5 minutes!

  • 0
Posted

Please login or register to see this code.

 

 

Please login or register to see this code.

 

this is basic script what you looking.

 

so, one notice from me:

 

here

    fibaro:debug("Playing Ukrainian anthem!!!!");

 

you should call another scene (sic!) or function own function.

please DO NOT write "spaghetti code" like you provide above. just call another scene what speak time, greeting, weahter, etc. 

 

notice2: please do not ask me about your code what you provide for speaking via Sonos... this "spaghetti code" is too not clear to me, sorry.

 

Please login or register to see this spoiler.

 

 

 

 

 

  • Like 1
  • 0
  • Inquirer
  • Posted

    I did as you wrote, I went to a different scene.
    It works :)
    I do not know how to thank you.
    Thank you very much

    • Thanks 1
    • 0
    Posted

    nie ma za co.

    • 0
  • Inquirer
  • Posted

    Hi.

    sometimes it happens that he gets up at 7.00.
    and the scene will work only after 30 minutes, for example
    although it is set up to run between 7.00 - 9.00.

    I wonder if this is not a problem as with block scenes sometimes with the need to measure from 60 seconds to switch to 55 and it will be ok.

    What do you think ? @10der

    • 0
    Posted

    I can only suggest adding print debug messages to code... it's can clearly understand what happens here... IMHO

    • 0
  • Inquirer
  • Posted

    Look for my debug 

     

    Please login or register to see this attachment.

    Please login or register to see this attachment.

    • 0
    Posted

    hehe, Ok I'll debug code asap, thank you for response! 

    • 0
    Posted

    Please login or register to see this code.

    simple edition :)

    • Like 1
    • 0
  • Inquirer
  • Posted

    it works :)
    but he repeats the scene probably from 4 times :)

    • 0
    Posted

    repeat or repeat and run, its' too different.

    Ths scene cannot be executed more than 1 times... strange

    • 0
    Posted
    20 minutes ago, wojtas810 said:

    Working good :) !!

    1

     

    welcome!

    • Like 1
    • 0
    Posted

    how to compare time that pass 00:00 ? say I want to turn on something between 23:00 and next day 02:00

     

    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...