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. For roller shutters there is a setting "Local protection state": If it is set to "No operation possible" in the web interface, then it is not possible at all to control a device directly via buttons. Same is available to block operation via scenes: By setting "Remote protection state" to "No remote control". The state of this parameter can be read by this command: print (fibaro:getValue(ID, "protectionState")); Now I want to set this protection state via LUA (to protect the blinds from operated at strong winds). The Fibaro support page states a parameter "setProtectionLocalAndRF" can be set via fibaro:call function if used with the callAction API call. Question A: How to call the callAction API via http from within a LUA scene? Will this set the protection state? What are the parameters for setProtectionLocalAndRF? However, when changed in the web interface my roller shutter module does not store that value, but always is set back to "unprotected". Question B: What can be the reason, why my roller shutter module doesn't accept the state "No operation possible"? Thanks for help. ------ FGRM--222 Software Version 25.25 HCL2 Software Version 4.100
  2. Zauważyłem brak jednej sceny napisanej w LUA. Ale ta scena działa. Zrobiłem ją jeszcze w FW 3. Nie potrzebowałem jej modyfikować więc nie wiem od kiedy jej nie widać. Jestem zalogowany jako admin. Co mogę zrobić aby dobrać się do tej niewidocznej sceny?
  3. Hi, I have two central scene event 'scenes' that represent two different button press actions on one device (Remotec ZRC90) --[[ %% properties %% events 1425 CentralSceneEvent 4 Pressed %% globals --]] local MorningSceneID = 463 local startSource = fibaro:getSourceTrigger(); if ( ( true ) or startSource["type"] == "other" ) then fibaro:startScene(MorningSceneID); -- morning scene end and --[[ %% properties %% events 1425 CentralSceneEvent 3 Pressed2 %% globals --]] local HomeSceneID = 488 local startSource = fibaro:getSourceTrigger(); if ( ( true ) or startSource["type"] == "other" ) then fibaro:startScene(HomeSceneID); -- home scene end Does anybody know how to combine into one scene as this device has 8 buttons/4 options per button (32 events) and I'm trying not to end up with 32 separate scenes the api device dump is as follows... {"id":1425,"name":"Hall Scene Controlle","roomID":5,"type":"com.fibaro.remoteController","baseType":"com.fibaro.actor","enabled":true,"visible":true,"isPlugin":false,"parentId":1424,"remoteGatewayId":0,"interfaces":["battery","zwave","zwaveCentralScene","zwaveWakeup"],"properties":{"parameters":[],"zwaveCompany":"Remotec","zwaveInfo":"2,4,5","zwaveVersion":"1.1","wakeUpTime":0,"pollingTimeSec":0,"batteryLevel":"96","batteryLowNotification":"true","centralSceneSupport":"[{\"keyAttributes\":[\"Pressed\",\"Released\",\"HeldDown\",\"Pressed2\"],\"keyId\":1},{\"keyAttributes\":[\"Pressed\",\"Released\",\"HeldDown\",\"Pressed2\"],\"keyId\":2},{\"keyAttributes\":[\"Pressed\",\"Released\",\"HeldDown\",\"Pressed2\"],\"keyId\":3},{\"keyAttributes\":[\"Pressed\",\"Released\",\"HeldDown\",\"Pressed2\"],\"keyId\":4},{\"keyAttributes\":[\"Pressed\",\"Released\",\"HeldDown\",\"Pressed2\"],\"keyId\":5},{\"keyAttributes\":[\"Pressed\",\"Released\",\"HeldDown\",\"Pressed2\"],\"keyId\":6},{\"keyAttributes\":[\"Pressed\",\"Released\",\"HeldDown\",\"Pressed2\"],\"keyId\":7},{\"keyAttributes\":[\"Pressed\",\"Released\",\"HeldDown\",\"Pressed2\"],\"keyId\":8}]","configured":"true","dead":"false","defInterval":"0","deviceControlType":"0","deviceIcon":"103","emailNotificationID":"0","emailNotificationType":"0","endPointId":"0","liliOffCommand":"","liliOnCommand":"","log":"","logTemp":"","manufacturer":"","markAsDead":"true","maxInterval":"0","minInterval":"0","model":"","nodeId":"196","parametersTemplate":"0","productInfo":"82,84,0,1,133,16,1,1","pushNotificationID":"0","pushNotificationType":"0","remoteGatewayId":"0","saveLogs":"true","serialNumber":"","smsNotificationID":"0","smsNotificationType":"0","stepInterval":"0","useTemplate":"false","userDescription":""},"actions":{"reconfigure":0,"setInterval":1},"created":1468671788,"modified":1468671788,"sortOrder":414} Thanks -Frank SOLUTION local pressSource = fibaro:getSourceTrigger()["event"]["data"] --get data what was pressed --fibaro:debug(json.encode(pressSource)) -- Button 1 to 8 when button is PRESSED once if (tostring(pressSource["keyAttribute"]) == "Pressed") then if (tostring(pressSource["keyId"]) == "1") then fibaro:debug('Key 1 pressed once') -- replace with scene you want executed elseif (tostring(pressSource["keyId"]) == "2") then fibaro:debug('Key #2 pressed once') -- replace with scene you want executed elseif (tostring(pressSource["keyId"]) == "3") then fibaro:debug('Key #3 pressed once') -- replace with scene you want executed elseif (tostring(pressSource["keyId"]) == "4") then fibaro:debug('Key #4 pressed once') -- replace with scene you want executed elseif (tostring(pressSource["keyId"]) == "5") then fibaro:debug('Key #5 pressed once') -- replace with scene you want executed elseif (tostring(pressSource["keyId"]) == "6") then fibaro:debug('Key #6 pressed once') -- replace with scene you want executed elseif (tostring(pressSource["keyId"]) == "7") then fibaro:debug('Key #7 pressed once') -- replace with scene you want executed elseif (tostring(pressSource["keyId"]) == "8") then fibaro:debug('Key 8 pressed once') -- replace with scene you want executed end end Please see post http://forum.fibaro.com/index.php?/topic/21905-at-last-a-wall-mounted-scene-controller-that-works-scene-code-included/ for full scene that works with ZRC90
  4. local daysoftheweek={"Söndag","Måndag","Tisdag","Onsdag","Torsdag","Fredag","Lördag"} local day = urlencode(daysoftheweek[os.date("*t").wday-1]) function urlencode(str) if (str) then str = string.gsub (str, "\n", "\r\n") str = string.gsub (str, "([^%w ])", function (c) return string.format ("%%%02X", string.byte(c)) end) str = string.gsub (str, " ", "+") end return str end function MM(data) local function getMethod(requestUrl, successCallback, errorCallback) local http = net.HTTPClient() http:request(requestUrl, { options = { method = 'GET', headers = { }, }, success = successCallback, error = errorCallback }) end local url = 'http://192.168.0.137:8080/syslog?type=INFO&message='..data getMethod(url, function(resp) print(resp.data) end, function(err) print('error' .. err) end ) end MM(day..'+'..fibaro:getGlobal("yeasterdayKW")..'+'..'kWh') Result [DEBUG] 14:13:32: {"status":"success","payload":{"type":"INFO","message":"Söndag 34.96 kWh","timestamp":"2016-10-10T12:13:32.103Z"}} Should be [DEBUG] 14:13:32: {"status":"success","payload":{"type":"INFO","message":"Söndag 34.96 kWh","timestamp":"2016-10-10T12:13:32.103Z"}} so i think my header with utf8 is not correct. If i run url direct in browser it works with same data
  5. Created a LUA function you can use in a scene to upload data to emoncms.org. toEmonCMS = function(id,value,InputKey) local http = net.HTTPClient() -- CHANGE WRITE API KEY FOR EMONCMS local apikey = '1966dcf7b44xxxxxxxxxxxxxxxxxxx' -- SHOULD NOT BE NECESSARY TO EDIT BELOW THIS LINE -- local url = 'https://emoncms.org/input/post.json?json={' http:request(url .. InputKey .. ':' .. fibaro:getValue(id, value).. '}' ..'&apikey='..apikey, { options = { method = "POST", }, success = function(response) fibaro:debug (response.data) end, error = function(err) fibaro: debug ("Error:" .. err) end }) end toEmonCMS(58,'value','Temperature') Example first 319 is id of device, second power is what value you want to upload, third Power is the InputKey in emoncms site Upload power data toEmonCMS(319,'power','Power') Upload temperature data toEmonCMS(58,'value','Temperature')
  6. Hi! I need to create this functionality in LUA Code on Virtual Devices: Aim: To toggle commands each time that button is pressed. Description: The Virtual Device button called “Cursor Left” needs to save Two Commands “Global Cache Executable : InfraRed Code 1” and “Global Cache Executable : InfraRed Code 2”. Working: We need that each time we press the button “Cursor Left”, “IR Code 1” is sent and the second time we press the button “IR Code 2” is sent, when we press it the third time “IR Code 1” is sent and so on. At no instance “IR Code 1” and “IR Code 2” should be sent together. It should always execute Code 1 then Code 2 then Code 1 . . . . . only when the virtual device button is pressed. The program would be saved on each button of the virtual device, virtual device in this case would be a remote comprising of different buttons and codes. How RC6 Codes Work : RC6 each codes is used in alternating order. After the first code gets sent, the equipment is looking for the next code. Best Regards, Kunal Sabharwal
  7. Guest

    Update of DDNS Using Scene

    Hi Guys, First post on here. I've just moved from a Vera to the HC2 to give it a go and find things quite difficult. I had a scene set up on my Vera than ran periodically to update my Dynamic DNS server using a wget function in Luup. I've been mucking around tonight for quite a while using Lua scenes trying to achieve the same outcome with no luck! I'm sure it's easy but can anyone help out? Thanks! Sam.
  8. CANCEL THIS - I SOLVED IT WITH A VD USING THE MAIN LOOP Hi, This is prob not a huge mystery and something basic I'm missing. If I remove the While true do loop from the code below and execute it manually it works okay but once I add the while loop to get it check all the time the scene doesn't run Could somebody take a look and tell me where I'm being stupid Thanks -F --[[ %% autostart %% properties %% events %% globals --]] -- Configuration - Scene Info sceneName = "Sonos State tracker" sceneVersion = "1.0.1" -- Scene Description -- Track and stores the state of three of the sonos -- zones so the respective amp can be switched on -- Configuration - Device IDs -- none for this scene -- Validate Number of Scene Instance if (fibaro:countScenes()>1) then --fibaro:debug("stop scene") fibaro:abort() end -- read playroom state function StateFunc() while true do fibaro:sleep(2000) -- execute this every 2 seconds if fibaro:getGlobal("G_SPC_AREA_STATUS_1") == "UNSET" then -- don't check if we are not at home http = net.HTTPClient({ timeout = 3000 }) url = 'http://192.168.1.89:5005/Playroom/state' controlHeaders = {['content-type'] = 'application/json; charset=utf-8'} http:request(url, { options = { headers = controlHeaders, method = 'GET', }, success = function(response) if response.status == 200 then local responds = json.decode(response.data) local zPRState = responds.zoneState fibaro:debug(zPRState) fibaro:setGlobal("Sonos_PRState", zPRState); end end, }) -- read living room state http = net.HTTPClient({ timeout = 3000 }) url = 'http://192.168.1.89:5005/Living_Room/state' controlHeaders = {['content-type'] = 'application/json; charset=utf-8'} http:request(url, { options = { headers = controlHeaders, method = 'GET', }, success = function(response) if response.status == 200 then local responds = json.decode(response.data) local zLRState = responds.zoneState fibaro:debug(zLRState) fibaro:setGlobal("Sonos_LRState", zLRState); end end, }) -- read dining room state http = net.HTTPClient({ timeout = 3000 }) url = 'http://192.168.1.89:5005/Dining_Room/state' controlHeaders = {['content-type'] = 'application/json; charset=utf-8'} http:request(url, { options = { headers = controlHeaders, method = 'GET', }, success = function(response) if response.status == 200 then local responds = json.decode(response.data) local zDRState = responds.zoneState fibaro:debug(zDRState) fibaro:setGlobal("Sonos_DRState", zDRState); end end, }) end -- end if statement end -- end while loop end -- end function -- Main Scene execution code StateFunc()
  9. Hi, I was wondering if anybody had tried this before. I am looking to ping a device on my home network to see if it is 'online' and then store something like an online/offline in a variable that I can display. I use static IP's for all the devices I am looking to monitor I was thinking about using the arp approach and see if the device is returned as part of the list Has anybody tried this before .. or do people think it may be possible or is there another route ? Thoughts appreciated Thanks Frank
  10. hi I thought I read somewhere that multiple http commands are not executed in the order that they are listed in the scene. I have a scene and it doesn't work 100% of the time and I think this may be the issue I tried grouping 3 or 4 commands into one http request and added a few sleep but with limited success sample script... function tempFunc() -- music on local http1 = net.HTTPClient() -- ungroup bed lauren-ethan from other rooms http1:request('http://192.168.1.89:5005/Landing/ungroup/Bed_LE') http1:request('http://192.168.1.89:5005/Bed_MasterR/ungroup/Bed_LE') http1:request('http://192.168.1.89:5005/Bed_MasterL/ungroup/Bed_LE') http1:request('http://192.168.1.89:5005/Bed_Guests/ungroup/Bed_LE') http1:request('http://192.168.1.89:5005/Bed5_Office/ungroup/Bed_LE') fibaro:sleep(200) local http2 = net.HTTPClient() -- ungroup bed frank from other rooms http2:request('http://192.168.1.89:5005/Landing/ungroup/Bed_Frank') http2:request('http://192.168.1.89:5005/Bed_MasterR/ungroup/Bed_Frank') http2:request('http://192.168.1.89:5005/Bed_MasterL/ungroup/Bed_Frank') http2:request('http://192.168.1.89:5005/Bed_Guests/ungroup/Bed_Frank') http2:request('http://192.168.1.89:5005/Bed5_Office/ungroup/Bed_Frank') fibaro:sleep(200) -- select radio favourite local http3 = net.HTTPClient() http3:request('http://192.168.1.89:5005/BED_FRANK/Favorite/Calm%20Radio') http3:request('http://192.168.1.89:5005/BED_LE/join/BED_FRANK') fibaro:sleep(1000) -- clean up to make sure master room spaekers remain joined and volume is correct local http4 = net.HTTPClient() http4:request('http://192.168.1.89:5005/BED_MASTERL/join/BED_MASTERR') http4:request('http://1922168.1.89:5005/BED_FRANK/Volume/14') http4:request('http://192.168.1.89:5005/BED_LE/Volume/14') fibaro:sleep(1000) -- setup music for kids at night local http5 = net.HTTPClient() http5:request('http://192.168.1.89:5005/BED_FRANK/Favorite/Calm%20Radio') http5:request('http://192.168.1.89:5005/BED_LE/join/BED_FRANK') fibaro:sleep(1000) -- clean up to make sure master room speakers remain joined and volume is correct local http6 = net.HTTPClient() http6:request('http://192.168.1.89:5005/BED_MASTERL/join/BED_MASTERR') http6:request('http://1922168.1.89:5005/BED_FRANK/Volume/14') http6:request('http://192.168.1.89:5005/BED_LE/Volume/14') end BACKGROUND I am using the nodejs sonos bridge and need to be to execute http commands in a certain sequence of commands ie ungroup RoomA, RoomB, RoomC Group Room B with RoomZ Set station to Fav1 and play Adjust volume to 18% Complications arise when they are executed out of sequence Has anybody experienced this and have a solution...
  11. Is it possible to check if the virtual device button was pressed in lua? Is there any function for that in lua? I want to code something like this: (If Button "3" of virtual device with an ID of 674 was pressed than a=a+1) for example
  12. Are the IP Address and TCP Port properties for a virtual device read only in LUA and only able to be changed using the web interface? Tried the following from a scene with no success. fibaro:call(id.vd, "setProperty", "ip", newIP) fibaro:call(id.vd, "setProperty", "port", newPort) fibaro:call(id.vd, "setProperty", "IPAddress", newIP) fibaro:call(id.vd, "setProperty", "TCPPort", newPort)
  13. Hi, I just registered for a developer.fibaro.com account to see if the Lua library description was better there than what is posted on the public web (http://www.fibarouk.co.uk/support/lua/library/). It is not. As I understand it, these functions you still need to hunt around in the forum release notes to get a description of: setTimeout fibaro:setSceneRunConfig fibaro:getSceneRunConfig fibaro:setSceneEnabled fibaro:isSceneEnabled fibaro:getDevicesId And this function is more of a rumor. A mystical being that someone discovered and that may be present (have not checked yet, but just the fact that new functions are mentioned first in the forum tells you something about the state of things): clearTimeout So, for how long will this be the way developers are treated? Would there not be less problems reported on the forum if documentation was actually updated (not just copied in to a more pretty frame) AT LEAST when a non-beta version is released. Fredrik
  14. Hi all, I want to send commands to my Rotel amplifier from my HC2, using lua in a virtual device. The service I want to connect to is a websockets service on an RPi2 connected to the Rotel over USB. It's the json-serial-port-server by John Lauer, https://github.com/chilipeppr/serial-port-json-server. I did find connections using tcpsockets in lua, but tcpsockets and websockets are different things. All other (http) connections don't work. If I get something like a connection from lua, an additional window opens on top of my browser connection to my HC2. This is not useful. Anyone any idea how to use websockets from lua? Thanks in advance, Evert
  15. Hi all is there a lua command to perform a "soft reconfiguration" on a zwave device. Specifically, my immediate need is to configure s remotec zxt-120 v1.6 aircon controller. It's just a little tedious to change the IR code set, then perform a soft reconfiguration to test it. I'd rather write a script and stop the script when the device in question receives a valid IR signal.
  16. Hi guys, is there a lua command to soft reconfigure a device. I'm trying to write a script to test the IR code sets of a remotec zxt-120 v1.6 aircon controller, but given a soft reconfigure is required after every code set change, it would be easier with a lua script
  17. Hi, I am leveraging a bridge to interact with my sonos systems The command to invoke is simple.... http://192.168.1.89:5005/Bed5_Office/SAY/Hi but if I want to have more than one word i need to separate them with a %20 in the url ..like http://192.168.1.89:5005/Bed5_Office/SAY/Hi%20there Now if I drop the following url into a browser (note space between 'hi' and 'there') http://192.168.1.89:5005/Bed5_Office/SAY/Hi there It works !!!... ..but if i use it in a scene it doesn't I had this working from a scene before so I asked the developer of the sonos bridge and he said .. the last part is the important bit.....so my question is how can I get the http request in the scene to invoke the url so I don't have to add the %20 as spaces I tried a number of options but can only seem to find a way to encode headers or data but not the url I am 99% sure I had this working but in a recent overzealous clean up of my code I must have deleted the sample code that worked for me. Could anybody help ? Thanks -Frank
  18. Hi I am trying to create a script that will be triggered when another scene such as 'kids to bed' is run. I want to capture the id of the scene 'kids to bed' This is what I have so far but no luck --[[ %% autostart %% properties 490 sceneActivation %% events %% globals --]] local startSource = fibaro:getSourceTrigger() local ScID = startSource['deviceID'] local ScType = startSource['type'] fibaro:debug(ScType) fibaro:debug(ScID) so.. when scene 490 is run I want the above scene to run and whne this happens I want to be able to display the scene id ( in my example above it would be 490) Ultimately I am looking to create a scene which will trigger when any of my other scenes are run and I'll then email the date/time and scene id so i can see across my whole system what is running and when. I have a few scenes that don't seem to be running when they should be and I am looking to narrow it down. Thanks -Frank
  19. Is there an easy way to get the value of the main sensors for a room? Other than looping through all devices, checking their type, and checking their room or using the REST API? Hoping for a simple "Fibaro provided" method like fibaro:getValue(roomID, "lux") ID's aren't globally unique so I'm guessing functionality like this isn't going to work without a new specific method... Is querying http://localhost/api/rooms/roomID the easiest for the time being?
  20. Is there a way to determine whether a virtual device slider was changed by physically moving the slider or whether it was updated with LUA? This is for a now playing progress bar. In the slider's LUA script I want to ignore when the slider was updated by the main loop LUA code. fibaro:getSourceTrigger() sadly doesn't work for virtual devices. UPDATE: Issue resolved. Use fibaro:call(id, "setProperty", "ui.Slider1.value", position) to change the value and position of a slider without running the code in the slider. The slider on the web interface may not move without refreshing the page when this is called but it does work.
  21. Hi, Does anybody know if it is possible to run a scene to and extract a 'result from there scene via the API An example might be to check which sensors are triggered or zones are open/closed and just return open ones. I'm pretty sure I could run the scene and update a global variable and then just use the API to read the value of the global variable but I was wondering if there was a way to do it with just the scene Thanks -F
  22. Dear forum, As a newbie to LUA (although I have past experiences with C#, not extensive, again as a newbie) I'm interested in what other languages I also need to learn alongside LUA in order to be able to use / learn LUA. Are there any others I need to / should learn as well as LUA?
  23. hi all i have created a basic website that is basically a database of LUA code. Some is simple stuff and others a bit more complex. All of it i have tried to put into alphabetical order. At the moment it contains mostly the code i have used and there is a contact me page so that other members can send me code and i can add to this library. Also on there is a section for Virtual Devices, with download links and links back to the thread on this forum. im hoping that this should make finding LUA code easier and also the VD downloads a bit more accessible. thanks the link is: http://www.yorkshireautomation.co.uk/lua
  24. Hi folks, I'm looking for some help or some directing. I've searched the forum but can't find what I'm looking for even though it has to be there and tried before. I am trying to create a scene to read and adjust my heating system through the API The steps would be - login over http passing username and password. (this would activate a session) - read back the authentication code to use in next step - issue a post to the API to read or adjust the heating (over http) any help or pointing me to other forum posts would be appreciated Thanks Frank Edit: I've attached a wireshark trace export of the transaction requesting a 1 deg decrease. I blanked out some email addresses and site specific information for privacy. This is essentially what I am trying to replicate through a scene if it's possible. ws trace export.txt
  25. what is Devices polling time interval and how can i calculate it the best value?
×
×
  • Create New...