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

Lua code opening door + motiondetector does not trigger lamp


Question

Posted

Hi Folks!

I try to learn lua code from scratch. not just copy & past... and i need some basic help

Why does not the lamp (id28) flash , when "door1" and "ir" becomes ones.

It feels like the script does not start automatically, but then I press the "start" it works if "door1" and "ir" are ones.

I am probably missing something, a start command?? (Active scene is checked)

my code:

--[[

%% autostart

%% properties

20 ,60 value

%% globals

--]]

local ir

local door1

door1 = fibaro:getValue(60, 'value')

ir = fibaro:getValue(20, 'value')

fibaro:debug('Doorsensor is = ' .. door1)

fibaro:debug('IR-sensor is = ' .. ir)

if (door1== "1") and (ir== "1") then

fibaro:call(28, "turnOn");

fibaro:sleep(2000);

fibaro:call(28, "turnOff");

end

2 answers to this question

Recommended Posts

  • 0
Posted

Please login or register to see this code.

try like that

  • 0
  • Inquirer
  • Posted

    piotr.janiak: Yes THX

    Think i need a break

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