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

Detect that light went on and switch off after 30 minutes?


Question

Posted

Hi -

I want to detect in LUA that my kitchen light went on, wait 30 minutes and then auto-switch it off. How do I do that?

I know there's a feature in the 221's settings to program an auto-off timer, but with that I can no longer manually switch off the kitchen light. Once on, only the time-out will switch off the light. The normal light switch will not, and I do need that option too.

Thanks,

Ronald

4 answers to this question

Recommended Posts

  • 0
Posted

Hi Ronald,

You could use 2 scenes and variabels for that.

Make one scene that checks every minute IF the light is on THEN change the variable X with value 1. Then you create a second scene that check the same variable every minute and if it detects value 1 it will turn off the light with 30 min delay AND change the variable X to 0.

Cheers

Daniel

  • 0
  • Inquirer
  • Posted

    Duh... This probably is the easiest scene to create - ever

    Please login or register to see this image.

    /emoticons/default_icon_redface.gif" alt=":oops:" /> . Sorry for even asking the question and cluttering the forum with it... Here's how I resolved it in graphic blocks and how it translates to LUA...

    --[[

    %% properties

    13 value

    %% globals

    --]]

    local startSource = fibaro:getSourceTrigger();

    if ( ( tonumber(fibaro:getValue(13, "value")) > 0 )

    or startSource["type"] == "other"

    )

    then

    fibaro:sleep(1800000);

    fibaro:call(13, "turnOff");

    end

    Please login or register to see this attachment.

    • 0
    Posted

    Aren't you missing a trigger for the scene? How will it know when to check if the light is on?

    • 0
  • Inquirer
  • Posted
    Aren't you missing a trigger for the scene? How will it know when to check if the light is on?

    The first line in the block code is the trigger.

    If you look at the LUA code: that seems to catch if there is a trigger at all and when there is, there's an if statement (did light go on). I suspect that HC2 on each trigger that happens will run through all its IF statements so see if any apply...

    Whatever it is - works like a charm!

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