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

Scene implemented with LUA does not work as expected :-(


Question

Posted

Hi experts,

I created my first LUA based scene to trigger a light on by clicking a remote control. But unfortunately it doesn´t work as expected! If I press a button on the remote control the corresponding value is send to the HC2. But unfortunately this doesn´t trigger my coding! Only if I press "Start"/Run the scene it is ececuted once and evaluates once the value:

Here is my small coding:

--[[

%% properties

117 sceneActivation –Change this to The ID of the Keyfob!!

%% globals

--]]

local id= 117;

if ( tonumber(fibaro:getValue(id, "sceneActivation")) == 11) -- button 1, single press

then

fibaro:call(102, "turnOn");

end

My expectation was that this scene is "always" running and as soon as I press a button on the remote control the scene evaluates the value returned from "id". What do I miss? Or do I have to trigger the execution of this scene by using a different one that will be triggered as soon as the remote control is activated/on....????

Many thanks for help!!!

kind regards,

alkorsi

6 answers to this question

Recommended Posts

  • 0
Posted

@ alkorsi

You might need to add the bit in red

--[[

%% properties

%% autostart

117 sceneActivation –Change this to The ID of the Keyfob!!

%% globals

--]]

local id= 117;

if ( tonumber(fibaro:getValue(id, "sceneActivation")) == 11) -- button 1, single press

then

fibaro:call(102, "turnOn");

end

Brian

  • 0
Posted

You don't need the red line, you have to remove the text after sceneActivation in the top part.

change

117 sceneActivation –Change this to The ID of the Keyfob!!

to

117 sceneActivation

and use 1 instead of 11 (I use that in my case and that is working).

and did you set parameter 250 to 1?

  • 0
  • Inquirer
  • Posted

    Hi Remko,

    What is the meaning of parameter 250=1? I have to set this in the configuration of the key fob, right?

    Thanks

    alkorsi

    • 0
    Posted

    Hi Alkorsi,

    That is correct, you have to create a parameter "250, 1d, 1".

    • 0
    Posted

    alkorsi, Did you try to run a lua code with your comments?

    • 0
  • Inquirer
  • Posted

    I changed my code accordingly to the suggestions from Remko and now it works!

    Please login or register to see this image.

    /emoticons/default_icon_smile.gif" alt=":-)" />

    Thanks and kind regards,

    alkorsi

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