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

Scene to automatically wake up dead nodes


Question

Posted

Hi,

 

does anybody have an idea how to create a scene that automatically wakes up dead nodes?

 

I only found older LUA Scripts that do not work, like:

 
--[[
%% autostart
%% properties
%% globals
--]]
 
local sourceTrigger = fibaro:getSourceTrigger();
if (sourceTrigger["type"] == "autostart") then
while true do
 
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
( (tonumber(os.date("%H%M")) >= tonumber(string.format("%02d%02d", "07", "00")) and tonumber(os.date("%H%M")) <= tonumber(string.format("%02d%02d", "23", "00"))) and (math.floor(os.time()/60)-math.floor(1369026000/60))%2 == 0 )
)
then
 
local i = 1
local TotalDevices = 156 + 1
 
while i < TotalDevices do
 
local status = fibaro:getValue(i, 'dead');
 
if status == "1" then
fibaro:setGlobal('lastDeadNode', i);
-- fibaro:call(30, "pressButton", "6");
    fibaro:call(1, "wakeUpDeadDevice",i);
fibaro:debug("Try to wake up node "..i);
fibaro:call(68, "sendPush", "Try to wake up node "..i);
fibaro:sleep(5*1000);
local status = fibaro:getValue(i, 'dead');
if status == "1" then
    fibaro:debug("Device "..i.." still dead");
fibaro:call(68, "sendPush", "Device "..i.." still dead");
-- fibaro:call(30, "pressButton", "6");
-- fibaro:call(65, "sendDefinedPushNotification", "9");
        -- fibaro:call(2, "sendEmail", "DEAD "..i);
else
-- fibaro:call(30, "pressButton", "7");
fibaro:debug("Device "..i.." fixed");
fibaro:call(68, "sendPush", "Device "..i.." fixed");
end
else end
i = i + 1
end
end
 
fibaro:sleep(60*1000);
end
else
 
local currentDate = os.date("*t");
local startSource = fibaro:getSourceTrigger();
if (
startSource["type"] == "other"
)
then
fibaro:debug("send notification");
fibaro:call(68, "sendPush", "start check dead node");
local i = 1
local TotalDevices = 156 + 1
 
while i < TotalDevices do
 
local status = fibaro:getValue(i, 'dead');
 
if status == "1" then
fibaro:setGlobal('lastDeadNode', i);
-- fibaro:call(30, "pressButton", "6");
    fibaro:call(1, "wakeUpDeadDevice",i);
fibaro:debug("Try to wake up node "..i);
fibaro:call(68, "sendPush", "Try to wake up node "..i);
fibaro:sleep(5*1000);
local status = fibaro:getValue(i, 'dead');
if status == "1" then
    fibaro:debug("Device "..i.." still dead");
fibaro:call(68, "sendPush", "Device "..i.." still dead");
-- fibaro:call(30, "pressButton", "6");
-- fibaro:call(65, "sendDefinedPushNotification", "9");
        -- fibaro:call(2, "sendEmail", "DEAD "..i);
else
-- fibaro:call(30, "pressButton", "7");
fibaro:debug("Device "..i.." fixed");
fibaro:call(68, "sendPush", "Device "..i.." fixed");
end
else end
i = i + 1
end
 
end
 

 

end
 
Can anybody help?

Please login or register to see this image.

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

17 answers to this question

Recommended Posts

  • 0
Posted

I use the following and it seems to be working fine for me.. hope this helps..

 

--[[
 %% autostart
 %% globals
--]]
local debug = true;
local repeatTime = 15; -- in minutes
local maxemail = 5; -- max email to send, handy when the power is lost

local sourceTrigger = fibaro:getSourceTrigger();
if (sourceTrigger["type"] == "autostart") then

  -- check script instance count in memory
  if (fibaro:countScenes() > 1) then
    fibaro:debug("Script already running.");
    fibaro:abort();
  end

  fibaro:debug("HC2 start script at " .. os.date());

  local counter = 0;
  while true do
    local id, status, dtLog;
    local isDead = false;
    for id = 1, 500 do
      status = fibaro:getValue(id, 'dead');
      dtLog = os.date();
      if ( status == "1" ) then
        -- dead node found
        local name = fibaro:getName(id);
        local roomname = fibaro:getRoomNameByDeviceID(id);
        local message = dtLog .. ": Device (" .. name .. " ID#" .. id .. ", " .. roomname ..") is flagged as dead node."
        if debug then fibaro:debug(message) end
        -- try to wakeUp device
        fibaro:wakeUpDeadDevice(id);
        if ( counter <= tonumber(maxemail) ) then
          fibaro:call(2, "sendEmail", "Dead Nodes", message);
        end
        counter = counter + 1;
        fibaro:debug(counter);
        isDead = true;
      end
    end
---    if not isDead then fibaro:debug(os.date() .. ": No dead devices found."); end
    if not isDead then
      counter = 0;
    end
    fibaro:sleep(repeatTime*60*1000);
  end
