Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KNX Communication - uncalled UDP response #68

Open
HomeAsASystem opened this issue Jan 29, 2019 · 13 comments
Open

KNX Communication - uncalled UDP response #68

HomeAsASystem opened this issue Jan 29, 2019 · 13 comments

Comments

@HomeAsASystem
Copy link

HomeAsASystem commented Jan 29, 2019

Have you ever experienced this issue ?

#arendst/Tasmota#5053

I've got the same behaviour not only with Tasmota but also with the esp-knx-ip/sonoff example

@envy
Copy link
Owner

envy commented Jan 29, 2019

Hi,

no I haven't. What I gather from your bug report is this:

  1. You boot the ESP device.
  2. Some communication happens on the KNX Multicast IP
  3. The ESP responds with packets of length 0. This only happens if the ESP has not sent own KNX packets before.

Is this correct? I have to investigate this, but unfortunately I don't have access to my lab this week, so maybe next week at the earliest.

@HomeAsASystem
Copy link
Author

Hi,
My description was not very clear.
After booting up the device it responds to every KNX multicast telegram which is send from any device to the KNX multicast address 224.0.23.12:3671.
As long as the device has not sent any KNX/IP message the response is targeted to 0.0.0.0:0, but once the device has sent a KNX/IP message, the UDP response is send to the KNX multicast address 224.0.23.12:3671.
So in summary, the device always responds to the multicast telegram, but the destination address of the response changes, once the device has sent an own KNX/IP telegram. I believe the root cause is somewhere in the TCP/IP or IGMP implementation of the ESP8266 stack or in a wrong configuration of the IGMP function. I removed the igmp_joingroup statement in the WifiUdp Class, then the device does not respond anymore to the multicast telegrams, but it also does not react anymore on the KNX/IP telegrams send to the device.

@d-a-v
Copy link

d-a-v commented Jan 29, 2019

As long as the device has not sent any KNX/IP message the response is targeted to 0.0.0.0:0, but once the device has sent a KNX/IP message, the UDP response is send to the KNX multicast address 224.0.23.12:3671.

This is still a bit unclear,

  • "device" is ESP ?
  • if so, KNX/IP message the response is targeted to 0.0.0.0:0 is sent by ESP,
  • the UDP response is send to, "response" is from the ESP ?

(I am maintainer in the esp8266 arduino core, especially the lwIP adaptation layer)

@HomeAsASystem
Copy link
Author

HomeAsASystem commented Jan 29, 2019

Sorry for being not precise enough.
Please see below a wireshark trace of the issue.

  • 192.168.1.40 is my ESP8266 Device
  • 192.168.1.99 is my KNX-IP Gateway
  • 224.0.23.12 is the KNXnet multicast address

image

I restartet the ESP Device before line 4041.
Line4041: The KNX-IP Gateway sends a KNXnetIP message to the KNX multicast address.
Line4045: The ESP [email protected] responds with an UDP message to the destination IP 0.0.0.0.
Line4054,4055,4060,4061,4072,4073: same behaviour
Line 4083-4086: The ESP [email protected] sends its KNXnetIP telegrams to the KNX multicast address.
Line 4093: The KNX-IP Gateway sends a KNXnetIP telegram to the KNx multicast address
Line 4094: The ESS [email protected] is the responding not anymore to 0.0.0.0 but to the KNX multicast address 224.0.23.12.

This leads to warnings in my OpenHAB server, as it detects invalid messages send to the KNX mutlicast address.
image

hope this helps to understand the issue
br

@envy
Copy link
Owner

envy commented Jan 29, 2019

Are the messages sent by your gateway destined for the ESP (e.g., reads or writes to the ESP)? Or are they destined for some other KNX device?

If it's the first, that means, the ESP is answering to the wrong address.
If it's the second, then the ESP is answering to messages, it's not supposed to answer to.

@HomeAsASystem
Copy link
Author

the messages of the IP gateway have no specific target, as it is the nature of the KNXnetIP protocol that all communication is send to the KNX multicast group address. Also the ESP device sends all its KNX messages to the KNX multicast address.
I've also testet it in a setup where i had only two ESP devices with KNX protocol in a private WIFI. Even there on ESP device responded to the KNX messages of the other ESP device with an UDP response. It seems like there is an acknowledge implemented if an ESP device joins a multicast group. But as far as i understand this is not the purpose of UDP multicast

@envy
Copy link
Owner

envy commented Jan 29, 2019

the messages of the IP gateway have no specific target, as it is the nature of the KNXnetIP protocol that all communication is send to the KNX multicast group address. Also the ESP device sends all its KNX messages to the KNX multicast address.

I meant, if your gateway is sending a KNX group read/write to a group address that the ESP is configured to react upon, i.e. you send group write to 1/2/3 and the ESP toggles a lamp and then send back a status to 4/5/6. I want to know if this answer message is instead send to 0.0.0.0.

Or if your KNX message is sent to a group address that is not configured on the ESP and the ESP is answering anyway even though it should not do that.

@HomeAsASystem
Copy link
Author

the Gateway is sending all sort of GA's as my openHAB server reads all the KNX GA's on the KNX TP installation.
The ESP device responds to all messages of the IP Gateway. No matter if the GA's are addressed to the ESP device or not. The 192.168.1.40 device even has no receiving GA's configured as there is only a BME680 sensor connected to.

@envy
Copy link
Owner

envy commented Jan 29, 2019

Ok, so it is sending packets, even though it should not. I have to investigate if this is a bug on my side or one inside the ESP framework (or lwip). But if the responding stops when the ESP sent a message on its own, then it sounds more like a bug inside the ESP framework (or lwip).

Did you try the different lwip versions available?

@HomeAsASystem
Copy link
Author

HomeAsASystem commented Jan 29, 2019

Another missunderstanding. When the ESP sent a message on its own, it still continues to respond to any incoming KNXnetIP multicast telegram. It only changes the destination IP of its reponse from 0.0.0.0 to 224.0.23.12. The message is even an invalid UDP message and does not contain any usefull information. The ESP device is not supposed at all to respond to the KNXnetIP telegrams from the IP-KNX gateway.
I haven't used any different lwip version. I tried it with ESP platform 2.4.2 as well as 2.5.0

@HomeAsASystem
Copy link
Author

I also think it is related to the esp framework. I've disabled any sending and receiving within your knx code. As soon as the esp device joins an igmp group this behaviour turns up

@roelbroersma
Copy link

I am seeing the same behavior.

The ESP just always answers with an UDP 0 (zero) to the 0.0.0.0 IP address. Very strange...

I never seen this before and I have seen a lot of KNX routers like Gira (all variants), MDT,..and more.

Even when this esp-knx-ip Library is only loaded and Nothing is configured.. the ESP just starts to 'answer' all Multicast calls with the UDP 0 message.

@ascillato
Copy link
Contributor

Please, try latest arduino core from arduino. The STAGE version that will became soon the 2.6.0 has solved several bugs. I use it and I couldn't reproduce your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants