Supergiovane / node-red-contrib-knx-ultimate

Control your KNX intallation via Node-Red! A bunch of KNX nodes, with integrated Philips HUE control and ETS group address importer.
https://youtu.be/egRbR_KwP9I
MIT License
145 stars 34 forks source link

stops to send KNX Telegrams #119

Closed croghostrider closed 3 years ago

croghostrider commented 3 years ago

Hi Supergiovane

your node is amazing thanks for the work.

Describe the bug it stops to send KNX Telegrams

To Reproduce use the ABB i-bus tool on the same PC

Knx-Ultimate Version

Are you running node-red behind homematic, docker or anything similar?

Additional context after a few minutes of working with the i-bus tool, the node stops working. In the NodeRed UI, no error appears, everything looks fine. While working with the i-bus tool I see RangeError [ERR_BUFFER_OUT_OF_BOUNDS] messages in the debug file: image

Here the moment when I think it stops working: image

a redeploy of the flow or restart node-red doesn't solve the problem. If I restart the PC everything works fine.

Supergiovane commented 3 years ago

Hmmm... maybe the i-bus tool sends some datagram that are not good for knx ultimate. Tomorrow i’ll take a look

Supergiovane commented 3 years ago

Hi Crog, i tried reproducing your issue by forcing the bad message. I get the log messages as you, but knx-ultimate still work. It simply discards the bad socket message. The pink arrow is where i force the bad message. The yellow one, is where the error occurs.

Cursor_e_Connection_js_—_KNXUltimate__Workspace_

The whole process is under TRY CATCH boundary, so it's correclty handled over by the catch, that simply logs and ignore the message. Please check the node version (node -v in a prompt command). Be sure to use the latest node version, because i think it could be something wrong with the node socket stack in windows.

Supergiovane commented 3 years ago

PS: for you information, the message corresponding to the bad string is coming from your device 12.7.3 with group address 2.3.0:


{
  header_length: 6,
  protocol_version: 16,
  service_type: 1328,
  total_length: 16,
  cemi: {
    msgcode: 41,
    addinfo_length: 0,
    ctrl: {
      frameType: 1,
      reserved: 0,
      repeat: 1,
      broadcast: 1,
      priority: 0,
      acknowledge: 0,
      confirm: 0,
      destAddrType: 0,
      hopCount: 5,
      extendedFrame: 0
    },
    src_addr: '12.7.3',
    dest_addr: '2.3.0',
    apdu: {
      apdu_length: 0,
      apdu_raw: <Buffer ca>,
      tpci: <Buffer ca>,
      apci: 'NCD_ACK Seqnum: 2',
      data: null
    }
  }
}
Supergiovane commented 3 years ago

Thank you Vinko for the donation! Really appreciate that. Please try to update to the latest version.

croghostrider commented 3 years ago

I have updated the node.js to v14.16.1 and it happens again. here the log file log.txt

at 15:39:44 I receive the e-mail from the watch dog.

Here the watchdog settings: image

Supergiovane commented 3 years ago

Hi Please update knx-ultimate to the latest version. It uses the new api v2. It seems that the messages flow keeps working. Is your problem related to knx-ultimate or to knx watchdog?

EDIT: since when you have this issue? Do uou maybe have some sort of udp storm blocking on your ethernet switch? Next time, instead of rebooting the PC, please try disconnecting and reconnecting the ethernet cable.

croghostrider commented 3 years ago

Now I have updated to 1.2.18. I think also the flow keeps working. To knx-ultimate, I have added the watchdog only for debugging so that I notice when it stops working. I think the first time it happens 3 months ago, since approx. two weeks it happens often. Tomorrow I will check if the switch so kind of udp storm blocking has. And since two weeks I have started to use it more often the I bus tool, so my guess was that it was the i-bus tool.

Supergiovane commented 3 years ago

You can try to set ibus tool to connect to your Spacelogic using a unicast tunnel (knx routers should have some free tunnels as well) and leave knx-ultimate connect using multicast.

croghostrider commented 3 years ago

Hi Supergiovane,

now I am sure that it is related to the i-bus tool. I need only to open the i-bus tools and the node stops working properly. I don't need to select the interface, it happens after the search request for the routers. And it happens only if I start the tool on the same PC.

Here the Wireshark cap file: knx.zip

At packet 851 is the moment when the tool start, a short moment later the node stops working. It doesn't make sense to me :(

and if I reconnecting the ethernet cable it works again.

Supergiovane commented 3 years ago

I'm taking a look at it. Reconnecting the eth cable forces all sockets (ibus and node-red) to reset. I'll try to reproduce your environment on a virtual machine and i'll let you know, but as i said, the "SEARCH" action is simply ignored by knx-ultimate. There must be something with win socket disturbing the process.

Supergiovane commented 3 years ago

Ok, i've setup an environment with node 14.16.1 like you, installed node-red, installed i-bus. See here, my video. It works. I suspect there is something wrong with your KNX/IP router, or some mess around your windows socket system. As suggestion, use a dedicated PC/Raspberry for node-red. Leave it alone running quietly.

https://user-images.githubusercontent.com/37666636/114187258-11c8cf00-9948-11eb-881f-48c6c8d5a160.mov

croghostrider commented 3 years ago

thanks for the testing. Receiving telegrams works also on my PC only the sending fails. See please my video: https://youtu.be/1E-jJY_RmBo

Supergiovane commented 3 years ago

Hi yes, sorry, i tested the TX part as well but forgot to upload. Here, tested again yet.

