Created
February 4, 2022 08:10
-
-
Save sameeraakbar/8665ca96ba8babb07976879e3da7cf24 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"name":"SMS","type":"com.fibaro.genericDevice","apiVersion":"1.2","initialProperties":{"viewLayout":{"$jason":{"body":{"header":{"style":{"height":"0"},"title":"quickApp_device_52"},"sections":{"items":[{"components":[{"name":"label","style":{"weight":"1.2"},"text":"Label","type":"label"},{"style":{"weight":"0.5"},"type":"space"}],"style":{"weight":"1.2"},"type":"vertical"},{"components":[{"components":[{"name":"button3_1","style":{"weight":"0.33"},"text":"SMS1","type":"button"},{"name":"button3_2","style":{"weight":"0.33"},"text":"SMS2","type":"button"},{"name":"button3","style":{"weight":"0.33"},"text":"SMS3","type":"button"}],"style":{"weight":"1.2"},"type":"horizontal"},{"style":{"weight":"0.5"},"type":"space"}],"style":{"weight":"1.2"},"type":"vertical"}]}},"head":{"title":"quickApp_device_52"}}},"uiCallbacks":[{"callback":"sendSMS1","eventType":"onReleased","name":"button3_1"},{"callback":"sendSMS2","eventType":"onReleased","name":"button3_2"},{"callback":"sendSMS3","eventType":"onReleased","name":"button3"}],"quickAppVariables":[],"typeTemplateInitialized":true},"files":[{"name":"main","isMain":true,"isOpen":true,"content":"\nfunction QuickApp:onInit()\n self:debug(\"onInit\")\n self.http = net.HTTPClient({timeout=3000})\nend\n\nfunction QuickApp:sendSMS(content)\nlocal address = content \n self.http:request(address, {\n options={\n headers = { \n Accept = \"application/json\"\n },\n checkCertificate = true,\n method = 'GET'\n },\n success = function(response)\n self:debug(\"response status:\", response.status) \n self:debug(\"headers:\", response.headers[\"Content-Type\"]) \n local data = json.decode(response.data) \n if data.contents and data.contents.quotes and data.contents.quotes[1] then\n local quote = data.contents.quotes[1].quote\n self:debug(quote)\n self:updateView(\"label\", \"text\", quote) \n end\n end,\n error = function(error)\n self:debug('error: ' .. json.encode(error))\n end\n }) \nend\n\nfunction QuickApp:sendSMS1()\n local url = \"http://fibaro.textily.in/api2/send/[email protected]&apiKey=xxxxxxxxxxxxxxxxxxxxxxxxx=&numbers=9840050505&sender=Fibaro&message=Security%20Alert!%0AHouse:%20Housename%0A%20Lobby%20Motion%20detected.%20%0AFIBARO\"\n self:sendSMS(url)\n end\n\nfunction QuickApp:sendSMS2()\n local url = \"http://fibaro.textily.in/api2/send/[email protected]&apiKey=xxxxxxxxxxxxxxxxxxxxxxxxx=&numbers=9840050505&sender=Fibaro&message=Security%20Alert!%0AHouse:%20Housename%0A%20Lobby%20Motion%20detected.%20%0AFIBARO\"\n self:sendSMS(url)\n end\n function QuickApp:sendSMS3()\n local url = \"http://fibaro.textily.in/api2/send/[email protected]&apiKey=xxxxxxxxxxxxxxxxxxxxxxxxx=&numbers=9840050505&sender=Fibaro&message=Security%20Alert!%0AHouse:%20Housename%0A%20Lobby%20Motion%20detected.%20%0AFIBARO\"\n self:sendSMS(url)\n end\n\n\n"}]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment