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.

Rolling PIN Code
#5
(10.06.2026, 08:43)admin Wrote: Use the following functions to set plan/widget pin code. For widget you need specify both plan ID that contains the widget and the widget ID. Plan ID / widget ID can be found in the window title when editing.

Important: pin code value must be a string. New pin code must have the same length as the previous.

Code:
function setplanpin(planid, pincode)   local json = require('json')   local structure = storage.exec('hget', 'app:visu:main', 'structure')   local function setpin(items)     for _, item in ipairs(items) do       if item.id == planid then         item.pincode = pincode         return       end       if type(item.children) == 'table' then         setpin(item.children)       end     end   end   structure = json.decode(structure)   setpin(structure)   local data = json.encode(structure)   storage.exec('hset', 'app:visu:main', 'structure', data) end setplanpin(41, '123456')

Code:
function setwidgetpin(planid, widgetid, pincode)   local json = require('json')   local key = 'widgets:' .. planid   local widgets = storage.exec('hget', 'app:visu:main', key)   widgets = json.decode(widgets)   for _, widget in ipairs(widgets) do     if widget.id == widgetid then       widget.pincode = pincode       break     end   end   local data = json.encode(widgets)   storage.exec('hset', 'app:visu:main', key, data) end setwidgetpin(41, 42, '123456')

Could i load the PIN from a 250byte string object?
In this way i could write the PIN to the datapoint when i load it from the PIN Generator at the tennis federation (in this case)
Reply


Messages In This Thread
Rolling PIN Code - by KoBra - 09.06.2026, 16:58
RE: Rolling PIN Code - by admin - 10.06.2026, 08:00
RE: Rolling PIN Code - by KoBra - 10.06.2026, 08:13
RE: Rolling PIN Code - by admin - 10.06.2026, 08:43
RE: Rolling PIN Code - by KoBra - 10.06.2026, 15:53
RE: Rolling PIN Code - by Daniel - 10.06.2026, 16:59

Forum Jump: