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

LUA Scripts Library


budda

Question

I'm always scratching about for great LUA examples in the forums, and they're usually spread across multiple posts as the code is refined.

As fas as I can tell nobody has curated all these great scripts together for new starters.

So I've started to put together some scripts I'm using personally, and will add any others I stumble across on the forums (and give credit in the commit message where I know who it is).

I'm using github.com so that anybody here can join in and contribute to the open library of LUA scripts.

Find more at

Please login or register to see this link.

and submit some pull requests with your favourite script!

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Great Idea

Please login or register to see this image.

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

You can add a code to wake up dead nodes:

--[[

%% properties

%% autostart

%% globals

--]]

local TotalDevices = 300 --max nr of devices

while true do

local timeNow = os.date('*t')

local day = timeNow['day']

local month = timeNow['month']

local i = 1

local anydead = 0

while i < TotalDevices do

--check if any dead

local status = fibaro:getValue(i, 'dead');

local name = fibaro:getName(i);

local room = fibaro:getRoomNameByDeviceID(i);

if status >= "1" then

fibaro:debug(day.."/"..month..":"..i..' DEAD '..name..":"..room);

fibaro:wakeUpDeadDevice(i)

fibaro:sleep(5000) --check again in 5 sec

status = fibaro:getValue(i, 'dead');

if status >= "1"

then anydead = 1; fibaro:debug('Really Dead')

else fibaro:debug('Now OK '..name)

end

end

i = i + 1

end

if anydead == 0

then --fibaro:debug('Nobody is dead :-)')

else

fibaro:call(2, 'sendEmail', 'Somebody really DEAD', '..')

fibaro:debug('Somebody really DEAD')

end

-- abort any unnecesary scenes started

if fibaro:countScenes() > 1 then fibaro:abort() end

fibaro:sleep(15*60000) --repeat every 15 minutes

end

Link to comment
Share on other sites

  • 0
Great Idea

Please login or register to see this image.

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

Great work. You can add here 73 more scripts.

Link to comment
Share on other sites

  • 0

Awesome, I was hopping that Fibaro will make some WiKi where you can find all scripts from users. This is great! budda, well done.

Please login or register to see this image.

/emoticons/default_icon_biggrin.gif" alt=":-D" />

+1

Link to comment
Share on other sites

  • 0
  • Inquirer
  • Great Idea

    Please login or register to see this image.

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

    You can add a code to wake up dead nodes:

    --[[

    %% properties

    %% autostart

    %% globals

    --]]

    local TotalDevices = 300 --max nr of devices

    while true do

    local timeNow = os.date('*t')

    local day = timeNow['day']

    local month = timeNow['month']

    local i = 1

    local anydead = 0

    while i < TotalDevices do

    --check if any dead

    local status = fibaro:getValue(i, 'dead');

    local name = fibaro:getName(i);

    local room = fibaro:getRoomNameByDeviceID(i);

    if status >= "1" then

    fibaro:debug(day.."/"..month..":"..i..' DEAD '..name..":"..room);

    fibaro:wakeUpDeadDevice(i)

    fibaro:sleep(5000) --check again in 5 sec

    status = fibaro:getValue(i, 'dead');

    if status >= "1"

    then anydead = 1; fibaro:debug('Really Dead')

    else fibaro:debug('Now OK '..name)

    end

    end

    i = i + 1

    end

    if anydead == 0

    then --fibaro:debug('Nobody is dead :-)')

    else

    fibaro:call(2, 'sendEmail', 'Somebody really DEAD', '..')

    fibaro:debug('Somebody really DEAD')

    end

    -- abort any unnecesary scenes started

    if fibaro:countScenes() > 1 then fibaro:abort() end

    fibaro:sleep(15*60000) --repeat every 15 minutes

    end

    Added, but ideally you could go to github and submit this yourself for inclusion in the public library.

    [ Added: 2013-10-08, 00:56 ]

    Great Idea

    Please login or register to see this image.

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

    Great work. You can add here 73 more scripts.

    Point me at them then

    Please login or register to see this image.

    /emoticons/default_icon_razz.gif" alt=":-P" />

    Link to comment
    Share on other sites

    • 0
    Guest Lode

    +1 Great !!

    Please login or register to see this image.

    /emoticons/default_icon_biggrin.gif" alt=":-D" />

    Link to comment
    Share on other sites

    • 0
    Guest David R

    I see this hasn't been updated in a while? Anybody got any new scripts to add to?

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • I'm awaiting some Git pull requests from anybody who wants to paste in a new script to the library.

    Link to comment
    Share on other sites

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