https://user-images.githubusercontent.com/37666636/114212976-b8ba6480-9962-11eb-8a4c-f7ff7d2edbab.mov

PS: in the ETS diags i see the telegrams as well.

Supergiovane commented 3 years ago

A little follow up: i think, your KNX Router ceases to accept telegrams when two messages arrives from the same endpoint. Have you tried to set either KNX-Ultimate or i-Bus to connect to your KNX Router via a unicast connection, using one of the tunnel? Instead of putting the multicast IP in the IP field, put the KNX Router real IP. Then try again. It should work.

croghostrider commented 3 years ago

with an ABB IPR/S3.1.1 Router it happens too, which router do you have? I-bus do only on startup a multicast search request, then connects via unicast. If I connect KNX-Ultimate over unicast it seems to be working.

Supergiovane commented 3 years ago

I tried with an Eibmarkt IP Router and with an Enertex IP Router. What if you directly connect the KNX Router via a cable, with your PC? I wish to exclude all things inbetween. At this point, i’m not sure the Router is the culprit.

croghostrider commented 3 years ago

I can't try that until next week, I am not more on-site. The switch is a netgear gs110tp, and the router is one from the provider (Swisscom Centro Business 2.0). I have a TeamViewer connection if you want to test sommting else.

Supergiovane commented 3 years ago

Hi Verify that the storm protection and all protections on netgear are off. Then try again opening ibus https://www.manualslib.com/manual/419368/Netgear-Gs110tp-Prosafe-Gigabit-Smart-Switch.html?page=174

Supergiovane commented 3 years ago

Hi Vinko, i haven't heard nothing from you since 4 days. Can you give me a feedback? Thanks

KNXfriend commented 3 years ago

Hi, I´m a new user since yesterday and experience somthing, which might be connected to the discussion here:

Node Red reads group telegramms from the KNX bus propperly, but the telegrams are not sended to the bus.

Discussions with the manufacturer of the IP interface lead to the analyzis, that there is a special flag in the telgramm data set unusually and leads with my IP interface to the behaviour, that this telegram is not send to the bus:

The flag is the "requests ACK" flag in the telegramm. Seams it is set to "request ACK" from the Node Red side and this leads to a not sending of the telegram, because this is not allowed/valid by the KNX standard "for all media".

Here are to bits of rawdata of telegramms, which should result in the same group operation (0/0/5 off), but first is not send out to the bus because of the described flag (second is working fine):

2900 BE E011FA0005010080 (NOT working) 2900 BC E011010005010080 (working)

Seams the problem (for my case) is related to this one bit difference between BE and BC.

Hope this might help and lead to a solution.

Supergiovane commented 3 years ago

Hi KNXFriend, in the config help page, there is a Suppress ACK request option. Have you tried to enable the suppression?

Other than that, there is a Troubleshot page, if you still have issues.

KNXfriend commented 3 years ago

That´s it! Sorry to have bothered you with that. I havent found this options again ...

Thank´s for the great work!

Supergiovane commented 3 years ago

No problems, i'm here to help. Please let me know if it works. You may need to restart node-red after that change.

KNXfriend commented 3 years ago

It´s all right. That does the trick!

I´m happy! Thank you very much!

croghostrider commented 3 years ago

Hi Supergiovane

sorry, it was my mistake. It is a Netgear GS108V4 switch, this switch is not managed. I tried today to connect the PC directly to the KNX-Router, with the same result.

I will install proxomox on my PC and run the ABB tool and the node-red in separatet VMs. That should solve my problem.

I noticed during the test, that your node send the UDP Mulicast packates with a TTL = 1. And the ABB and SpaceLogic Router have a TTL = 16.

With a TTL from 1 it is not easy possible to do a KNX Backbone over two VLANs. Is there a reason why your node uses only a TTL = 1.

Supergiovane commented 3 years ago

Hi TTL = 1 ? I'll take a look.

Supergiovane commented 3 years ago

PS: you can also leave knx-ultimate connect to a unicast tunnel on your KNX Router. This will save you installing Proxmox (proxmox is great, i've used it with success, before switching to QNAP Virtualization Station).

Supergiovane commented 3 years ago

PPS: By default, IP multicast datagrams are sent with a time-to-live (TTL) of 1. This value prevents the datagrams from being forwarded beyond a single subnetwork. I will ditch into it to see if i can increase the TTL without impacting the already working installations.

Supergiovane commented 3 years ago

Hi Vinko i increased the Multicast TTL to 16. Can you try this by unzipping the zip into the .node-red/node_modules/node-red-contrib-knx-ultimate/knxultimate-api2/src and restart node-red?

IpRoutingConnection.js.zip

croghostrider commented 3 years ago

you are faster as the support from ABB, KNX Association, and Loxone together.

it looks fine: image

PS: you can also leave knx-ultimate connect to a unicast tunnel on your KNX Router. This will save you installing Proxmox

you're right. But it was my plan anyway to install Proxmox, it makes it easier to test things.

As soon I have a little bit more time my plan is to create ultimate knx pocket-size tool :) based on the raspberry pi compute module. With your node,i-bus tool, VPN, LTE, and the SpaceLogic Router as TP interface (I think it is the smallest IP-Router without support voltage).

Supergiovane commented 3 years ago

Interesting. As soon as you are done, remember that i can mention you on the KNX-Ultimate README page, with your logo and link to your pocket-size tool. Obviously for free. ;-)