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


Search the Community

Showing results for tags 'fibaro:call'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • FIBARO Community
    • FIBARO Portal and Forum policy
    • FIBARO
    • Say hello!
    • Off-topics
  • FIBARO Update
    • FIBARO System Update
    • FIBARO Mobile Update
  • FIBARO Community Support
    • Scenes and Interface
    • FIBARO Products
    • FIBARO Mobile
    • FIBARO HomeKit
    • FIBARO Assistant Integrations
    • Other Devices / Third-party devices
    • Tutorials and Guides
    • Home Automation
    • Suggestions
  • FIBARO Społeczność
    • FIBARO
    • Przywitaj się!
    • Off-topic
  • FIBARO Aktualizacja
    • FIBARO System Aktualizacja
    • FIBARO Mobile Aktualizacja
  • FIBARO Wsparcie Społeczności
    • Sceny i Interfejs
    • FIBARO Urządzenia
    • FIBARO Mobilnie
    • FIBARO HomeKit
    • Integracja z Amazon Alexa i Google Home
    • Urządzenia Firm Trzecich
    • Poradniki
    • Automatyka Domowa
    • Sugestie

Categories

  • Scenes
  • Virtual Devices
  • Quick Apps
  • Icons

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Facebook


Google+


Skype


Website URL


WhatsApp


Country


Gateway/s


Interests

