This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Timedependent output from string
#2
Modify the script that fetches the prices so it saves the list of cheapest hours into storage:
Code:
list = {}
price_hours = {}

for i = 1, 4 do
  item = data[ i ]
  list[ i ] = string.format('%d = %.2f', item.hour, item.SpotPriceDKK)
  price_hours[ i ] = item.hour
end

storage.set('price_hours', price_hours)

hours = table.concat(list, '; ')
grp.checkupdate('13/4/28', hours)

Then create a scheduled script that runs every hour at 0 minutes:
Code:
currhour = os.date('*t').hour
hours = storage.get('price_hours', {})
found = false

for _, hour in ipairs(hours) do
  if currhour == hour then
    found = true
  end
end

grp.checkwrite('1/1/1', found)
Reply


Messages In This Thread
Timedependent output from string - by ClausP - 29.11.2022, 10:51
RE: Timedependent output from string - by admin - 29.11.2022, 12:56

Forum Jump: