From 494e34fde6d2ceabb461f17d8c2018b41e78c098 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Sun, 26 Sep 2021 18:38:47 +0300 Subject: [PATCH] add weather sample --- samples/weather_test.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 samples/weather_test.lua diff --git a/samples/weather_test.lua b/samples/weather_test.lua new file mode 100644 index 0000000..539d9a8 --- /dev/null +++ b/samples/weather_test.lua @@ -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