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, When building LUA scenes it would be great to have my own utility functions library at hand - not to replicate code, but be able to reuse the code. Like having a global function that does something to strings, or other type conversions. Any idea how to put this (rather obvious for programmers) idea to work on HC2? P.
  2. Good Morning Guys, I need to create a Virtual Device in order to enable/disable some functionality of my devices. Shortly in need to extract the XML, modify a tag value, re-upload the xml. I have understood that using "Net.FHttp" and GET/PUT command im able to RETRIEVE and PUT the XML.... Example: response,status,errorcode = device:GET('URL') Example: response,status,errorcode = device:PUT('URL',XML) But how the entire process can be writed in LUA? 1) How to store in a variable the entire XML extracted using teh GET command? 2) How to replace the xml tag parameter ? ex. from enable to disable 3) How to re-upload the modified XML? Thanks in advnace Regards Gianluca
  3. I have two Fibaro sensor on my drive one at each end. i am trying to make a scene that says if sensor a is trigged first and then sensor b is trigged turn on lights but if sensor b is trigged first and then sensor a is trigged don't turn on lights not sure how to right it in Lua code
  4. Hi, I have recently introduced myself into fibaro lua scenes world, I installed a door/window sensor, it works perfectly but the scene I made keeps the light on all day, without caring about the hour, sunrise, or sunset, so i wanna modified that. I wrote a Lua code for trying to solve this problem, but i don't know if this would work i can't find out the right property, Do I have to send the sensor sleep (when i don't want the lights to turn on during the day) and wake up (during the night)? sensor_puerta= id_device while true do --current_time=os.time() --tcurrent_time=os.date("%t",current_time) tcurrent_time=os.date("%t") c_hour=tcurrent_time.hour c_min=tcurrent_time.min --system hour s_hour= 18 s_min=30 --setting hour for tunning on if ((c_hour < s_hour) and (c_min < s_min)) then fibaro: call(sensor_puerta, "sleep"); --fibaro: call(sensor_puerta, "turn off"); --confirmar parametro else fibaro: call(sensor_puerta, "wake up"); --confirmar parametro end end
  5. I have used several block scenes to set a weekday variable and also not been able to set the month variable. Have now tried to create a LUA code, that will set my 2 variables with only one scene, but it does not work. Could someone let me know what I am doing wrong please? (This is my first attempt on a LUA written scene) --[[ %% autostart %% properties %% weather %% events %% globals --]] local dag = os.date("%w"); local mnd = os.date("%m"); if(dag == 0) then; fibaro:setGlobal("Ukedag", "Søndag"); elseif(dag == 1) then; fibaro:setGlobal("Ukedag", "Mandag"); elseif(dag == 2) then; fibaro:setGlobal("Ukedag", "Tirsdag"); elseif(dag == 3) then; fibaro:setGlobal("Ukedag", "Onsdag"); elseif(dag == 4) then; fibaro:setGlobal("Ukedag", "Torsdag"); elseif(dag == 5) then; fibaro:setGlobal("Ukedag", "Fredag"); elseif(dag == 6) then; fibaro:setGlobal("Ukedag", "Lørdag"); end; if(mnd == 1) then; fibaro:setGlobal("Maaned", "Januar"); elseif(mnd == 2) then; fibaro:setGlobal("Maaned", "Februar"); elseif(mnd == 3) then; fibaro:setGlobal("Maaned", "Mars"); elseif(mnd == 4) then; fibaro:setGlobal("Maaned", "April"); elseif(mnd == 5) then; fibaro:setGlobal("Maaned", "Mai"); elseif(mnd == 6) then; fibaro:setGlobal("Maaned", "Juni"); elseif(mnd == 7) then; fibaro:setGlobal("Maaned", "Juli"); elseif(mnd == 8) then; fibaro:setGlobal("Maaned", "August"); elseif(mnd == 9) then; fibaro:setGlobal("Maaned", "September"); elseif(mnd == 10) then; fibaro:setGlobal("Maaned", "Oktober"); elseif(mnd == 11) then; fibaro:setGlobal("Maaned", "November"); elseif(mnd == 12) then; fibaro:setGlobal("Maaned", "Desember"); end; The variables that are set:
  6. Hello, 1) Does somebody know what the size limit is for the 'message' variable in Lua sendEmail fibaro:call (2, "sendEmail", subject, message) I am sending automatic generated log files to my email but sometimes i receive nothing, after decreasing the number of lines i receive the mail. 2) And can Fibaro Lua return a error (number or text) in a variable using this sendEmail command? Thanks!
  7. Hello, Is it posible to send text to a cell in a Google spreadsheet from Fibaro Lua? My central heating is a zone-heating controlled bij a Fibaro HC2 with zwave Secure thermostats in every room in my house. The heating works by a central gas boiler and electric Heimeier valves with Fibaro relais I like to log the on/off times (then i can calculate the heating minutes per day) so that i can show it in a graph according to the room temperature and outside temperature. With this information i can make my heating even smarter, i can automatically calculate the starting time to heat in the morning depending on the room and outside temperature to reach a certain temp at 9:00 If sending text to a external document is possible it can be used for a lot of other things: - Temperature logs (pir/smoke sensor) - Room usage (pir) - Usage of devices (koffeemachine, radio, tv, computer, lights, .....) - Graphical views - ......
  8. Hello Forum, Relatively new to the HC2 I am struggling a bit with getting my head around all the undocumented functions and features in the HC2. Would anyone know more about the ones I am mentioning below, which are nowhere mentioned in Fibaro's documentation. The "Net" library Net.FHttp function Has a method called GET which requires some parameters. Which ones? How about POST, PUT and DELETE methods? Do they exist and if so which parameters do they take? Net.FTcpSocket function I came across a reference to this function in a post on this forum but I don't know how it works. The "api" library api.get, api.put, api.post functions Takes a local path as parameter so I am guessing this is a special implementation of the Net.FHttp function so one does not have to use the full URL for get/post/put etc. api.get("/icons") for instance gives all icons according to Fibaro's REST-interface definition Is there an api.delete function as well? Googling the above does not give any indication that these libraries are generic LUA libraries so my conclusion is that they must be Fibaro-specific. But I could be wrong of course. Storing tables in global variables I came across this VD (by Sankotronic) on the forum that helps you browse the icon library: Looking through the code I found this very interesting concept of storing an entire data structure in a global variable. Check out the main loop in the VD. Very clever indeed! The question then, which are the principles behind this very convenient way to handle variables? I mean, the standard functionality can only handle numbers and predefined values, not strings or collections of data. Thanks! Per
  9. I have a scene that is suppposed to check a variable called "Snow" at Monday through Friday at 5 am and 3 pm and weekends at 7 pm and 3 pm. If Snow = "Yes", a scene is activated, turning on my outdoors heating mats for 2 hours (and at the same time resetting Snow = "No"). My thinking is to limit the use of expensive snow melting electricity to max 2 + 2 = 4 hours / 24 hours The problem with the code below is that the scene triggers with variable Snow = "Yes" also outside the stated hours. What is it I am not getting right here ? I thought the AND operator had hierarchial priority over OR and that the code below would turn on the heater if the variable Snow = "Yes" AND the time is 5 am or 3 pm on weekdays or 7 am and 3 pm in weekends. But it seem to trigger whenever the variable Snow = "Yes", also outside these hours. Help will be highly appreciated! (Scene 51 is the scene actually turning on the heating mats for two hours): Best regards Jo --[[ %% autostart %% properties %% weather %% events %% globals Snow --]] local sourceTrigger = fibaro:getSourceTrigger(); function tempFunc() local currentDate = os.date("*t"); local startSource = fibaro:getSourceTrigger(); if ( ( ((currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "05:00") ) and ( fibaro:getGlobalValue("Snow") == "Yes" ) or ( ((currentDate.wday == 1 or currentDate.wday == 2 or currentDate.wday == 3 or currentDate.wday == 4 or currentDate.wday == 5 or currentDate.wday == 6 or currentDate.wday == 7) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "15:00") ) and ( fibaro:getGlobalValue("Snow") == "Yes" ) or ( ((currentDate.wday == 1 or currentDate.wday == 7) and string.format("%02d", currentDate.hour) .. ":" .. string.format("%02d", currentDate.min) == "07:00") ) and ( fibaro:getGlobalValue("Snow") == "Yes" ) ) then fibaro:setGlobal("Snow", "No"); fibaro:startScene(51); end
  10. Hi, I think there is an issue with PIN protected scenes that are triggered from LUA configured popup or interactive push notifications. Scenes that should be PIN protected run straightforward when triggered from "YES" button on such notifications. Here are tutorials for setting such notifications up - courtesy of @Sankotronic: - popup notifications: - interactive push: Best regards, Andrzej
  11. I bought this ETH008 relay card which you can controll with https commands. Im both new to programming and lua.. now when I send a string to this IP card, I can see the relay will switch, but when I send the command trough a new created virtual device, it wont work... Can someone help me along the way to set this up : IP adress of the card is port 17494 user : user password : password http string to switch on relay #2 for 5 seconds is : what and how do I set this up within a virtual device ?
  12. 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.
  13. 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
  14. 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)
  15. 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.
  16. 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 ?
  17. 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!
  18. 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
  19. 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!
  20. 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
  21. 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!!!
  22. Dear colleagues, does anybody know how to create scene in LUA for switching a heating panel to the manual mode?
  23. 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?
  24. 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
  25. 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!
  • Create New...