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

Need Help on Wakeup Scene under 3.907


Question

Posted

This is the wakeup scene I learned from here.

--[[

%% properties

%% autostart

%% globals

--]]

local TotalDevices = 3000

while true do

local i = 1

local anydead = 0

while i < TotalDevices do

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

local name = fibaro:getName(i);

if status >= "1" then

fibaro:debug(i..' dead '..name);

fibaro:call(1, "wakeUpDeadDevice", i)

fibaro:sleep(5000)

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

if status >= "1"

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

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

end

end

i = i + 1

end

if anydead == 0

then fibaro:debug('There is no dead devices')

else fibaro:call(1, 'wakeUpAllDevices')

fibaro:call(2, 'sendEmail', 'Device dead , really', '..')

fibaro:debug('Wakeing up')

end

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

fibaro:sleep(60*60000)

end

After the upgrade to 3.907, it's not working saying that line 16 has error. According to Fibaro, "There is some problem with reading: local status = fibaro:getValue(i, ‘dead’);

if status >= “1” then should be == now;

mind that ‘dead’ gives values true and false now, not 1 or 0"

What to change to make it working?

7 answers to this question

Recommended Posts

  • 0
Posted

Please login or register to see this code.

beta 3.907 is type sensitive so on that line it will stop

check types - few hints

fibaro:getValue(i, 'dead'); - it will return bool (true, false)

so it should look

Please login or register to see this code.

or

Please login or register to see this code.

  • 0
  • Inquirer
  • Posted

    Socha,

    Is it something like this?

    --[[

    %% properties

    %% autostart

    %% globals

    --]]

    local TotalDevices = 3000

    while true do

    local i = 1

    local anydead = 0

    while i < TotalDevices do

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

    local name = fibaro:getName(i);

    if status ==now then

    fibaro:debug(i..' dead '..name);

    fibaro:call(1, "wakeUpDeadDevice", i)

    fibaro:sleep(5000)

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

    if status ==now

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

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

    end

    end

    i = i + 1

    end

    if anydead == 0

    then fibaro:debug('There is no dead devices')

    else fibaro:call(1, 'wakeUpAllDevices')

    fibaro:call(2, 'sendEmail', 'Device dead , really', '..')

    fibaro:debug('Wakeing up')

    end

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

    fibaro:sleep(60*60000)

    end

    • 0
    Posted

    ok, i was made some improvemnts for beta API

    but you should change method of sleep too for better work use setTimeout

    Please login or register to see this code.

    • 0
    Posted
    for better work use setTimeout

    So, how about actually giving us a proper changelog where changes in the API were documented?

    • 0
    Posted

    JanJoh, function setTimeout is a part of LUA , but yes we will soon publish new documentation for API

    • 0
    Posted

    JanJoh, try with

    Please login or register to see this code.

    Please login or register to see this image.

    /emoticons/default_icon_wink.gif" alt=";-)" />

    [ Added: 2014-09-10, 17:38 ]

    A.Socha, is blocking or asynchronous ?

    • 0
    Posted

    asynchronous

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