Fix weather formatting and parsing
parent
1496814f1b
commit
a8d82e0600
|
@ -31,16 +31,16 @@ function node.render()
|
|||
|
||||
if weatherGlyphs[state.weather] then
|
||||
love.graphics.setFont(weatherFont)
|
||||
love.graphics.print(weatherGlyphs[state.weather], 150, 0)
|
||||
love.graphics.print(weatherGlyphs[state.weather], 150, 35)
|
||||
end
|
||||
|
||||
love.graphics.setFont(textFont)
|
||||
love.graphics.printf(tostring(state.temperature) .. "°", 600, 180, 650, 'center')
|
||||
love.graphics.printf(tostring(state.temperature) .. "°", 600, 150, 650, 'center')
|
||||
|
||||
love.graphics.setFont(smallFont)
|
||||
love.graphics.printf(os.date("Last update: %Y/%m/%d %H:%M", state.lastUpdate), 0, love.graphics.getHeight() - 60, love.graphics.getWidth(), 'center')
|
||||
if state.insideTemperature then
|
||||
love.graphics.printf("Room: " .. state.insideTemperature .. "° / " .. state.insideHumidity .. "%RH", 0, love.graphics.getHeight() - 100, love.graphics.getWidth(), 'center')
|
||||
love.graphics.printf("Room: " .. tostring(state.insideTemperature) .. "° / " .. tostring(state.insideHumidity) .. "%RH", 0, love.graphics.getHeight() - 100, love.graphics.getWidth(), 'center')
|
||||
end
|
||||
else
|
||||
love.graphics.setColor( 255, 255, 255, 80 )
|
||||
|
|
|
@ -12,7 +12,7 @@ if c == 200 then
|
|||
|
||||
local r, c, h = http.request(insideURL)
|
||||
if c == 200 then
|
||||
for n in string.gmatch(string.gsub(r, ",", "."), ":(%S+)[*%%]") do
|
||||
for n in string.gmatch(string.gsub(r, ",", "."), ":%s*(%S+)[*%%]") do
|
||||
insideData[#insideData+1] = n
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue