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!



Smart Home Forum by FIBARO Team

Search the Community

Showing results for tags 'lua'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • 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


  • Scenes
  • Virtual Devices
  • Quick Apps
  • Icons

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start






Website URL





  1. Hi, I hope this is an acceptable post as I have spent a long time looking for the answer before posting. I want to create scenes using Lua, and have created a very simple one (swithcing on three lights) after watching a Youtube video. However, I feel I need a primer to learn the basics and set up my system with the necessary "starter variables" etc. I have looked in Fibaro knowledge base, Fibaro manuals and elsewhere on the internet, but not really found what I am looking for. Can anyone point me to a good resource? Thanks in advance.
  2. Hi, hope someone can help me. I´m new to LUA and programming in general and I am trying to get a simple (so I thought) scene to work. What I want to do: I have a lamp in my dining room which is connected to a fibaro rgbw controller. I have two (or maybe three) wall switches connected to fibaro dimmer 2 and fibaro double switch 2. The lamp and switches are working as they should. If I program them indepently, they control the lamp. Now I want to have them control the lamp together. So if either of the switches is set to "On", the lamp should switch On as well and vice versa. I have been fiddling around with several ideas but nothing works as intended. Right now I am trying 2 switches and 1 lamp, I might want to add another switch later, but that is not important now. Currently I am thinking that I need to change the value of the "other" switch to match the switch I used to control the lamp. Meaning I Turn Switch1 "On" and Lamp and Switch 2 are set to "On". The problem is, the state change of Switch 2 triggers the scene again. At least I think that is the problem. I cannot believe that I am the first or only one that wants to control 1 lamp with several switches. If someone has a working script for this, please share =) Regards, Jens
  3. How do i get the current set point of a heating panel zone via a lua scene? i tryed this i get a error --[[ %% properties %% events %% globals --]] local PanelID = 10 local panel, status = api.get("" ..PanelID) local currentTemp = panel.properties.currentTemperature fibaro:debug(currentTemp)
  4. Merry Christmas Hi, sometimes I get this Error message in a Lua scene: >>Cannot query interpreter state<< What does it mean??? I can't see any impact from it. Thanks for any input.
  5. A bit embarrassed to ask for advice on this, but I seem not to be able to understand the structure of simple IF-tests in HC2 Scenes, regardless whether these are created in the Block editor or LUA. I need an IF test with the following structure: ....IF ((a AND b) OR (a AND c)) THEN.... Due to the lack of parantheses, I am not able to understand the logical structure of the resulting statement, which in my mind seems confusing ...IF ((a AND b OR c AND b), I use this code to save electricity on my snow melting mats by twice a day testing whether weather conditions has recently set the variable SNOW to YES in which case mats are turned on for two hours (morning and afternoon) and the variable set back to NO. Seems now my mats turn on twice a day (at times "a" and "c") regardless of the the variable ("b"). Are there any "paranthesis" conventions in LUA I have not understood ?
  6. Guest

    function descriptions

    Hello! Sorry, but I'm looking for a complete LUA reference to control the Fibaro heat controller (and the other). Usually there is such an overview, so that one does not have to spend much time to program a control of the devices via try and error. Where did fibaro hide this? Please do not say that I can retrieve the functions in the LUA Editor module list - I know that. I am concerned with the description of the functions and their parameters. Thank you!
  7. Hi, It would be great to have a LUA function collection (maybe as a new Panel?) where we could store reusable functions, making them globally available. I'm doing a lot of custom automation and ended up having a collection of functions that get copy/pasted in scenes but as any developer would find, this is very error prone and makes maintenance extremely problematic. It would be great if we could create new functions as part of a collection namespace and have them available in all scenes. Any change to one of the functions would propagate to all usages. As a MVP for this feature, even a simple editor somewhere where we could drop all functions would be fine, as long as those functions are available in scenes. If there is a better way of currently achieving this, please let me know and close this topic. Much appreciated, Romeo
  8. Hi, Does anyone has a smart idea/code to get the device ID/Name of the device which triggered the alarm? Preferable a solution with flexible device detection, meaning, without the need to store the ID's in static tables in code. Thank you in advance!
  9. Hi, I am using HC-2 to configure all my Home Automation system. I have created Virtual device to control IR devices. As to show case Lable I need to code using Lua. Can any one tell me what's wrong with following Lua code. local hc = fibaro:getSelfId(); local ip = fibaro:getValue (hc, 'IPAddress'); local port = fibaro:getValue (hc,'TCPPort'); tcpSocket = Net.FTcpSocket (ip,port); fibaro:debug(hc); fibaro:debug(ip); fibaro:debug(port); tcpSocket:setReadTimeout(3000); tcpSocket:write("sendir,1:1,1,36337,1,1,95,33,16,16,16,16,16,32,16,32,32,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,32,16,16,32,16,16,16,4651\r"); tcpSocket:disconnect(); fibaro : call(hc, "setProperty", "ui.Label1.value","20°C"); For debugging purpose, I have used socket tester. On it, some time I am able to receive string, some time not. Some time socket connection remain open. Can any one help me. Is there any possibility to have problem with router? AC_Temp.vfib
  10. Good morning Dear, I want to start with the lua programming and I can not find a way to do it, especially to solve these 2 problems, which seem simple but I can not find the solution: 1- I tried with block scenes to light 2 exterior lights 15 minutes before sunset and turn off 5 minutes after sunrise. For this, create 2 scenes 1 to turn on the lights and others to turn them off. The shutdown scene works correctly and leave it in block mode. I have the problem in lighting the lights at night, the only way to turn it on is if I deactivate the scene and turn it on (I DO NOT KNOW WHY I HAVE IT AS AUTOMATED). Attached the scene of the shutdown is the same as the ignition, except that the ignition I put that if it is night and the lights are off then they turn on 2- The other scene is with the Door Windows to turn on the lights when they open, the problem is that when it remains open the door does not turn off the lights. For that create another scene that when it detects that the door is open more than 5 minutes to turn off the Light, the problem I had is that if it does not close it turns on and off every 5 minutes. Thank you very much! Best regards!!!
  11. Dear colleagues, does anybody know how to create scene in LUA for switching a heating panel to the manual mode?
  12. Hello guys! I come from a *nix background and would like to push changes to my LUA scripts to the HC2 without having to copy/paste into a web console. This also makes it a lot easier to have everything under source control. Has anyone taken the time to create scripts for this?
  13. Hi, I need an as complete list as possible of device actions that you may envoke in Lua that takes an additional argument. (That is, not "turnOn", because this is the entire command.) These are the ones that I have found in when going through my devices: "setValue" "setSetpointMode" "setThermostatSetpoint" (2 arguments) "setMode" "setFanMode" "setVolume" "setInterval" "setSlider" (2 arguments) "setProperty" (2 arguments) "pressButton" Have I missed some command? Please note that I need only Actions that a device can perform, not all calls you can make on a device to ask it about its state. Fredrik
  14. Community, I use a keypad with tags with a Fibaro binary senso to switch mij alarm on and off. Somebody made me a LUA script for that. When I present a tag the alarm will switch on or off. This is the script: --[[ %% properties 245 value %% weather %% events %% globals --]] local startSource = fibaro:getSourceTrigger(); -- 2 streepjes is commentaar fibaro:debug(fibaro:getGlobalValue("Alarmstatus")) if ( ( tonumber(fibaro:getValue(245, "value")) > 0 ) -- keypad activated and ( fibaro:getGlobalValue("Alarmstatus") == "uit" ) ) then fibaro:setGlobal("Alarmstatus", "aan"); elseif ( ( tonumber(fibaro:getValue(245, "value")) > 0 ) -- keypad activated and ( fibaro:getGlobalValue("Alarmstatus") == "aan" ) ) then fibaro:setGlobal("Alarmstatus", "uit"); end fibaro:debug( fibaro:getValue(245, "value")) fibaro:debug(fibaro:getGlobalValue("Alarmstatus")) fibaro:sleep(3500) fibaro:abort() My problem is that I get "too many instances". I guess I need to include the following line: "maxRunningInstances": 2, But I have no clue how and where. Is there anybody that could and would tell me how to do so? It would be highly appreciated!
  15. Hi All, I am using my fibaro motion sensor for multiple purposes. For one of them I need it to have a high sensitivity, however, for others I need it to have a lower sensitivity (otherwise it will trigger to early). Is it possible to change the PIR parameter setting using LUA in a scene? edit: same question for 'GPS location frequency refresh'. When I am close to home I want to update it more often to be more accurate. If I'm far away, it can update less frequent, to save battery on my phone. Thx!
  16. I am trying to figure out how to shutdown my mac when i enable ssh port 22 by means of using lua code? How to start with this?
  17. Hi, I`m novice in Fibaro and LUA I have some TCP device in my network transmits a txt data to custom TCP port on HC2 if some event happens (e.g. alarm) How I can always listen that TCP port on HC2 via LUA and start to a custom action in case the txt data appear on the port?
  18. Hi, When editing a scene in lua the screen is very small. So I got this script to add a fullscreen button to make it easier to read en edit my lua, you paste the code in my Developer Console and hit enter. But of course after a refresh the button is gone. var sheet = document.styleSheets[0]; sheet.insertRule(".CodeMirror-fullscreen { position: fixed !important; top: 31px; left: 0; right: 0; bottom: 0; height: auto !important; z-index: 9; }", 1); CodeMirror.defineOption("fullScreen", false, function (cm, val, old) { if (old == CodeMirror.Init) old = false; if (!old == !val) return; if (val) setFullscreen(cm); else setNormal(cm); }); function setFullscreen(cm) { var wrap = cm.getWrapperElement(); cm.state.fullScreenRestore = { scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset, width: wrap.style.width, height: wrap.style.height }; wrap.style.width = ""; wrap.style.height = "auto"; wrap.className += " CodeMirror-fullscreen"; document.documentElement.style.overflow = "hidden"; cm.refresh(); } function setNormal(cm) { var wrap = cm.getWrapperElement(); wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, ""); document.documentElement.style.overflow = ""; var info = cm.state.fullScreenRestore; wrap.style.width = info.width; wrap.style.height = info.height; window.scrollTo(info.scrollLeft, info.scrollTop); cm.refresh(); } jQuery('body').append(jQuery('<div/>', { html: "Fullscreen", "class": "Button1_1", "style": " position: absolute; right: 10px; bottom: 10px; z-index: 10;", click: function () { editor.setOption("fullScreen", !editor.getOption("fullScreen")); } })) Can you add the fullscreen add-on from CodeMirror to the editor (https://codemirror.net/doc/manual.html#addon_fullscreen)? I needed to add a button in stead of using the F11 because it wasn't working on my MacBook. Kind regards, Giedo
  19. Hi, I'm trying to access from Virtual Device web page which requires authentication. Unfortunately "setBasicAuthentication" does not work here. Can you please advise how to authenticate the access. Server IP: ''
  20. Hi, I currently use the script (Scene) below to turn off all lights when going to sleep. The problem is sometimes my adult children are still awake upstairs. How would I modify scene to turn off only downstairs lights? HC2 - Running latest version I thought of using the description field in devices and evaluating but can't work out the code. Help! --[[ %% properties %% events %% globals --]] local ids = fibaro:getDevicesId( { interfaces = { "light", }, properties = { dead = false, }, enabled = true, visible = true, -- optional --userDescription ~= "", -- attempt to evaluate if user description in device is not nil. } ); -- loop through light ids for i, id in ipairs(ids) do fibaro:debug("Turning off " .. fibaro:getName(id)); -- turn light off fibaro:call(id, "turnOff"); end Thanks Jason
  21. Guys, Problem, I have code below, however, change the value of Global variable "regenover" does not trigger the scene. I don't understand why not, someone able to help me out here ? --[[ %% globals regenover -]] local trigger = fibaro:getSourceTrigger() local regentijd = fibaro:getGlobalValue("regenover") if regentijd == "0" then fibaro:call(475, "turnOn") fibaro:call(782, "pressButton", "5"); elseif regentijd == "5" then fibaro:call(475, "turnOff") fibaro:call(782, "pressButton", "4"); elseif regentijd == "15" then fibaro:call(475, "turnOn") fibaro:call(782, "pressButton", "3"); elseif regentijd == "30" then fibaro:call(475, "turnOff") fibaro:call(782, "pressButton", "2"); end
  22. Hi All Following on from posts elsewhere about my issue I am convinced the problem lies with the block/lua conversion. However as a newbie I do not know enough to decipher the flow of the code. Primarily I need to understand how this scene is triggered when %%autostart is not used. I get that a manual start will set things going by the first 4 lines but how does the scene trigger otherwise? If someone could add some comments to the offending code below for me it would be most useful! --[[ %% properties 172 value %% weather %% events %% globals --]] local startSource = fibaro:getSourceTrigger(); if(startSource["type"] == "other") then fibaro:call(64, "turnOff"); fibaro:call(66, "turnOff"); else if (( tonumber(fibaro:getValue(172, "value")) == 0 )) then setTimeout(function() local delayedCheck0 = false; local tempDeviceState0, deviceLastModification0 = fibaro:get(172, "value"); if (( tonumber(fibaro:getValue(172, "value")) == 0 ) and (os.time() - deviceLastModification0) >= 200) then delayedCheck0 = true; end local startSource = fibaro:getSourceTrigger(); if ( ( delayedCheck0 == true ) or startSource["type"] == "other" ) then fibaro:call(64, "turnOff"); fibaro:call(66, "turnOff"); end end, 200000) end end
  23. Hello,every one! How to control air conditioning with Lua, I want to control the temperature in the scene, the mode of those.
  24. Hi, I had the requirement for a very simple scheduler. The code below is a stripped down version of @Sankotronic Main Scene code and just contains the Scene Scheduler. Thanks to @Sankotronic for his permission to post this. -- SIMPLE SCHEDULER. -- STRIPPED DOWN VERSION OF 'MAIN SCENE' CODE BY SANKOTRONIC --[[ %% autostart %% properties %% globals --]] if (fibaro:countScenes() > 1) then fibaro:abort(); end local jT = json.decode(fibaro:getGlobalValue("HomeTable")); -- comment out if you don't use a hometable local currenttime = os.date('*t'); local currentwday = currenttime['wday']; local TimeCurrent = os.date("%H:%M", os.time()); -- SCHEDULED SCENES SETUP -- (seperate multiple entries by comma) local runSceneSchedName = {"Test Scene 1", "Test Scene 2"}; -- Add scene names local runSceneSchedID = {641, jT.scene.Wakeup}; -- add scene ID's or references local runSceneSchedHour = {{"21:47"}, {"07:30"}}; -- Add times to run the scenes local runSceneSchedWeek = {{1, 1, 1, 1, 1, 1, 1}, {1, 1, 1, 1, 1, 1, 1}}; -- specify what day to run the scenes, Sunday is first day in array function doSceneSched() if #runSceneSchedID > 0 then for i = 1, #runSceneSchedID do if runSceneSchedWeek[i][currentwday] == 1 then for t = 1, #runSceneSchedHour[i] do if runSceneSchedHour[i][t] == TimeCurrent then fibaro:startScene(runSceneSchedID[i]); end end end end end end -- MAIN LOOP while true do currenttime = os.date('*t'); currentwday = currenttime['wday']; TimeCurrent = os.date("%H:%M", os.time()); doSceneSched(); fibaro:sleep(59700); end The full Main Scene code can be found at https://forum.fibaro.com/index.php?/topic/23510-scene-main-scene-for-time-based-events-control-v-125/ I thought this many be useful for some new users starting out or those like me that need a simple yet well written scheduler and may even be a stepping stone for some to the full Main Scene. -f
  25. This is feature request with low priority. So i will post it only on forum Better function of clipboarding from debug windows from VD debug window and LUA scene debug window. How it is now works: Succesfull clipboard: Hold left mouse button to select some debug lines and then ctrl+C for copy, while left mouse button is held down. Unsuccesfull clipboard: Hold left mouse button to select some debug lines, release mouse button and then ctrl+C for copy, while left mouse button is holded. What is requested: Hold left mouse button to select some debug lines, release mouse button and then ctrl+C for copy, while left mouse button is holded.
  • Create New...