Jump to content
  • 0

Fibaro LUA scene execution unreliable (HC2)


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