Logic Machine Forum
temperature compare script and FB - 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: temperature compare script and FB (/showthread.php?tid=5138)



temperature compare script and FB - amrMustafa - 07.12.2023

hi 
i need a code to compare between 2 Temperatures (Actual (4/0/3) , Setpoint(4/0/2) ) 
i received a actual point from Keypad and set Point Entered to Knx valve actuator ? and if actual == setpoint write 0 to output (4/0/0) and if else write 1 to same Output !

i write this but not run 
_________________________________________
value_1 = grp.getvalue('4/0/3')
value_2 = grp.getvalue('4/0/2')
if value_1 == value_2 then
grp.write('4/0/0', true) -- bit to 0
else
grp.write('4/0/0', false) -- bit to 1
end
________________________________________

I Need correct code or FB Edit


RE: temperature compare script and FB - Daniel - 07.12.2023

Just swap the true and false.


RE: temperature compare script and FB - amrMustafa - 07.12.2023

(07.12.2023, 08:46)Daniel Wrote: Just swap the true and false.

i did that but the same Problem


RE: temperature compare script and FB - Daniel - 07.12.2023

What is the problem?


RE: temperature compare script and FB - admin - 07.12.2023

What kind of script are you using? Modify script like this and post what you get in Logs tab.

Code:
value_1 = grp.getvalue('4/0/3')
value_2 = grp.getvalue('4/0/2')

res = value_1 ~= value_2
log(value_1, value_2, res)

grp.write('4/0/0', res)



RE: temperature compare script and FB - amrMustafa - 07.12.2023

(07.12.2023, 08:55)admin Wrote: What kind of script are you using? Modify script like this and post what you get in Logs tab.

Code:
value_1 = grp.getvalue('4/0/3')
value_2 = grp.getvalue('4/0/2')

res = value_1 ~= value_2
log(value_1, value_2, res)

grp.write('4/0/0', res)

i write this code but when i test the output not change if the actual not = setpoint no change


RE: temperature compare script and FB - admin - 07.12.2023

What kind of script are you using - event or resident?

For event script you need to map this script to both input group addresses (4/0/2 and 4/0/3).

For resident script make sure that sleep time is not 0 or you will overload LM.


RE: temperature compare script and FB - amrMustafa - 07.12.2023

(07.12.2023, 09:02)admin Wrote: What kind of script are you using - event or resident?

For event script you need to map this script to both input group addresses (4/0/2 and 4/0/3).

For resident script make sure that sleep time is not 0 or you will overload LM.
  • event 



RE: temperature compare script and FB - admin - 07.12.2023

Is this event script attached to both input group addresses (4/0/2 and 4/0/3)?


RE: temperature compare script and FB - amrMustafa - 07.12.2023

(07.12.2023, 09:07)admin Wrote: Is this event script attached to both input group addresses (4/0/2 and 4/0/3)?

i write the same code on resident and it run ..

thank you