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'.
-
Ok, this is not the best solution and might need a few more tweaks to make it look perfect (but i wasn't going for perfection) Get Chrome, install the plugin called "Stylish" after you installed it, go to preferences, make a new rule and add your domain name or ip address of your fibaro. Then add the following css code: .kitBody { width: 1100px; } #mainLoop_0 { width: 98%; height: 600px !important; } #Container1 { width: 98%; } #Top { width: 98%; } #Menu { width: 98%; } .Left { width: 13%; } .Content { width: 85%; } .Sections { width: 100%; } .SectionContent { width: auto; } #Top { float: left; } .kit { width: 100%; } .kitBody { width: 100%; } .kitBodyRight { width: 96%; } #kitsContainer { width: 100%; } .DeviceEditRight { padding-left: 25px; } .SceneArea { width: 98%; height: 600px; } .DeviceEditParametrs { width: 96%; } .CodeMirror { height: inherit; } Once you done this, at least the lua code window looks like this: So what this does is change the css code so that it tries to span the full screen that you have. So i assume you have a high resolution monitor or else it might look funny p.s. found a class that is called ".FisrtHeadline" Nice typo, it is in the html and css..
-
Has anyone successfully integrated ecobee into HC2? I believe that there is a API for ecobee and could be used in Lua.
- 2 replies
-
- ecobee
- thermostat
- (and 4 more)
-
Hi, Some block did not work as expected, so I converted them to Lua. The general structure of the scenes in Lua is: function tempFunc() the payload code setTimeout(tempFunc, 60*1000); end if (sourceTrigger["type"] == "autostart") then tempFunc() else the payload code end Thus the payload is doubled in code. I changes this to: function tempFunc() payload() setTimeout(tempFunc, 60*1000); end function payload() the payload code end if (sourceTrigger["type"] == "autostart") then tempFunc() else payload() end Any comments?
-
Hi, Was searching to display the date and time parts and came across this %a abbreviated weekday name (e.g., Wed) %A full weekday name (e.g., Wednesday) %b abbreviated month name (e.g., Sep) %B full month name (e.g., September) %c date and time (e.g., 09/16/98 23:48:10) %d day of the month (16) [01-31] %H hour, using a 24-hour clock (23) [00-23] %I hour, using a 12-hour clock (11) [01-12] %M minute (48) [00-59] %m month (09) [01-12] %p either "am" or "pm" (pm) %S second (10) [00-61] %w weekday (3) [0-6 = Sunday-Saturday] %x date (e.g., 09/16/98) %X time (e.g., 23:48:10) %Y full year (1998) %y two-digit year (98) [00-99] and used on conjunction with the normal os.date you can display/use any part of a date/time fibaro:debug(os.date("%A")) fibaro:debug(os.date("%b")) fibaro:debug(os.date("%d")) gives [DEBUG] 20:30:46: Thursday [DEBUG] 20:30:46: Jul [DEBUG] 20:30:46: 14 and the time is (os.date("%H:%M:%S")) might save other newbee's like myself from too much head scratching -Frank
-
Hello, does anyone know how I can get OVERCURRENT notification in lua in DIMMER2? Thanks in advance, Regards RB
-
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
-
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
-
- 1
-
- unreliable
- scene
-
(and 2 more)
Tagged with:
-
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
- 15 replies
-
- http:request
- scenes
-
(and 1 more)
Tagged with:
-
-
- air conditioning
- daikin
-
(and 3 more)
Tagged with:
-
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?
-
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
-
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.
-
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?
-
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 }, }
-
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
-
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.
-
LUA: Extract XML(GET) - REPLACE TAG VALUE - UPLOAD (PUT)
Gianluca S. posted a question in Scenes and Interface
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 -
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
-
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
-
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:
-
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!
-
Send info to a Google spreadsheet from Fibaro Lua
xirilius posted a question in Scenes and Interface
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 - ......- 2 replies
-
- spreadsheet
-
(and 2 more)
Tagged with:
-
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
-
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
-
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