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

Fibaro LUA scene execution unreliable (HC2)


dbergonz

Question

Hi,

I´m writing a couple of VERY SIMPLE LUA Scenes that I have linked to Double Click action of  a double switch 2.

The scene often works fine, but  sometimes, some  the turnon or turnoff actions are not executed. (by instance, instead of turning off the 3 lights, only 2 are turnned off, or maybe the vent turnon fails...) 

 

Also tried added sleep between commands but the result is the same. Any idea? This is quite frustrating...  

 

When I run the scen from the debuger interface, it seems that it works properly...

 

As stated, the code is very simple:  (Turn off lights, turn on vent, wait 7 minutes and turn off vent (except if the light were turned on again while the vent is on)

 

fibaro:call(88, "turnOff"); --light off 1
    fibaro:sleep(100);
    fibaro:call(93, "turnOff"); --light off 2
    fibaro:sleep(100);
    fibaro:call(94, "turnOff"); --light off 3
    fibaro:sleep(100);    
    fibaro:call(89, "turnOn"); --this is the vent 
    fibaro:sleep(420000); -- wait 7 minutes
          
      local bathLightStatus = 0;
  
      bathLightStatus = bathLightStatus + fibaro:getValue(88, 'value');
      bathLightStatus = bathLightStatus + fibaro:getValue(93, 'value');
     bathLightStatus = bathLightStatus + fibaro:getValue(94, 'value');
 
    -- fibaro:debug('Number of bath lights on: ' .. bathLightStatus);
  
      if ( bathLightStatus == 0)
    then
          -- fanStatus = fibaro:getValue(89, 'value');
          -- fibaro:debug('Fan Status '  .. fanStatus);
          fibaro:call(89, "turnOff");
          -- fibaro:sleep(1000);    
          -- fanStatus = fibaro:getValue(89, 'value');
         -- fibaro:debug('Fan Status after off '  .. fanStatus);
    end

 

  • Like 1
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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