Logic Machine Forum
250 byte string: strange behavior - 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: 250 byte string: strange behavior (/showthread.php?tid=3040)



250 byte string: strange behavior - Domoticatorino - 02.12.2020

Code:
require('custom.fbeditor20.Time')

functions_Time_json_fbe_operating_hours_input_1 = grp.find('0/1/1')
functions_Time_json_fbe_operating_hours_input_2 = grp.getvalue('32/1/3')
hours = fbe_operating_hours(functions_Time_json_fbe_operating_hours_input_1, functions_Time_json_fbe_operating_hours_input_2, 'fb__New_diagram__fbe_operating_hours__id')
if hours ~= nil then
    grp.checkupdate('32/1/2', hours, 0.01)
end

value = grp.getvalue('32/1/2')

x = math.floor(value)
y = value - x
z = math.ceil(y * 60)


grp.write('32/1/4', x .. ":" .. z) -- 32/1/4 address 250 byte string

Hi there, I use math.floor function to make readable in time format the value of timer. Everything works fine (if 32/1/2 is 3,5 then 32/1/4 = 3:30) but when value of 32/1/2 does not change I do not read 3:30 anymore but a strange string ASCII.

How is it possible? It seems it happens only in a LM machine. In another is ok.

Thanks.


RE: 250 byte string: strange behavior - admin - 02.12.2020

What value exactly do you get in 32/1/4? Try adding log(value, x, y, z) before grp.write to check the variable contents.
Also getvalue() there is not needed since hours variable already contains the same value.
Code:
if hours ~= nil then
    grp.checkupdate('32/1/2', hours, 0.01)
else
  return
end

hour = math.floor(hours)
minutes = string.format('%02d', math.floor((hours % 1) * 60))
text = hour .. ':' .. minutes
grp.write('32/1/4', text)



RE: 250 byte string: strange behavior - Domoticatorino - 02.12.2020

(02.12.2020, 09:01)admin Wrote: What value exactly do you get in 32/1/4? Try adding log(value, x, y, z) before grp.write to check the variable contents.
Also getvalue() there is not needed since hours variable already contains the same value.
Code:
if hours ~= nil then
    grp.checkupdate('32/1/2', hours, 0.01)
else
  return
end

hour = math.floor(hours)
minutes = string.format('%02d', math.floor((hours % 1) * 60))
text = hour .. ':' .. minutes
grp.write('32/1/4', text)


Enclosed what I mean. But the log of hour and minutes is correct. It seems that this problem occurs only in the machine LM5CLp2.

In LM5Lite knx no problem.

Thanks.

BR


RE: 250 byte string: strange behavior - Daniel - 02.12.2020

Do you have FB editor with same version on both devices?


RE: 250 byte string: strange behavior - admin - 02.12.2020

Is the value displayed correctly in the object list in LM configurator? Or is it the same as in Mosaic?


RE: 250 byte string: strange behavior - Domoticatorino - 02.12.2020

(02.12.2020, 12:42)admin Wrote: Is the value displayed correctly in the object list in LM configurator? Or is it the same as in Mosaic?

Hi admin,the fb editor is the same. And the problem occurs in Mosaic and object list as well.

Thanks.

Br


RE: 250 byte string: strange behavior - admin - 02.12.2020

Can you provide a backup from this device?


RE: 250 byte string: strange behavior - Domoticatorino - 02.12.2020

(02.12.2020, 12:53)admin Wrote: Can you provide a backup from this device?

Sent you by private message.

Thanks.


RE: 250 byte string: strange behavior - admin - 02.12.2020

You have a resident script "Date & Time" that's writing different data to the same object:
Code:
grp.update('32/1/4', time, dt.time)



RE: 250 byte string: strange behavior - Domoticatorino - 02.12.2020

I am sorry for that! I did not check inside that script which I do not use.

I have to send you a gift for Xmas.

Thank you mate!!