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

  • 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

  1. Witam, jak w LUA sprawdzić czy zostało wysłane powiadomienie o zwarciu na wyjściu Dimmera2? już dwa razy ukradli mi "na żywca" lampy ogrodowe i chciałbym móc wykorzystać to powiadomienie do wywołania alarmu z góry dzięki RB
  2. Hi, I´m writing a couple of VERY SIMPLE LUA Scenes that I have linked to Double Click action of a double switch 2. The scene often works fine, but sometimes, some the turnon or turnoff actions are not executed. (by instance, instead of turning off the 3 lights, only 2 are turnned off, or maybe the vent turnon fails...) Also tried added sleep between commands but the result is the same. Any idea? This is quite frustrating... When I run the scen from the debuger interface, it seems that it works properly... As stated, the code is very simple: (Turn off lights, turn on vent, wait 7 minutes and turn off vent (except if the light were turned on again while the vent is on) fibaro:call(88, "turnOff"); --light off 1 fibaro:sleep(100); fibaro:call(93, "turnOff"); --light off 2 fibaro:sleep(100); fibaro:call(94, "turnOff"); --light off 3 fibaro:sleep(100); fibaro:call(89, "turnOn"); --this is the vent fibaro:sleep(420000); -- wait 7 minutes local bathLightStatus = 0; bathLightStatus = bathLightStatus + fibaro:getValue(88, 'value'); bathLightStatus = bathLightStatus + fibaro:getValue(93, 'value'); bathLightStatus = bathLightStatus + fibaro:getValue(94, 'value'); -- fibaro:debug('Number of bath lights on: ' .. bathLightStatus); if ( bathLightStatus == 0) then -- fanStatus = fibaro:getValue(89, 'value'); -- fibaro:debug('Fan Status ' .. fanStatus); fibaro:call(89, "turnOff"); -- fibaro:sleep(1000); -- fanStatus = fibaro:getValue(89, 'value'); -- fibaro:debug('Fan Status after off ' .. fanStatus); end
  3. I try to get some data from a http:request in a LUA scene. I have the following code: local strLonoID = fibaro:getGlobalValue ("LonoID"); print ("LonoID = ", strLonoID) local Temp1 = fibaro:getGlobalValue ("LonoTemp1"); print ("LonoTemp1 = ", Temp1) local http = net.HTTPClient() http:request('http://lonobox.com/api/index.php?id=100003523', { success = function(current) --fibaro:debug(json.encode(current)) --werkt if current.status == 200 then print('Data Receiving: ', current.status) -- werkt print('CurrentData: ', current.data) -- werkt local result = json.decode(current.data) print ('Result :', result) --Local temp2 = result.(["CurrentData"]["200003523"]["temperature"]) --local temp2 = result.200003523.temperature --print ('Temp2 :', temp2) -- else fibaro:debug(current.status) end end }) and i have as output: [DEBUG] 17:13:32: LonoID = 100003523 [DEBUG] 17:13:32: LonoTemp1 = 2 [DEBUG] 17:13:32: Data Receiving: 200 [DEBUG] 17:13:32: CurrentData: [[],{"200003523":{"temperature":"23.2","humidity":"46"}},{"400004105":{"wind-speed":"0.2","wind-gust":"1.5","wind-direction":"SE"}},{"100003523":{"barometer":"1014"}}] [DEBUG] 17:13:32: Result : table: 0x9c98200 I want to store the values in global variables. I do not know how to proceed from here. Thx in advance. Fons
  4. Version 1.0.0

    110 downloads

    Virtual device for control of Daikin air conditioners with the SKYFi addon. (untested)
  5. Hi I have recently reconfigured my system, now a big part of my devices got other functions. Everything works well, beside one switch. There is one device, which turning off on random time of the day. I'm considering that I have a scene running, where I forgot to change device id after changes on the system, but I cannot find it. Everything looks fine. Question is: Is there any option to find out, which scene or system process is triggering action on the specific device?
  6. Hi, Planning on setting up Qubino 0-10v dimmers with the Fibaro HC2. Does anyone know if these can be used in Lua scenes like the scene activation functionality in the Fibaro Dimmer 2? Thanks
  7. Hi all, I try to build a smart alarm system. I installed on entrance on a apartment a motion sensor. People sometimes pass outside apartment that can cause a false alarm. I like to ask from experts if you can build a basic sence that can count 1 minute after the first trigger and if there is activity/motion to sound alarm. As it is common burglars for security doors need from 30 sec to 5 min to open this kind of doors, in my opinion if someone will stay outside to my door, will not do that for a good reason. I believe that fibaro can give the flexibility that no other alarm system can provide.
  8. Hello All, As I try to build a presence detection with BLE, I like to ask if there is a way to poll GPS coordinates of a user by request, overriding the pre-configured time frame. When user is detected from BLE inside range to stop polling and when user is out of BLE range to get a specific time frame for GPS Polling, according to period of day. Any help?
  9. hi, This tutorial is based on an idea that i believe originated to @cag014 some time back and has been adopted by many. So well deserved kudos to @cag014 and others that helped originate and develop the concept. I am merely a scribe that has benefited from this. I decided to write a quick tutorial for two reasons... I implemented this over christmas and and found it very useful and much easier than I thought It would appear that we have some new forum members that got HC2 devices from Santa The core of this approach is to store all the reference ID's to your devices, virtual devices, scenes, etc in a json encoded table. The references like jT.kitchen.light are used in the scene or vd and device ID can easily be changed in the table. One important benefit is that it you need to exclude/include a device the device ID will change. With this approach you simple change the reference in the Home table and your done. Without this approach you wll need to go through your code and change the device ID where appropriate. ** This doesn't get over the need to enter ID as triggers in the scene headers as fibaro doesn't allow variable in the header ** The solution has two parts to it. The home table itself where the data is stored. - this is held in a predefined variable (lower part of variables panel) The references in your scenes and virtual devices use this table HOME TABLE This can be created and maintained through either a scene or a virtual device. I chose a VD but there is no advantage I can thing of using one way or the other. Go to Panel, Variables Panel and create a new predefined variable (lower part of panel) called HomeTable. When you create a predefined variable it has two values. Name the variable and save. Edit the variable and simply delete the second value. Using either a scene or a vd create your table and store it. This is lua from my VD. I create one button and enter the code below. The top part shows the format of the table. I opted to place each element I am looking to store into rooms and/or other natural groupings but you can choose any way to structure. I'll attached a copy of my full table at the end of this to show what I use it for. The next part encodes and stores the data The last part is where I read back one entry to show the table stored okay. -- HOME TABLE FOR ALL DEVICES, SCENES ETC. jsonHome = { hall = { Lights=88,Lamp=1421,Temp=1,Motion=1,Humidity=1,Lux=1,ZRC90=1447,SmallBathLight=147,SmallBathMotion=1, SmallBathTemp=1,SmallBathLux=1,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, kitchen = { Pendant=176,Table=174,Spotlights=90,Temp=1549,Motion=1548,Humidity=1551,Lux=1550,UV=1552,XmasLight=1531, WineFridgeTemp=1,Dishwasher=1,rcTV=1490,rcSonos=1561,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, } jHomeTable = json.encode(jsonHome) -- ENCODES THE DATA IN JSON FORMAT BEFORE STORING fibaro:setGlobal("HomeTable", jHomeTable) -- THIS STORES THE DATA IN THE VARIABLE fibaro:debug("global jTable created") -- STANDARD DEBUG LINE TO DISPLAY A MESSAGE -- I then like to read back a entry from the table to show that the table didnt get corrupt in the process. local jT = json.decode(fibaro:getGlobalValue("HomeTable")) -- REFERENCE TO DECODE TABLE fibaro:debug(jT.kitchen.Motion) -- DISPLAY ONE VARIALE the output of this when I click the button (or run the scene is as follows) It is reading back the ID (1548) stored for Motion under the kitchen grouping I would recommend using an external editor like Notepad++ or Zerobrane to edit/manage the code in the vd and then copy back to the vd when ready to update as the HC2 lua editor is very small At this stage you now have your table REFERENCING THE TABLE CONTENTS IN YOUR SCENES AND VIRTUAL DEVICES For this you need to place the following line of code in each scene or vd local jT = json.decode(fibaro:getGlobalValue("HomeTable")) and then use references instead of device ID's in the scene code. The easiest way to explain this is with an example. This scene switches on a light in my kitchen if it is dark, motion is detected and no light is on already --[[ %% properties 1548 value %% events %% global --]] local jT = json.decode(fibaro:getGlobalValue("HomeTable")) -- KITCHEN AUTOLIGHTS if (tonumber(fibaro:getGlobalValue("Darkness")) == 1 ) and (tonumber(fibaro:getValue(jT.kitchen.Motion, "value")) > 0 ) and (tonumber(fibaro:getValue(jT.kitchen.Spotlights, "value")) == 0 ) and (tonumber(fibaro:getValue(jT.kitchen.Pendant, "value")) == 0 ) and (tonumber(fibaro:getValue(jT.kitchen.Table, "value")) == 0 ) and (tonumber(fibaro:getValue(jT.sunroom.Light, "value")) == 0 ) and (tonumber(fibaro:getValue(jT.sunroom.Lamp, "value")) == 0 ) then fibaro:call(jT.kitchen.Pendant, "setValue", "40") UpdateEventLog("kitchen lights auto on") end It's easy enough to see how the references are built up if you examine the scene v the table at the top of this post and that it !! Addition: If you need to adjust a single parameter in the table you can use the following. This can be useful if you don't want to adjust one value and then copy the whole table back into the vd and update or more useful if you want to adjust the value in the fly in a script. -- NEW PARAMETER VALUE jT.kitchen.Motion=2000 -- TO SAVE THE CHANGE jSonosTable = json.encode(jT) fibaro:setGlobal("SonosTable", jSonosTable) fibaro:debug("global jTable created") Hopefully this will help some users If you have any suggestions as to how to improve this please let me know and I'll edit -frank ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Copy of my table to show how flexible this approach can be jsonHome = { system = { Sunset_SunRise=1560,houseStatus=1507,alarmStatus=881,HouseTemps=1236,sonosSummary=1407,sonosTTS=1452, sonosSequences=1536,TVSequences=1545,lightingSequences=1534,powerConsump=1484,specialHouseMode=1538 }, hall = { Lights=88,Lamp=1421,Temp=1,Motion=1,Humidity=1,Lux=1,ZRC90=1447,SmallBathLight=147,SmallBathMotion=1, SmallBathTemp=1,SmallBathLux=1,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, playroom = { Light=84,TVLight=1438,XmasLight=1518,Motion=1595,Temp=1596,rcPlayroomTV=1487,rcSonos=1574,Lux=1597,Humidity=1598,UV=1598,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, living_room = { Light=231,libraryLight=164,libraryTopSocket=166,Temp=1584,Lamp=1423,Lux=1585,Motion=1583,Humidity=1,UV=1,TVLight=1499,XmasLight=1513,rcSonos=1,rcLivingRoomTV=1506,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, utility_room = { Light=141,Temp=1194,Motion=1270,Humidity=1,Lux=1,UV=1,FreezerTemp=1,Washer=1,Dryer=1 }, equipment_rack = { RackSummary=1453,Rack1Temp=1192,Rack2Temp=1193,fanUpper1=1432,fanLower2=1434,powerAmpLower=1269, powerAmpUpper=1267,heatingFlowTemp=1199,rcSatBox=1491,SatBoxPresets=1492,rcHdmiMatrix=1489,rcAppleTV=1539, rcAppleTvSystem=1540,rcBluRay=1544,rcDroidBox=1541,networkMonitor=1493,avDeviceMonitor=1494,haDeviceMonitor=1495,hc2Resources=1391 }, kitchen = { Pendant=176,Table=174,Spotlights=90,Temp=1549,Motion=1548,Humidity=1551,Lux=1550,UV=1552,XmasLight=1531, WineFridgeTemp=1,Dishwasher=1,rcTV=1490,rcSonos=1561,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, sunroom = { Light=172,Lamp=6,projectionScreenPower=1509,rcProjector=1542,rcProjectorScreen=1543 }, dining_room = { Light=25,Lamp=1,Motion=1,Temp=1202,Lux=1,Humidity=1,rcSonos=1,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, pizza_bbq_area = { CenterLights=253,Spotlight=710,Lanterns=712,HeaterSwitch=255,LEDLights=238,Motion=705,Heaters=250,Temp=1,Lux=1, Humidity=1,rcSonos=1,PizzaBbqCam=761,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, garage = { Light=895,BenchLight=1,DoorOpener=80,DoorStatus=778,Temp=1578,Humidity=1590,Lux=1589,Motion=1587,UV=1591, GarageControl=1559,rcSonos=1,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, driveway = { porchLight=68,pillarLights=145,Spotlight=893,Motion=1429,GateTemp=958,GateOpener=94,GateStatus=956,GateControl=1537,DrivewayCam=1556,FrontDoorCam=1557 }, back_garden = { patioLight=64,utilityLight=76,sidePatioLights=60,boundaryLights=62,Spotlight=58,Motion=1427,Humidity=218,Lux=217,Temp=958,XmasLight=1523,BackGardenCam=1558 }, hotpress = { Light=143,DoorStatus=888,Temp=890 }, bathroom = { Light=162,MirrorLight=1468,MirrorDemist=1470,Temp=1170,Humidity=1,Motion=1 }, guest_bedroom = { Light=31,Lamp=718,Temp=1588,Motion=1587,Lux=1589,Humidity=1590,UV=1591,BathLight=1,BathTemp=1,BathMotion=1,BathHumidity=1,BathFan=1,BathMirrorLight=1460,BathMirrorDemist=1462,rcSonos=1,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, master_bedroom = { Light=56,LampDad=29,LampMum=1,Temp=1,Motion=1247,Lux=1, Humidity=1,BathLight=1,BathTemp=871,BathMotion=870,BathHumidity=1,BathLux=872,BathFan=1,BathMirrorLight=1464,BathMirrorDemist=1466,rcSonos=1,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, lau_eth_bedroom = { Light=52,Temp=1185,Motion=1253,Lamp=1440,rcSonos=1,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, frank_bedroom = { Light=54,Temp=1200,Motion=1255,Lamp=1450,rcSonos=1,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, office = { Light=33,Temp=1186,Motion=1251,Lamp=720,rcSonos=1,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, Landing_Stairs = { stairsLight=92,landingLight=168,rcSonos=1,TTS_message="",TTS_volume=10,RadFav=3,IsPlaying=1,nowPlaying="",vol=1,clip="" }, scene = { MainScene=614,AlarmControl=598,rebootHC2=593,goodMorning=463,goodNight=331,LeavingHome=483,welcomeHome=488,quietMorning=499,kidsToBed=490,plaroomTvOn=580,firstFloorMusicOn=579,firstFloorAllOff=578, hallSceneControl=519,StairsLight30=556,GateOpen5=526,GateOpenHold=361,GateOpenClose=425,DumpEventLog=565,PlayroomOff=617 }, vd = { AlarmManagement=881,TVPresets=1545,SonosTTS=1452,LightPresets=1534,HouseModeExt=1538,SonosPresets=1536,RackTempMngt=1453,MediaSourcePresets=1567,JhomeTable=1566,GateControl=1537,GarageControl=1559 }, users = { admin=2,frank=1564,sylvia=1565 }, ios = { frankS6=993,sylviaS7=1526,frankipad=1532,sylviaipad=1533 }, IsOnline = { GlobalCache=1,SatBox=1,AppleTV=1,AndroidBox=1,TVPlayroom=1,TVKitchen=1,TVLiving=1,Projector=1,HC2=1,SynNAS=1,AlarmGateway=1,AlarmPanel=1,SonosAPI=1,DrivewayCam=1,GardenCam=1,FrontDoorCam=1,PizzaBBQCam=1,Internet=1,USG=1,HouseAP=1,GarageAP=1 }, }
  10. Hi, I am looking for help to figure out what is causing the memory (RAM) consumption on my HC2 to climb to 90%. If I reboot the HC in the evening the memory seem to climb over night and the following morning some scenes will start to fail and the box will ultimately become unresponsive. My setup is as follows (approx.) HC2 - 4.070 60 devices 15 virtual devices 24 scenes – mix of “when true do” and ones that start vix a button 35 global variables (mostly SonosLastCmd and TTS as I have 14 zones) From reading on the forum I understand that the number of scenes, global variables, devices and virtual devices is not an issue for the HC2 from a capacity. I suspect I have a rogue scene but have been through them all looping for infinite loops that accumulate resources over time. All of my scenes are Lua and reasonably simply. Determine house occupancy from a number of sensors, wat for a global variable to change and trigger an action, etc I there some way to review a log of all that is happening so I can pick my way though it for issue. Or is there another way to see what is consuming the memory. I could disable one scene every evening but that would take too long and I am writing new scenes every week. Any help appreciated Thanks -F
  11. 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.
  12. 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
  13. 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
  14. 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
  15. 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:
  16. 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!
  17. 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 - ......
  18. 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
  19. 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
  20. 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
  21. 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 192.168.1.42 port 17494 user : user password : password http string to switch on relay #2 for 5 seconds is : http://192.168.1.42/io.cgi?DOA1=50 what and how do I set this up within a virtual device ?
  22. 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.
  23. 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
  24. 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("http://192.168.1.34:80/api/panels/heating/10" ..PanelID) local currentTemp = panel.properties.currentTemperature fibaro:debug(currentTemp)
  25. 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.
×
×
  • Create New...