Logic Machine Forum
Write value to another LM without KNX IP - 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: Write value to another LM without KNX IP (/showthread.php?tid=989)



Write value to another LM without KNX IP - savaskorkmaz - 13.09.2017

Hi,
I have point in my LM (LM-1) which is a 255 byte string type point. When I change value of this point, I want to write to another 255 byte string type point which is located in another LM (LM-2). I cannot use KNX IP futures or something (Because there are same KNX addresses in another LM's) 
I need a script which write value to another LM contains IP address of LM and KNX Point address. 

Thanks,


RE: Write value to another LM without KNX IP - admin - 13.09.2017

You can either setup KNX/IP filteting so only one required group address is passed (which is not used on the bus). Or you can send via HTTP requests: http://openrb.com/docs/remote-new.htm


RE: Write value to another LM without KNX IP - savaskorkmaz - 13.09.2017

We cannot use filtering. We already used filtering for another purposes. I would like to try http request. But this http request must be trigger by event script. Can i write this http request line in to event script ?


RE: Write value to another LM without KNX IP - admin - 13.09.2017

Yes, by using Luasocket HTTP: http://w3.impa.br/~diego/software/luasocket/http.html#request


RE: Write value to another LM without KNX IP - savaskorkmaz - 13.09.2017

Hi ,
If you write one script regarding to example written below, it will be better.
Source object : LM4 , 192.168.1.80 , 1/1/1 , value : 'Hello World This is may message'
Destination object : LM4 192.168.1.82 , 3/2/2 (username:remote , password:remote )

Regards


RE: Write value to another LM without KNX IP - admin - 13.09.2017

This is very trivial. Next time please try using provided examples in the documentation.

Code:
http = require('socket.http')
url = require('socket.url')
http.TIMEOUT = 5

value = event.getvalue()
req = 'http://remote:remote@192.168.1.12/scada-remote?m=json&r=grp&fn=write&alias=3/2/2&value='
http.request(req .. url.escape(value))



RE: Write value to another LM without KNX IP - savaskorkmaz - 20.09.2017

It worked for the objects those are not binary.. Thanks a lot. For binary points, true and false values are not send with this method. Do you have any suggestion.
Regards,


RE: Write value to another LM without KNX IP - Erwin van der Zwart - 20.09.2017

Hi,

Add this below value = event.getvalue()
Code:
if type(value) == "boolean" then
  value = tostring(value)
end

BR,

Erwin


RE: Write value to another LM without KNX IP - savaskorkmaz - 20.09.2017

(20.09.2017, 15:25)Erwin van der Zwart Wrote: Thank you.

Hi,

Add this below value = event.getvalue()
Code:
if type(value) == "boolean" then
  value = tostring(value)
end

BR,

Erwin