Found 3 results

  1. Version 1.0

    32 downloads

    First of all, this is not scene or script. Just a function to use in scripts to avoid unnecessary Zwave traffic. In many cases we send commands to devices without verifying the devices status, this function verifies device current status before sending command and in case the status of the device is not as required, command send. This function supports "turnOn" and "turnOff" commands for switches and dimmers. How to use? Copy this function to your script and change all fibaro:call(...) to fibaro_call(...). Just replace the colon " : " by underscore " _ " Function always returns Boolean variable true or false. Two options to use the function: fibaro_call ( devID, "trunOn" ) or fibaro_call ( devID, "turnOff" ) - verify device status and send "turnOn" if neccessary. fibaro_call ( devID, "?turnOn" ) or fibaro_call ( devID, "?turnOff" ) - checks device status only. Returns true or false according to status. No command sent. For example: Original scene which includes few scenarios of sending turnOff/turnOn . --[[ %% properties 823 value 792 value --]] local devID = fibaro:getSourceTrigger()["deviceID"] if devID == 823 then -- no status verification at all fibaro:call(540,"turnOff") end if devID == 792 then -- including verification if tonumber(fibaro:getValue(540,"value"))==0 then fibaro:call(540,"turnOn") end end if tonumber(fibaro:getValue(540,"value"))==1 then -- checkin device status fibaro:setGlobal("test","lightOn") else fibaro:setGlobal("test","lightOff") end Now we add the function --[[ %% properties 823 value 792 value --]] function fibaro_call(devId,param) local fStatus,act=true,{["turnOn"]=1,["turnOff"]=0,["?turnOn"]=1,["?turnOff"]=0} if not act[param] then fibaro:debug("fibaro_call.lua:\'<font color=firebrick><font size=2> "..param.." </font></font>\' not supported."); return false end if math.min(1,tonumber(fibaro:getValue(devId,"value"))) ~= act[param] then fStatus=false end if param:find("?") then return fStatus end if not fStatus then fibaro:call(devId,param);fStatus=true end return fStatus end local devID = fibaro:getSourceTrigger()["deviceID"] if devID == 823 then --verification done by fibaro_call() fibaro_call(540,"turnOff") end if devID == 792 then -- no need extra lines for verification fibaro_call(540,"turnOn") end if fibaro_call(540,"?turnOn") then -- checking device status by fibaro_call(). fibaro:setGlobal("test","lightOn") else fibaro:setGlobal("test","lightOff") end That's all. Please use this function as a template and change it according to your needs. In order to observe how much your Zwave traffic is loaded by repeated commands, please download Zwave monitor version 3.0
  2. Hi, I am wondering about the properties of a Virtual Device and how they can be accessed and changed. For instance, if you want to change the icon of a VD you can use a statement like this: fibaro:call(100, "setProperty", "currentIcon", 200); If you want to update a label text you would do: fibaro:call(100, "setProperty", "ui.label1.value", "Label text" ); To my question then: Does anyone know of a complete list of properties applicable to a Virtual Device? For instance: devices which report power consumption use the footer area to display current power usage. Can this area be accessed in a VD too? Someting along the lines of: fibaro:call(100, "setProperty", "ui.footer.value", "Footer text" ); I am reading in Fibaro's documentation of the REST API about how to extract a list of all VDs and their properties/data. There are apparently properties like "caption", and "buttonIcon". The question is if and how these can be set via LUA code. Thanks for any tips and hints. /Per
  3. Hi everyone. I have few devices that don't react properly to simple "turnOn", "turnOff" actions. Might be Z-wave unresponsive at that time or RF interference or they're too far away from controller or they'e dead. Anyhow when executing fibaro:call(devID,"turnOn") the device doesn't always turning ON (same case for OFF). This phenomena very frustrating especially on predefined events that don't act as expected ( like turn on Fan in bathroom when humidity high, close garage if no presence detected at home, turn on/off water heater according to temperature and etc.) Attached scene code is verifying that the device is not dead, command transferred to device and device has changed the state. In case of problem email sent to notify about problem. In addition I have found that this scene is very efficient to identify unresponsive Z-wave situation and I'm using this scene to turn on/off some device every hour just to see if Z-wave is OK. Some basic instructions: 1. Create new LUA scene and copy attached code in it. 2. Scene call syntax: fibaro:startScene(sceneID, {devID, "turnOn"}) - same parameters as original fibaro:call() That's all for basic. In addition there are two options: 1. If you have device that you want to be notify by email at any time that the device state has been changed (in my case garage gate and water heater), please add third Boolean parameter: fibaro:startScene(sceneID, {devID, "turnOn", true}). You will receive an email one every state change of the device. Could be changed into push notification. 2. If you need to receive scene status of the action or debug information, please follow next instructions: Add "predefined global variable" by name jCall. In order to receive correct response you need to make sure that the scene is executed before that, so the suggested scene call is: fibaro:startScene(sceneID,{devID,"turnOff"}) x=os.time(); while (fibaro:countScenes(sceneID)>0 and os.time() - x < 10) do end jFc = json.decode(fibaro:getGlobalValue("jCall")) fibaro:debug(jFc.resp) -- print debug information if (jFc.status == 1) then -- success - write your code else -- action failed write your code end Note: In case the device already at the same state, email sent to notify that the device state is the same and no action performed. Scene Code below and attachment FibaroCall.rtf local jK,jC = {"device","act", "sEmail"} , {device = -1, act = "noAct", sEmail=false} for i, v in ipairs(fibaro:args(1)) do jC[jK[i]] = v end local actState = {"OFF", "ON", "turnOff" , "turnOn"} local sceneStart = os.time() local log, mLine = "", "————————————————————————————" local mStr = fibaro:getRoomNameByDeviceID(jC.device) ..":" .. fibaro:getName(jC.device) local iVal, iValTime = fibaro:getValue(jC.device, "value"), os.time() - fibaro:getModificationTime(jC.device,"value") local jF = {status=-1,resp="in scene"} if (actState[iVal+3] == jC.act ) then jF.status=1 jF.resp = "<font color=lightblue><sub>" .. fibaro:countScenes() .."</font></sub><font color=yellowgreen>" .. jC.device..":</font><font color=wheat>" .. mStr .. " <font color=lightgreen> [ Device state: " .. actState[iVal+1] .. " | Action: " .. jC.act .. " ] </font><font color=lightblue>-> No actions</font><span style=text-align:center>" if (jC.sEmail == true ) then fibaro:call(2, "sendEmail",fibaro:getName(jC.device) .. ":" .. jC.act , "{ " .. mStr .. " } device at same state as requested:\n" .. mLine .. "\n\t\tDevice state: " .. actState[iVal+1] .. "\n\t\tAction: " .. jC.act .. "\n" .. mLine .. "\n\n☛ Fail-safe Call (•‿•) " ) jF.resp = jF.resp .. " <small>(eMail sent)</small>" end fibaro:debug(jF.resp) if (fibaro:getGlobalValue("jCall")) then fibaro:setGlobal("jCall",json.encode(jF)) end fibaro:abort() end for i=1,3 do fibaro:call(jC.device, jC.act) x = os.time(); while (log == "" and (os.time() - x) < 10) do fibaro:sleep(150) -- time to update log (status) log = fibaro:getValue(jC.device, "log") end fibaro:sleep(350) if (log == "" ) then log="Transfer_was_Blank" end jF.resp = "<font color=lightblue><sub>" .. fibaro:countScenes() .. "</font></sub><font color=grey><sup>" .. i .. "</sup></font><font color=yellowgreen>" .. jC.device..":</font><font color=wheat>" .. mStr .. " <font color=lightgreen> [Action: " .. jC.act .. "] [State: " .. iVal .. ">" .. fibaro:getValue(jC.device, "value") .."]</font> [<small>" .. log .. "</small>]</font>" if (string.find(log,"Transfer_was_") == nil) then if (log == "SEND_COMMAND_TO_DEAD_DEVICE") then jF.resp = jF.resp .. "<br><font color=orangered>Trying " .. jC.act .. " on DEAD device [ " .. mStr .. " ]</font>" fibaro:call(1, 'wakeUpAllDevices',jC.device) end elseif (iVal == fibaro:getValue(jC.device, "value") ) then else jF.status = 1 break end fibaro:debug("<font color=yellowgreen>" .. jC.device.."</font> " .. jF.resp .. " <font color=orangered><small>FAILED</font>" .. "<small> Retry in " .. (.5*i) .. " Sec.</small>") fibaro:sleep(500*i) end -- for i=1,3 do if (jF.status == 0) then jF.resp = "<font color=orangered>Z-Error: </font>" .. jF.resp .. " <small>(eMail sent)</small>" fibaro:call(2, "sendEmail","Z-Error:" .. fibaro:getName(jC.device), "\n{ " .. mStr .. " } does not respond properly!\n" .. mLine .. "\n\t" .. jC.device .. ":" .. fibaro:getName(jC.device) .. " [ " .. actState[iVal+1] .. " > " .. actState[tonumber(fibaro:getValue(jC.device, "value"))+1] .. " ] [ " .. log .. " ]\n\t" .. actState[iVal+1] .. " state duration = " .. os.date("!%H:%M:%S",iValTime) .. " Sec.\n" .. mLine .. "\n\n☛ Fail-safe Call ( ◉︵◉ )") elseif (jC.sEmail == true ) then fibaro:call(2, "sendEmail",fibaro:getName(jC.device).. ":" .. jC.act , "\n{ " .. mStr .. " } device state has been successfully changed.\n" .. mLine .. "\n\t" .. jC.device .. ":" .. fibaro:getName(jC.device) .. " [ " .. actState[iVal+1] .. " > " .. actState[tonumber(fibaro:getValue(jC.device, "value"))+1] .. " : " .. log .. " ]\n\t" .. actState[iVal+1] .. " state duration = " .. os.date("!%H:%M:%S",iValTime) .. " Sec.\n" .. mLine .. "\n\n☛ Fail-safe Call (•‿•) ") jF.resp = jF.resp .. " <small>(eMail sent)</small>" end --if (status == 0) fibaro:debug(jF.resp .. "<small> in " .. os.time() - sceneStart .. " sec. </small><span style=text-align:center>") if (fibaro:getGlobalValue("jCall")) then fibaro:setGlobal("jCall",json.encode(jF)) end
×
×
  • Create New...