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. I have come across several Fibaro LUA functions that do not seem to be documented in the available Fibaro LUA manual. Here are a few examples: fibaro:getName(id) fibaro:getRoomNameByDeviceID(id) The use of formatting codes in fibaro:debug("text") And fibaro:call(id, "sendPush", "text..") and similar commands for e-mail etc. I have successfully used all of these and probably more. I am sure there are still more functions/calls out there which are only known from scenes published on the forum. Is there a more complete documentation available? Has anyone collected these semi-secret functions into a private document that may be shared?
  2. Guys, i simple need to send this command using a VD: Button1: PUT http://admin:[email protected]/ISAPI/ContentMgmt/record/control/manual/start/tracks/101 Button2:PUT http://admin:[email protected]/ISAPI/ContentMgmt/record/control/manual/stop/tracks/101 How can i do? Do u have some example? There ia also a way to check the status of the command? Regards Gianluca
  3. Hi Everyone v 2.6 now available for users that have the SMsgH installed Three offerings - Please read below to see which is right for you 1) WWWAPI Monitor {v1.0} - New (Mar8th) - vd that monitors only availability of the internet with option for sonos-api device. (leverages Smart Message Hub {v1.0} 2) Network Device Monitor VD {v2.5} - vd that can monitor several + devices and has built-in alert notification options (pushover/pc2popup/hc2email/allinone) or 3) Network Device Monitor VD {v2.6} - vd that can monitor several + devices and deigned to be used with the recently released Smart Message Hub {v1.0} Regards [Autofrank] LAN Monitor / Network Device Monitor {v2.6} ------ to be used with Smart Message Hub {v 1.0} Modified to to be used with Smart Message Hub - Label check removed to simplify virtual device 4 simple steps to upgrade from v2.5 to v2.6 Import the new virtual device Configure your SendMsg preferences Copy your v2.5 jsonNetwork table to v 2.6 and set UpdateData to 'true' Set UpdateData to 'false' and that's it !! LAN Monitor / Network Device Monitor {v2.5} ------ has built in Notification Services The main difference between 2.0 and 2.5 are the following Virtual Device ONLY - ( no need for separate scene, table updates are now done through VD) Global variable table is created automatically created for new users Added HC2 Popup service as an extra notification option The following features are still available Individual LAN devices can be marked for Alert Alert Notification options configurable for HC2 email (default), pushover, or ALLINONE (@jompa68) One Alert will be received when device goes offline and another when it comes back online Online/Offline status is captured in global table that can be used to trigger other events Debug routine called vdCheck will verify that correct quantity of vd labels and format was setup Status/Error/Check feedback through the virtual device log console as visible through the Web UI I use this to monitor Internet, Unifi Security Gateway, HC2, Sonos API (pi), TV's, Sat Box, Apple TV, Droid Box, Alarm Panel, Alarm Gateway, Syn NAS Global cache device, Cameras, Tablets, Sonos players, Access points and phones. Alerts setup for Internet, USG, Sonos API, Access points, cameras, Sonos players, Alarm panel, alarm gateway and NAS. There are some nuances with some devices such as TV's and Phones. Open Ports of some devices that were shared by users Internet google (port 80) Sonos players/zone (port 1400) Sonos API (port 5005 or 5006) Raspberry Pi Hosting API (port 22) iPhone Port (port 62078) Smarter coffee maker (port 2081) Smarter iKittle (port 2081) Philips TV 47PFL5000 (port 1925) Foscam cameras (port 88) NAS Netgear U6 (port 80) Global cache GC100-12 (port 21) Humax FoxSat satellite receiver(port 80) Apple TV Gen 3 (port 5000) NPET MXQ Pro TV Box - Android 5.1 (port 7002) Sony TV’s (port 80) Samsung TV (port 8080) Synology NAs DS415Play (port 80) SPC Gateway (port 80) Siemens Alarm Panel (port 443) HKVision IP Camera (port 80) Unifi security Gateway (port 80) Unifi UniFi AC LR Access Point (port 22) Samsung Galaxy S6 / S7 (port 5060) Samsung Tablet (port 5060) Generic Android Tablets (port 5060) Airport Express and Airport Extreme (port 5009) Amazon Echo Dot and Fullsize Echo (port 4070) == INSTALLATION: Upgrading from 2.0 == - Import the LAN Monitor 2.5 VD and copy in device table from Update Network Table 2.0 - Run VD with updateData = "true" to update the Network table (default setting is false) - Run VD with updateData = "false" to operate in normal mode - Update notification and frequency of update options == INSTALLATION: First Time Users == STEP 1 - Import the LAN Monitor 2.5 virtual device - Populate the device table. Device, ip, port and enter alert = "1" for device notification - alert is user configurible per device - alert = 1 (enable alerts - alerts sent if it goes offline or comes back online ) - alert = 0 (disable alerts for this device) - Select the notification options - Run VD with updateData = "true" to populate the device table - Run VD with updateData = "false" to operate in normal mode Step 2 (optional) - create labels to display device status in VD - Create one label for each device in the global variable table, use the default ID - Label1, Label2, etc. - Enter Label Names (1, 2, 3, etc) to match order order of devices in Table (devices can be skipped but ID's must match) - Select Main label to display one device when observing through Web UI - If you want to use all labels you can use Set vdCheck = "true" to confirm correct quantity and format of labels. == FILES == Use the version if you don't have Smart Message Hub installed >> Network device Monitor VD {v2.5} ------------> LAN_Monitor_2.5.vfib Use this version if you HAVE Smart Message Hub installed >> Network Device Monitor VD {v 2.6} -----------> LAN_Monitor_2.6.vfib Thanks to @jompa68 , @petergebruers , @sonnyboy and @boerremk for their input Regards -f
  4. Witam, Od wczoraj zmagam się z problemami z HC2. Sceny nie uruchamiają się automatycznie. Miałem wcześniej dużo działących już scen i dopisałem wczoraj nową i przestało działać. Robiłem kilka restartów i nic. Nie widziałem, żeby firmware się aktualizował. Obecna wersja to 4.530. Jeśli odpalę sceny ręcznie to zadziałają, więc kod jest poprawny. Jakieś pomysły?
  5. The documentation on Fibaro LUA states that the call fibaro:get(deviceID, property) "gets the latest data (value and time of last modification) of the device properties". The similar call fibaro:getValue(deviceID, property) is said to "get the current value of the device (deviceID) property". Apart from the difference that the first call may also retrieve the time of last modification, they seem to do identical jobs. I have seen, however, (I forget where) that the wording latest and current is significant. Am I right that the fibaro:get call retrieves its value from the latest value stored in the HC2, while the fibaro:getValue call retrieves it directly by a call to the device? If so, it is worth knowing when making a choice between the two, and the documentation could have been clearer. My specific reason for asking, is that I have a Fibaro door/window sensor, where the temperature measurement has been unchanged for several days, which is unlikely. In a small test script I used both the get and the getValue calls, and they returned identical values. The call used was simply fibaro:getValue(520, "value") and similarly for get. Time of last modification confirms that the value has not been changed for 215 000 seconds (60 hours). If communication had been lost with this device, would it not refuse to return a value from the getValue call? Or does it use the stored value if the device is unresponsive?
  6. Tried to combine two converted blok scenes to one, but now it wont trigger... Any suggestions ? ------------------------------------------------------------------------------------------------------------------------- --[[ %% autostart %% properties %% weather %% events %% globals --]] local sourceTrigger = fibaro:getSourceTrigger(); local currentDate = os.date("*t"); local startSource = fibaro:getSourceTrigger(); if ( ( ((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) == "04:00") ) 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") ) ) then fibaro:setGlobal("reclameverl", "1"); fibaro:debug("var reclverl set to 1") fibaro:sleep(60*1000) elseif ( ( ((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) == "09:00") ) 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) == "18:00") ) ) then fibaro:setGlobal("reclameverl", "0"); fibaro:debug("var reclverl set to 0") fibaro:sleep(60*1000) end ---------------------------------------------------------------------------------------------------------------------------------------------------- I,m hoping someone can give me a hint.... Gary set var reclverl.lua
  7. Hi could some explain to me what kind of variable or syntax this command needs fibaro:call(ID_RGB_CONTROLLER, "setColor", "0", "255", "0", "0") If i define local R_value = 255 fibaro:call(ID_RGB_CONTROLLER, "setColor", R_value, "255", "0", "0") "R_value" is not defined. The command fails. I tried character and single numeric, global and local etc. or do i have to use a table for all of the 4 values? I didn't find an example. Thanks Gerhard
  8. Hi could some explain to me what kind of variable or syntax this command needs fibaro:call(ID_RGB_CONTROLLER, "setColor", "0", "255", "0", "0") If i define local R_value = 255 fibaro:call(ID_RGB_CONTROLLER, "setColor", R_value, "255", "0", "0") "R_value" is not defined. The command fails. I tried character and single numeric, global and local etc. or do i have to use a table for all of the 4 values? I didn't find an example. Thanks Gerhard
  9. Cześć wszystkim! Jestem nowy na forum i nowy w temacie LUA. Walczę i szukam po forum od dłuższego czasu. Wiele problemów już rozwiązałem, ale ten zalazł mi konkretnie za skórę i potrzebuję pomocy ? Mam scenę, która ma działać zależnie od obecności w biurze. 3 czujniki po naruszeniu zaczynają odliczać czas i jeśli zostaną naruszone ponownie, odliczają od początku. Jeśli odliczą do zera to wyłączają światła i inne rzeczy. Oznacza to, że nikogo w biurze już nie ma. Kolejne naruszenie któregoś z czujnika wywołuje efekt odwrotny, czyli wszystko się włącza. Jest jednak jeden wyjątek, którym jest jeden z laptopów, którego nie obejmuje żaden czujnik. Jest on podpięty przez wallpluga i daje informację o zużyciu energii ~10W. Niestety nie umiem ustawić, aby po wyłączeniu laptopa scena zaczynała odliczać czas. Cały czas, bez względu na to czy jest on włączony czy nie, licznik stoi na maksymalnej wartości i nie zaczyna odliczania w dół. Zaczyna to odliczanie dopiero gdy zmieniłem wartość z "power" na "value" i dałem > 0 czyli włączony wallplug. Na ten moment działa to w ten sposób, czyli wnioskuję, że pozostałe elementy sceny są poprawne. Mimo wszystko nie zadowala rozwiązanie, w którym trzeba wyłączyć wallplug, żeby licznik zaczynał odliczać obecność w biurze. Pomocy, kod poniżej --[[ %% autostart %% properties 70 value 657 value 694 value 775 value %% events %% globals --]] --funkcje local czujnikbiuro = (tonumber(fibaro:getValue(70, "value")) > 0); local czujnikwejscie = (tonumber(fibaro:getValue(657, "value")) > 0); local czujnikmagazyn = (tonumber(fibaro:getValue(694, "value")) > 0); local delay = 600 --włączanie zmiennej PRACA = ON if czujnikbiuro or czujnikwejscie or czujnikmagazyn then fibaro:setGlobal("PRACA", "ON"); fibaro:debug("Witaj w salonie Fibaro"); end --uruchamianie pracy if fibaro:getGlobalValue("PRACA") == "ON" then fibaro:call(46, "open"); fibaro:debug("Zasłona została otwarta"); fibaro:startScene(349); fibaro:debug("Muzyka gra przez głośnik Sonos"); fibaro:startScene(530); fibaro:debug("Automatyczne działanie ekspozycji LED włączone"); fibaro:call(16, "turnOn"); fibaro:call(15, "turnOn"); fibaro:call(17, "turnOn"); fibaro:debug("Profile LED nad stołem zostały włączone"); fibaro:call(376, "setValue", "70"); fibaro:debug("AmstLED ustawiony na 70 procent"); fibaro:call(177, "turnOn"); fibaro:debug("Telewizor włączony"); fibaro:call(420, "turnOn"); fibaro:debug("Lampa nad TV włączona"); end --utrzymywanie stanu włączonego przez 10min bezruchu if fibaro:getGlobalValue("PRACA") == "ON" then local turnOffTime = os.time() + delay while turnOffTime > os.time() do if (tonumber(fibaro:getValue(657, "value"))) > 0 or (tonumber(fibaro:getValue(694, "value"))) > 0 or (tonumber(fibaro:getValue(70, "value"))) > 0 or (tonumber(fibaro:getValue(775, "value"))) > 0 then turnOffTime = os.time() + delay end fibaro:debug("zwłoka: "..tostring(turnOffTime - os.time())) fibaro:sleep(5000) end end --wyłączanie pracy po 10min bezruchu fibaro:call(46, "close"); fibaro:call(16, "turnOff"); fibaro:call(15, "turnOff"); fibaro:call(17, "turnOff"); fibaro:call(681, "turnOff"); fibaro:call(376, "turnOff"); fibaro:call(177, "turnOff"); fibaro:startScene(352); fibaro:debug("Do widzenia");
  10. This is not a question but a small contribution, if anyone should be interested. The task was this: How can I control indoor ventilation to avoid temperature/humidity combinations that risk growth of mold or mildew? The first trick was to find a simple formula for this risk zone. I used a calculator in www.dpcalc.org which indicates risk/no risk for a given temp/hum combination. Testing this for realistic values for normal indoor or basement use, I found this simple linear correlation would work: Humidity limit (%) = 91.2 - 1.184 * temp For temp>22 the limit is set constant at 65 %. Temperature is in degrees C. Example: If the temperature is 10 C, the relative humidity should stay below 79.4% to avoid the risk of mold growth. Assuming you have one or several ventilation fans, and one or several temperature/humidity measurements, you can use this to start the fans when the humidity level exceeds the limit. Alternatively, you can increase the set point for a relevant heater, to increase temperature and reduce relative humidity in the room. A push warning to the owner could also be included. I have chosen to only start the ventilation fans, and I include a small LUA script to achieve this. My temperature/humidity measurements are from two Aeotec Multi6 units, but any such sensor may be used. Feel free to implement any part of this script to suit your purpose. Please share here if you use these ideas in other ways or have related ideas yourself. Moldfan_demo.lua
  11. Hi, I am very confused by the functioning and documentation of "startLevelIncrease" that was made available a while ago. It is not documented, I think, outside of the release notes for the release, but the description there was: Ok, so I assume that devices with this call available in the interface when making a Lua scene will work for this. I also assume, since the documentation is a bit vague here, that the first optional parameter gives a time in milliseconds (usually the case) in which the change should have occurred, and a starting level. So, this code should dim up a light from 0 in 30 seconds then: fibaro:call(24, "startLevelIncrease",30*1000,0) But it does not. It dims in just about one second, and it does not matter att all what you specify in the third parameter. Trying it with a TKB plug in dimmer, which makes the call available in the Fibaro lua scene editor (so I guess it should work?)
  12. Hi everyone, is there any way how to obtain (access) information from HC2 heating schedules in LUA scripts? I need to work with information about what temperature and when it is going to be set in some particular rooms. I can workaround this by making heating schedules sort of static and completely overpass heating panel in HC2, but that would be a bit contra productive, right? Thanks Edit: BTW my first post here, so please be gentle
  13. Several posts on this forum recommend including a check in LUA scenes to ensure that only one instance of the scene is currently running. The recommended code is similar to this: if fibaro:countScenes() > 1 then scenes = fibaro:countScenes() fibaro:debug(os.date("%d %b").." Scenes active "..scenes) fibaro:abort(); end The main panel for each scene, however, includes a parameter controlling max. running instances: Why is it necessary to include the extra code, if this parameter already limits the scene to one active instance? Is it only to get the explicit warning from the fibaro:debug() command?
  14. Is there a way to get the user ids of the Home Centre, either manually through the UI or using Lua? If anybody has any pointers on how to use users in Lua that would help. At the moment I'm just trying to add them to a JSON table, but I would also like to use the user ids in code maybe. Thanks in advance.
  15. Witam Mam prośbę, czy mógłby mi ktoś rzucić okiem na kod pętli głównej urządzenia wirtualnego? Mianowicie chodzi o to, że urządzenie działa poprawnie, służy do sterowania klimakonwektorem, jednak nie wyświetla mi stanu poszczególnych elementów na etykietach. Co zrobiłem źle w kodzie pętli głównej? klima_salon_2(1).vfib
  16. Hi guys, is there a way to stop the ringing or cancel the call using lua or an api call? Sometimes I just walk to the door and open it. But the intercom keeps ringing. Thanks
  17. Version 20180525

    291 downloads

    20180525 (Stable) release Added/Changed: - Added some code to the mainloop to detect critical error occurring when a device is forced-removed [ERROR] line 195: attempt to perform arithmetic on a nil value
  18. I have created different scenes in the block scene editor. These are all working except for the one that should do the following: 1. When I arm the alarm, the door sensor is armed. 2. When I open the door it should give me 10 seconds before the alarm goes off. 3. If I disarm the alarm, therefore disarm the door sensor within 10 seconds the alarm should not go off. This all works fine with a minor detail: if I shut the door within 10 seconds the alarm does not go off, while it should go off unless I have disarmed the alarm. I have tried the following block scene: First I tried stating at the device that if it's armed and breached it should trigger and I put a 10 second delay at the end. That did not work. Then I tried the above method checking if the door is device is triggered while armed and breached AND if after 10 seconds the device is NOT disarmed. By the way I also tried the statement if after 10 seconds it IS armed. Both with the same result: If I close the door quickly enough, I'm inside and the alarm is not triggered. Then I thought that maybe it just does not work that well within the block scenes. So I transfered it to LUA (automatic method by Fibaro). The LUA code I get, looks horrendous though. I'm not a developer, but this does not look as very well written code to me. --[[ %% properties 200 value 200 armed %% weather %% events %% globals --]] local startSource = fibaro:getSourceTrigger(); if(startSource["type"] == "other") then fibaro:call(49, "turnOn"); fibaro:call(104, "turnOn"); fibaro:startScene(12); fibaro:call(203, "sendDefinedPushNotification", "4"); fibaro:call(207, "sendDefinedPushNotification", "4"); setTimeout(function() fibaro:call(49, "turnOff"); fibaro:call(104, "turnOff"); end, 900000) else if (( (tonumber(fibaro:getValue(200, "value")) > 0 and tonumber(fibaro:getValue(200, "armed")) > 0) ) and ( tonumber(fibaro:getValue(200, "armed")) ~= 0 )) then local delayedCheck0 = false; if ( (tonumber(fibaro:getValue(200, "value")) > 0 and tonumber(fibaro:getValue(200, "armed")) > 0) ) then delayedCheck0 = true; end setTimeout(function() local delayedCheck1 = false; local tempDeviceState1, deviceLastModification1 = fibaro:get(200, "value"); if (( tonumber(fibaro:getValue(200, "armed")) ~= 0 ) and (os.time() - deviceLastModification1) >= 10) then delayedCheck1 = true; end local startSource = fibaro:getSourceTrigger(); if ( ( delayedCheck0 == true and delayedCheck1 == true ) or startSource["type"] == "other" ) then fibaro:call(49, "turnOn"); fibaro:call(104, "turnOn"); fibaro:startScene(12); fibaro:call(203, "sendDefinedPushNotification", "4"); fibaro:call(207, "sendDefinedPushNotification", "4"); setTimeout(function() fibaro:call(49, "turnOff"); fibaro:call(104, "turnOff"); end, 900000) end end, 10000) end end So here I am, with the big question to you out there: is there anyone who has this working and what code do you have?
  19. Hello, Is it possible to read the relay state from the Heatit thermostat with LUA? i can read the setpoint, roomtemp, but not if the heating/cooling is on or off fibaro:getValue(50, "value")) >> setpoint fibaro:getValue(51, "value")) >> roomtemp I also tried a lot of the other getValue commands, like 'mode' and 'thermostatState' but nothing happens And of course i can create a scene that calculates the difference between roomtemp and setpoint, so that the relay is on if roomtemp - setpoint > diff but i like to check the real state
  20. Hi All! Is there a way to automatic create labels in VD with LUA? I want to add, or delete labels in VD depending on results of my code. For example if i have a VD displaying humidity sensor values and i add a new sensor the code should add a new label to display its value. Any ideas? Thanks in advance.
  21. Hi I have this function function getHueLight(id) local hueIP = 'xxx.xxx.xxx.xxx' local huePort = '80' local hueKey = '--------------------------------' local requestUrl = "http://"..hueIP..":"..huePort.."/api/"..hueKey.."/lights/"..id; local httpClient = net.HTTPClient(); httpClient:request(requestUrl, { options = { headers={}, method='GET' }, success = function (response) fibaro: debug (response. data) end, error = function (err) fibaro: debug ("Error:" .. err) end }); end and i want to assign output of this to variable i've tried somthing like this local var = getHueLight(id) but it's get nil value
  22. hallo, Ich habe mehrere MCO Home MH7 Thermostate in meiner Wohnung installiert. Nach dem Neustart des HC2 wird die Uhr der Thermostate zurückgesetzt. Die meiste Zeit ist die Uhr auf UTC-Zeit statt CET eingestellt. Nachdem sie den Support von MCO Home kontaktiert und gefragt haben, wie sie die Zeit mit LUA zurücksetzen könnten, sagten sie mir, dass sie OpenZWave-konform sind. Ich sollte innerhalb der Klasse "COMMAND_CLASS_TIME_PARAMETERS" den Befehl "TIME_PARAMETERS_SET" verwenden. Weiß jemand, wie ich ZWave-Klassen ( http://www.openzwave.com/dev/classOpenZWave_1_1TimeParameters.html ) in einem LUA-Szenario aufrufen kann ? Danke & Mit freundlichen Grüßen thomas
  23. Hi, I have an ACTRONAIR at Home with Wireless Controller. I have done extensive research to understand how the AC is controlled. It turns out that the AC wireless controller get it's instruction from a Web Service in the cloud. I have intercepted the Web Service Call and this is what get passed on to the cloud: PUT https://actron.ninja.is/rest/v0/device/ACONNECTXXXXXXXXXXXX_0_2_5?user_access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx HTTP/1.1 Accept: application/json Content-Type: application/json Referer: https://actronair.com.au/aconnect/ Accept-Language: en-AU,en;q=0.8,ar-LB;q=0.5,ar;q=0.3 Origin: https://actronair.com.au Accept-Encoding: gzip, deflate User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393 Host: actron.ninja.is Content-Length: 24 Connection: Keep-Alive {"DA":[0,1,1,0,0,0,0,0]} I need help with creating a Scene that sends instructions to the same cloud service. So far I tried the following without any sucess. Appreciate any guidance please! --[[ %% properties %% events %% globals --]] -- Callback at success local function successCallback(resp) fibaro:debug('connection success, status: ' .. resp.status) end -- Callback at error local function errorCallback(resp) fibaro:debug('connection no success, error: ' .. resp) end -- http-request Scene : senden über AutoRemote Tasker WiFi Service enabled in Tasker Action local function getDirect() local http = net.HTTPClient() payload = '"DA":[1,1,1,1,1,0,0,0]' fibaro:debug('this is the payload: ' .. payload .. '.') http:request('https://actron.ninja.is/rest/v0/device/ACONNECTXXXXXXXXXXX_0_2_4?user_access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', { options = payload, success = successCallback, error = errorCallback } ) end -- Do the request getDirect()
  24. Hi, I have a LUA programming question - for making a scene that helps HC2 heat panel control my AC via ZXT-120. My end-goal (for now) is to set the Fan speed and AC mode (heat/cool/off) by the logic in the following table (explanation below) Explanation for table: Setpoint is retrieved from Heat Panel. The deviation from setpoint is calculated from a global temp-variable subtracting setpoint to get the deviation. Based on that daviation AND the outside temperature, the AC will be set do fan speed and mode. I realize that the amount of if statements would be too big for me to handle, so someone suggested to use "switch-case" (which i am not familiar with but is sort of understood). The below example was provided for me: The problem is i still can't translate this to anything sensible in LUA. Can anyone please help me?
  25. Below is a simple LUA script to turn off most lights at night. The script (my first LUA attempt) works, but raises some basic questions: I would have liked to find the length of the array Lights_exBedrooms using the LUA function n=table.getn(ArrayName). I could not make it work. Is this function not implemented in HC2 LUA? General LUA documentation allows the construction for i,v in ipairs(ArrayName) do .. to cycle through an entire array. This does not seem to be implemented in HC2 LUA either? The script runs without delay, including the do loop turning off all lights in the list. Line 18, however, turning device 251 back on at 20 %, is delayed by about 5 seconds. Why? The idea is to define the device list as a global variable to be used in other scenes. Will adding Lights_exBedrooms{} below line 5 "%% globals" achieve that? More generally: How can something inserted between comment brackets --[[ and --]] in the header be significant to the LUA interpreter? -- "Good night" script - turns off most lights --[[ %% properties %% events %% globals --]] -- set toilet light to low before turning off (night light position, if manually switched on during night) fibaro:call(267,'setValue','20') -- Define vector of all non-bedroom light devices Lights_exBedrooms={306,304,311,305,291,286,271,366,276, 261,267,251,246,373,404,338,328,333} -- Turn off all lights except bedrooms n=18 for i=1,n do fibaro:call(Lights_exBedrooms,'turnOff') end -- Special cases fibaro:call(251,'setValue', '20') -- Hallway at 20%
×
×
  • Create New...