This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

KNX/TP link scripting
#1
Hello

is there some way I can use the value from   KNX/TPOK  to write a tag in the system
This should we written into a group-address when it fails.
When TP line is "dead" i want to write a 1 in e.g. grp.addr (0/0/1)
This because I want to export it as a BACnet Tag, to alert when Line is dead.

Is this possible, how can I script this, i Guess KNX/TP-status is a reachable resource.. 
Also: When this occurs I get a message from LogicMachine, telling me KNX/TP AND scripting do NOT work..
I assume this is only for scripts using read or write to the BUS.. other Scrips witch is only on HTTP/database etc, I guess still works.
I therefore assume: IF I Can set the KNX group to 1 in LogicMachine, the corresponding BACNet-tag will be read as a 1 aswell.
The groupadress will not be used for anything on KNX-bus.
Reply
#2
See this topic for a solution:
http://forum.logicmachine.net/showthread...66#pid3466
Reply
#3
(27.03.2017, 13:49)admin Wrote: See this topic for a solution:
http://forum.logicmachine.net/showthread...66#pid3466

OK 

Is'nt this script for KNX/IP?
I need to know when TwistedPair fails. This Because the BACNet tags are OK, eventhough TP is down for weeks. 
I need a alarm for this. Writing (0 and 1) to a grp.addr --> BACNet tag seems to be the easiest way.
Reply
#4
No, this is exactly for TP connection status.
Reply
#5
Ok. this did not work for me, I hoped it was because it was KNX/IP, but it probably did not work since I lack some LUA skills.. 
I get the following errror:
Lua syntax error at line 2: '=' expected near 'statushandler'
The LM is out of the box and nothing else is defined in scrips. I copied it exactly as it was written. 

My programming skills are based on stealing and adapting. Any Idea what easy part I am missing out here?
Reply
#6
Try removing all leading spaces like this:
Code:
if not client then
function statushandler(status)
if status == 0x00 then
-- KNX Connected
elseif status == 0xFF then
-- KNX Disconnected
end
end
client = require('localbus').new(1)
client:sethandler('status', statushandler)
end
client:step()
Reply
#7
(28.03.2017, 08:31)admin Wrote: Try removing all leading spaces like this:

Ahh that helped.. not the first time I did that mistake.. :-(

Now the script is acceppted. But, it still do not work. 
I inserted both: 
      grp.write('0/0/1', true)
      grp.write('0/0/1', false)
and later  
     grp.update('0/0/1', true)

But the change never occurs. the address 0/0/1 is never changed or written.
I tried it both without and with sleep interval, and i also pulled and reset the KNX-plug. Nothing ever happens.
Do i need something in user.lib?
Reply
#8
Sleep interval must be set to 0. It will only monitor current bus status events, previous state is not reported in any way. Bus status change is not instant, some small amount of time must pass before disconnect event is reported.
Reply
#9
I found the propable cause to my problems.
- client = require('localbus').new(1)
In Error log it is stated: module 'localbus' not found: nopackage.preload['localbus'] no file '. localbus......

So is localbus an old name, thats changed in newer firmware?
Reply
#10
You're probably running an old firmware.
Reply
#11
(28.03.2017, 10:57)admin Wrote: You're probably running an old firmware.

You are perfectly right. It was.. 
Just took it out of the box, so I did not consider it. But the LM4 instead of LM5 logo should indicate a older fw. I probably have the last LM4 in europe..

btw. I changed script from 
status == 0x00 an 0xFF to
status == 0 and 255  (I have issues with thinking in hex-format)

But what you in script indicated as KNX connected is opposite 
I found 0 = disconnected  and 255 is connected

Thank you for your patience and help!
Reply


Forum Jump: