Logic Machine Forum
Get value from KNX and make script in LM - 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: Get value from KNX and make script in LM (/showthread.php?tid=4997)



Get value from KNX and make script in LM - Alexander - 28.09.2023

Hi,

I have a away button on a touchpanel that sends a binary value (1 - away, 0 - home). (10/0/1)

And I want to create a event script that when I get the value 1 from my KNX it will set a new value on my ventilation via Bacnet. 

I've already have a event script on my ventilation, as my picture is showing. 

How does I create a event script on 10/0/1 that will set new value on 29/0/6?


RE: Get value from KNX and make script in LM - admin - 29.09.2023

Event script attached to 10/0/1:
Code:
value = event.getvalue()
grp.checkwrite('29/0/6', value)



RE: Get value from KNX and make script in LM - Alexander - 29.09.2023

(29.09.2023, 07:33)admin Wrote: Event script attached to 10/0/1:
Code:
value = event.getvalue()
grp.checkwrite('29/0/6', value)

I've should have mentioned that 29/0/6 is a 1 byte value. So 0 - Stop, 1 - Low, 2 - Home, 3 - High. 
So I when the value from my touchpanel is 0, I want it to set the value to 2 (Home), and with 1 to 3 (High).


RE: Get value from KNX and make script in LM - Alexander - 01.10.2023

I have tried this, but it doesn't work:

value = event.getvalue()

if value == 1 then
grp.checkwrite('29/0/6', 4)
end

if value == 0 then
grp.checkwrite('29/0/6', 3)
end

log(res, err)

The log is:
* arg: 1
* nil
* arg: 2
* nil


RE: Get value from KNX and make script in LM - Erwin van der Zwart - 01.10.2023

Try with false and true instead of 0 and 1, remove also the log(res,err) as you don’t declare the variables anywhere, as they don’t exist here, the logically return ‘nil’

PS: log(value) will tell you the content of the variable and makes it easier to determine where you should compare it with in your conditions…


RE: Get value from KNX and make script in LM - Alexander - 01.10.2023

(01.10.2023, 08:13)Erwin van der Zwart Wrote: Try with false and true instead of 0 and 1, remove also the log(res,err) as you don’t declare the variables anywhere, as they don’t exist here, the logically return ‘nil’

PS: log(value) will tell you the content of the variable and makes it easier to determine where you should compare it with in your conditions…

That was the case. Thanks a lot!