Haalt het aantal scene’s op die momenteel draaien.
Gebruik en Argumenten
fibaro:countScenes()
fibaro:countScenes(sceneID)
- sceneID: nummer – optioneel het id van de scene die geteld wordt.
Waarden die teruggeven worden
Een positief integer die het aantal actieve scene’s bevat.
Wanneer er een sceneID is gespecificeerd; zal er een integer teruggeven worden die het aantal actieve scene’s bevat met het betreffende sceneID.
Voorbeeld
-- Displays the number of instances of the current scene
local num = fibaro:countScenes()
if (num == 1) then
fibaro:debug('i am running only once.')
else
fibaro:debug('i am running ' .. num .. ' times.')
end
-- Only allow one instance of the current scene to run at a time
if (fibaro:countScenes() > 1) then
fibaro:abort()
end
-- Displays number of instances of scene 12
num = fibaro:countScenes(12);
fibaro:debug('Number of instances of scene 12: ' .. num);
-- Check if scene 12 is running
if (fibaro:countScenes(12) >= 1) then
fibaro:debug('Scene 12 is running);
else
fibaro:debug('Scene 12 is not running');
end