else
  fibaro:debug("Script can only be run via autostart");
end

  • 0
  • Inquirer
  • Posted

    That was fast, thanks...

    Please login or register to see this image.

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

     

    One question do I have to enter the ids of the devices I want to check manually? If yes: where and do I have to enter the "node id" or the "id"?

    (I am not good at this LUA thing) 

    • 0
    Posted

    That was fast, thanks...

    Please login or register to see this image.

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

     

    One question do I have to enter the ids of the devices I want to check manually? If yes: where and do I have to enter the "node id" or the "id"?

    (I am not good at this LUA thing) 

    I believe mine does it for all ID's upto 500. I am not good at LUA either. This code was given to me by someone else.

    • 0
  • Inquirer
  • Posted

    Ah... I see. 

     

    It is running an telling me there are dead nodes left. But those that are marked as dead in the Webinterface still stay marked as dead after the script ran.

    And those (marked as dead) are not those from which the script tells they are still dead.

     

    Do you know what that means?

    • 0
    Posted

    Ah... I see. 

     

    It is running an telling me there are dead nodes left. But those that are marked as dead in the Webinterface still stay marked as dead after the script ran.

    And those (marked as dead) are not those from which the script tells they are still dead.

     

    Do you know what that means?

    Now that I am not too familiar with it.. What I do know is that since I have put this into place, I haven't encountered many dead nodes.. I get them time to time but that gets resolved over time..

    • 0
    Posted

    Hi,

     

    The script should be changed somewhat to let it work in V4.:

    Please login or register to see this code.

    If you  change the 500 in "for id = 1, 500 do" to a higher number it will process more devices.

     

    Also included the icon I use.

    Please login or register to see this attachment.

    • 0
    Posted

    Ah... I see. 

     

    It is running an telling me there are dead nodes left. But those that are marked as dead in the Webinterface still stay marked as dead after the script ran.

    And those (marked as dead) are not those from which the script tells they are still dead.

     

    Do you know what that means?

     

    The script will wakeup the main devices, these are hidden in the interface. But if a main device is dead the ones you will see that belongs to those main devices will also be dead.

    • 0
    Posted

    Many thanks for this.. I will update it on mine..

    Hi,

     

    The script should be changed somewhat to let it work in V4.:

    Please login or register to see this code.

    If you  change the 500 in "for id = 1, 500 do" to a higher number it will process more devices.

     

    Also included the icon I use.

    • 0
  • Inquirer
  • Posted

    Works perfect! Thanks to both of you

    Please login or register to see this image.

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

    • 0
  • Inquirer
  • Posted

    Since the newest update (4.056) the script does not seem to work anymore. Can somebody help?

    Please login or register to see this image.

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

    • 0
    Posted

    I don't understand why there would be a script necessary to wakeup dead nodes. Normally I don't have any dead nodes, but the last couple of days one of the Fibaro relay switches that switches the garden lights is dead in the morning. It is really annoying, because the garden lights remain on in the morning instead of being switched off by the Fibaro relay switch.

     

    I startup the Fibaro HC2 webpage, go to the dead node, click on it and turn of the lights manually. It working perfectly well.

     

    Why can't the HC2 wake up dead nodes by itself? The least it could do is to try to wake up dead nodes the moment the node is triggered by a scene or other.

     

    It seems the HC2 just isn't that smart. It cannot communicate with the node, so it marks it as dead and leaves it that way. Or am I wrong Fibaro? Could any Fibaro tech elaborate on what dead nodes are, why and when nodes are marked dead and if the HC2 does anything clever to prevent dead nodes from appearing and waking dead nodes up.

    • 0
    Posted

    Yeah, I noticed that this script no longer works. We had storm last night and multiple blakouts. Also some dead nodes that won't wake up automatically.

    • 0
    Posted

    any update on the above?

    • 0
    Posted

    Anyway something like this exists for HCL?

    • 0
    Guest
    Posted

    anyone tried this on HC3?

     

    seems like the below do not work..

     

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

    In HC2 and HCL I had some devices that lost connection to the home center. A couple of months ago I updated to HC3 because I hoped the lag would be gone. Unfortunatelly that is not the case, but also some devices loose their connetion to the HC3 and are reported DEAD. There is not a patern in type of device. It might have to do something with distance to the main HC3. On the other hand, with a lot of powered devices, I guess I have a good Z-wave mesh. By clicking, on the dead node in the dashboard on the PC, i am able to reconnect and controll/read the device again, but that is only for a short (variable) time. On my HC2 I ran the above "check dead nodes" scene and that automatically did the reconnection job.

     

    Did anybody manage to rewrite the code to LUA for HC3?

    • 0
    Posted
    23 minutes ago, l.waanders said:

    On the other hand, with a lot of powered devices, I guess I have a good Z-wave mesh

     

    Did you try to reconfigure the mesh on those devices who loses their connection.

    Their could also be some devices flooding your network with data, but the only way to find out is whit a Zniffer.

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