I would like to retrieve the price of a share every day and save it in a custom sensor.
I get the price with a json api call. I just can't manage to save the value after "02. open".
Does anyone have an idea?
Code: Select all
json = (loadfile "/home/pi/domoticz/scripts/lua/JSON.lua")() -- For Linux
-- API call
local config = assert(io.popen('curl "https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol='..symbol..'&apikey='..apikey..'&datatype=json"'))
local Stringjson = config:read('*all')
--print(Stringjson)
config:close()
local jsonData = json:decode(Stringjson)
????????