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.

Hide seconds when using datatype 3.byte time/day
#2
Maybe this will help you?

Resident script, run every 60 seconds

Code:
---------------------- sent to virtual object for visualisation-------------------------------------------

addresstimewithoutseconds = '32/1/0'            --'Time, and day [Wiser] Visualisation'

now = os.date('*t')

-- system week day starts from sunday, convert it to knx format
wday = now.wday == 1 and 7 or now.wday - 1

-- time table
time = {
day = wday,
hour = now.hour,
minute = now.min,
second = now.sec,
}

-- date table
date = {
day = now.day,
month = now.month,
year = now.year,
}





onlyhourandseconds = string.format("%02d", now.hour)  .. ":" .. string.format("%02d", now.min)

old_value_onlyhourandseconds = grp.getvalue(addresstimewithoutseconds)
if old_value_onlyhourandseconds ~= onlyhourandseconds then
    grp.write(addresstimewithoutseconds, onlyhourandseconds)

---------------------- sent to KNX bus-------------------------------------------
        
        
-- run only on the full hour
min = os.date('*t').min
if min == 24 then                        --    only sent when it is 24 minutes, not every minute
-- write to bus
grp.write('15/0/2', time, dt.time)                --    'Time, and day [Wiser]'
grp.update('15/0/1', date, dt.date)                --    'Datum' Only when date changed
end
    end

i thought creaded by 'Erwin van der Zwart'

15/0/1 11.3 byte date
15/0/2 10.3 byte time / day
32/1/0 250 byte string
Reply


Messages In This Thread
RE: Hide seconds when using datatype 3.byte time/day - by Dré - 22.03.2022, 14:16

Forum Jump: