add weather sample

This commit is contained in:
Evgeny
2021-09-26 18:38:47 +03:00
parent d3c04dfba5
commit 494e34fde6

17
samples/weather_test.lua Normal file
View File

@@ -0,0 +1,17 @@
function on_alarm()
weather:get_by_hour()
end
function on_weather_result(tab)
local tab2 = {}
for k,v in pairs(tab) do
table.insert(tab2, time_to_string(v.time)..": "..v.temp)
end
ui:show_lines(tab2)
end
function time_to_string(time)
return os.date("%c", time)
end