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

Enabled vs Running Instance


Question

Posted

Hi,

 

What is the difference between "Enabled" and "Running Instance"?

 

The problem I have is, a scense made in Lua is not working.

I have the HC2 toolkit, and I can see enabled = false, but running instance = 1

 

The scene is supposed to run every one minute between a set time (in this case for testing 09:08 and 09:18: - how do I know if the scense is actually being performed, and therefore the lack of resonse is not a scene issue?

 

--[[
%% autostart
%% properties
%% events
%% globals
--]]

local sourceTrigger = fibaro:getSourceTrigger();
function tempFunc()
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
 ( (tonumber(os.date("%H%M")) >= tonumber(string.format("%02d%02d", "09", "08")) and tonumber(os.date("%H%M")) <= tonumber(string.format("%02d%02d", "09", "18"))) and (math.floor(os.time()/60)-math.floor(1470815880/60))%1 == 0 )
)
then
  fibaro:call(46, "pressButton", "1");
      setTimeout(function()
    fibaro:call(46, "pressButton", "1");
  end, 2000)
end

setTimeout(tempFunc, 60*1000)
end
if (sourceTrigger["type"] == "autostart") then
tempFunc()
else

local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
startSource["type"] == "other"
)
then
  fibaro:call(46, "pressButton", "1");
      setTimeout(function()
    fibaro:call(46, "pressButton", "1");
  end, 2000)
end

end

 

Thanks,

2 answers to this question

Recommended Posts

  • 0
Posted

Every 2 seconds you press a button, I don't know what is behind that button, but pressing a button every 2 seconds will kill your system for sure.

 

You can count your scenes with:

fibaro:countScenes(sceneID)

 

See this link:

Please login or register to see this link.

  • 0
  • Inquirer
  • Posted

    Thanks,

     

    What I'm trying to do is to press the button, wait two seconds and press it again, then end.

     

    I'm currently (I think, but I am new to code) rerun this every one minute for 10 minutes.

     

    The reason I am doing this is the press button does not seem to work (consistently), and therefore I want to press the button, wait a few seconds and try again -- then repeat after one minute -- I would hope to get this down to rerun only twice - so 4 button presses maximum.

     

    The button is a virtual device, global cache itach which sends a command.

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