Add Tasker command search and edit sunrise widget #16
@@ -4,6 +4,7 @@
|
|||||||
-- type = "search"
|
-- type = "search"
|
||||||
-- author = "Sriram SV"
|
-- author = "Sriram SV"
|
||||||
-- version = "1.0"
|
-- version = "1.0"
|
||||||
|
-- prefix = "ip"
|
||||||
|
|
||||||
local md_color = require "md_colors"
|
local md_color = require "md_colors"
|
||||||
local blue = md_colors.blue_500
|
local blue = md_colors.blue_500
|
||||||
|
|||||||
@@ -8,12 +8,30 @@
|
|||||||
|
|
||||||
local json = require "json"
|
local json = require "json"
|
||||||
local date = require "date"
|
local date = require "date"
|
||||||
function on_alarm()
|
|
||||||
local location=system:location()
|
global_loc = {}
|
||||||
url="https://api.sunrise-sunset.org/json?lat="..location[1].."&lng="..location[2].."&date=today&formatted=1"
|
|
||||||
http:get(url)
|
function on_resume()
|
||||||
|
if global_loc ~=nil then
|
||||||
|
ui:show_text("Tap to request location")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function on_click()
|
||||||
|
system:request_location()
|
||||||
|
ui:show_text("Loading...")
|
||||||
|
end
|
||||||
|
|
||||||
|
function on_location_result(location)
|
||||||
|
if location ~= nil then
|
||||||
|
ui:show_text(location[1].." "..location[2])
|
||||||
|
global_loc = location
|
||||||
|
url="https://api.sunrise-sunset.org/json?lat="..location[1].."&lng="..location[2].."&date=today&formatted=1"
|
||||||
|
http:get(url)
|
||||||
|
else
|
||||||
|
ui:show_text("Error")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function on_network_result(result)
|
function on_network_result(result)
|
||||||
local t = json.decode(result)
|
local t = json.decode(result)
|
||||||
|
|||||||
24
community/tasker-command-search.lua
Normal file
24
community/tasker-command-search.lua
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
-- name = "Tasker Command Search"
|
||||||
|
-- description = "Sends tasker command from search bar"
|
||||||
|
-- data_source = "tasker"
|
||||||
|
-- type = "search"
|
||||||
|
-- author = "Sriram SV"
|
||||||
|
-- version = "1.0"
|
||||||
|
-- prefix = "tasker | Tasker | command"
|
||||||
|
|
||||||
|
local md_color = require "md_colors"
|
||||||
|
local orange = md_colors.orange_500
|
||||||
|
|
||||||
|
text_from = ""
|
||||||
|
text_to = ""
|
||||||
|
|
||||||
|
function on_search(input)
|
||||||
|
text_from = input
|
||||||
|
text_to = ""
|
||||||
|
search:show({input},{orange})
|
||||||
|
end
|
||||||
|
|
||||||
|
function on_click(idx)
|
||||||
|
text_from=text_from:replace(" ", "=:=")
|
||||||
|
tasker:send_command(text_from)
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user