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.

Strange script behaviour
#2
are you sure it is from this script?
What happened if you disable this script, stopped update sunrise/sunset too?
I see you also use tags, is there a script that start run script wit tag 'KNX Response'? Or why do you use these tags?

It looks like 0/1/3 doesn't work, find?


I use script below.

If i look at both, you have to change
Code:
string.char
with
Code:
string.format

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-------------------------------------------
        
if now.min == 21 then                        --    only sent when it is 21 minutes

-- write to bus
grp.write('15/0/2', time, dt.time)                --    'Time, and day [Wiser]'
grp.checkwrite('15/0/1', date, dt.date)                --    'Datum' Only when date changed
end
    end
Reply


Messages In This Thread
Strange script behaviour - by gtsamis - 11.06.2022, 08:36
RE: Strange script behaviour - by Dré - 12.06.2022, 10:16
RE: Strange script behaviour - by gtsamis - 26.06.2022, 15:13
RE: Strange script behaviour - by Dré - 26.06.2022, 15:40
RE: Strange script behaviour - by gtsamis - 26.06.2022, 15:56
RE: Strange script behaviour - by Dré - 26.06.2022, 15:57
RE: Strange script behaviour - by gtsamis - 26.06.2022, 16:09
RE: Strange script behaviour - by admin - 27.06.2022, 06:25
RE: Strange script behaviour - by gtsamis - 27.06.2022, 07:02

Forum Jump: