Skip to content

Commit

Permalink
Weather provider v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
irekk-wf committed Sep 11, 2020
1 parent 7b0764f commit 2c3ca14
Show file tree
Hide file tree
Showing 6 changed files with 199 additions and 25 deletions.
5 changes: 3 additions & 2 deletions DeviceBuilder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ function DeviceBuilder:updateChild(name, displayName, type, properties)
if not child then
child = self:createChild(name, displayName, type, properties)
end

if properties ~= nil then
api.put('/devices/' .. child.id, {properties = properties})
api.put('/devices/' .. child.id, {name = displayName, properties = properties})
end
QuickApp:trace('Device updated: ' .. child.name .. ' [' .. child.id .. ']')
return child
Expand All @@ -55,7 +56,7 @@ end

function DeviceBuilder:createChild(name, displayName, type, properties)
local options = {
name = name,
name = displayName,
type = type
}
local child = self.parentDevice:createChildDevice(options, self.classMap[type])
Expand Down
23 changes: 23 additions & 0 deletions GUI.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

--[[
GUI utility
@author ikubicki
]]

class 'GUI'

function GUI:new(app, i18n)
self.app = app
self.i18n = i18n
QuickApp:debug(i18n)
return self
end

function GUI:button1Text(text)
self.app:updateView("button1", "text", self.i18n:get(text))
end

function GUI:label1Text(text, value1)
if value1 == nil then value1 = 'N/A' end
self.app:updateView("label1", "text", string.format(self.i18n:get(text), value1))
end
Loading

0 comments on commit 2c3ca14

Please sign in to comment.