Logic Machine Forum
Strange script behaviour - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Strange script behaviour (/showthread.php?tid=4086)



Strange script behaviour - gtsamis - 11.06.2022

Hi,

I have a resident script that is set to update 3 objects (date, time and datetime) but it also updates two other objects (sunrise time and sunset time) althougt there is no command on the script.
Can someone pinpoint why this happens?

DateTime Update resident script (runs every 60sec)
Code:
-- get current data as table
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,
}

--- full date bits
OCT08 = now.year - 1900
OCT07 = now.month
OCT06 = now.day
OCT05 = bit.bor(bit.lshift(wday, 5), now.hour)
OCT04 = now.min
OCT03 = now.sec
OCT02 = 0 -- subfields like working day and dst not specified in this sample
OCT01 = 0 -- subfields like quality of clock not specified in this sample

-- write to bus
date_time = string.char(OCT08) .. string.char(OCT07) .. string.char(OCT06) .. string.char(OCT05) .. string.char(OCT04) .. string.char(OCT03)  .. string.char(OCT02)  .. string.char(OCT01)
grp.checkwrite('0/1/1', date, dt.date)
grp.checkwrite('0/1/2', time, dt.time)
grp.checkwrite('0/1/3', date_time, dt.string)
  
   


RE: Strange script behaviour - Dré - 12.06.2022

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



RE: Strange script behaviour - gtsamis - 26.06.2022

Sorry for late reply...
For sure the date time update script has nothing on it that sould update sunset and sunrise, also there is no other script or function that has to do with sunset and sunrise.
Trying to figure out what is going on i disabled all scripts, changed the LM's device address and all three objects (date, time, datetime, sunset and sunrise) are still getting updated by LM!!!. Final work around was to delete completely the date time update script and all 5 objects are still updating every minute!

Also on object logs those apdates are having source address the LM's physical address but everything else updating from LM has "local" as scource.


   
   


RE: Strange script behaviour - Dré - 26.06.2022

It looks like it is not coming from you LM, but from another device with adres 1.1.123.
What adres has the LM, i think different then 1.1.123 (because if it is from LM, you see local instead of the adres.
Look at you ETS program and find the device with adres 1.1.123 and check the parameters to disable it or remove the adres at that device (if you want).

If you still think the LM is the one who sent it, change the adres of the LM again and look if the adres of the source change too.


RE: Strange script behaviour - gtsamis - 26.06.2022

(26.06.2022, 15:40)Dré Wrote: It looks like it is not coming from you LM, but from another device with adres 1.1.123.
What adres has the LM, i think different then 1.1.123 (because if it is from LM, you see local instead of the adres.
Look at you ETS program and find the device with adres 1.1.123 and check the parameters to disable it or remove the adres at that device (if you want).

If you still think the LM is the one who sent it, change the adres of the LM again and look if the adres of the source change too.

The 1.1.123 is the changed physical address of the LM. It is 100% sure it is coming from LM because ia have disconected everything else on the BUS side.


RE: Strange script behaviour - Dré - 26.06.2022

Oh oké i didnt know, did you also reboot your LM?
It is strange he show the adres instead of local.


RE: Strange script behaviour - gtsamis - 26.06.2022

(26.06.2022, 15:57)Dré Wrote: Oh oké i didnt know, did you also reboot your LM?
It is strange he show the adres instead of local.

Actualy it is strange because there is nothing "visible" on LM that justifies this behaviour.
I think Daniel or admin might have the answer.


RE: Strange script behaviour - admin - 27.06.2022

As Dré correctly mentioned any telegrams not marked as local are coming from outside of LM. Do you have KNX/IP enabled? Are there any other LMs or KNX routers on the same network?


RE: Strange script behaviour - gtsamis - 27.06.2022

(27.06.2022, 06:25)admin Wrote: As Dré correctly mentioned any telegrams not marked as local are coming from outside of LM. Do you have KNX/IP enabled? Are there any other LMs or KNX routers on the same network?

Telegrams are showing the LM's physical address (1.1.123 or what ever i've set up on LM), i have also disconected TP and still got those updates.
KNX/IP is enabled and there are no other LMs or IP Router inside my network.

UPD: Disabled KNX/IP and it stoped the updates, so i guest those are coming from an ip device... is there anyway to trace ther scource from LM or should i use wireshark?