envy / esp-knx-ip

A KNX/IP library for the ESP8266 with Arduino
MIT License
136 stars 49 forks source link

Using ESP-KNX-IP Library to connect to Home Assistant #33

Closed ascillato closed 6 years ago

ascillato commented 6 years ago

This is a workaround explanation for using ESP-KNX-IP Library to connect to Home Assistant.

The link between Home Assistant and a KNX Router, is the XKNX Python Library.

Side note: If you don't have a KNX Router, you can use KNXd on the same Raspberry Pi than Home Assistant.

There is a bug using XKNX Library on Home Assistant, that makes XKNX Library not understanding ESP-KNX-IP (Issue https://github.com/XKNX/xknx/issues/112)

While waiting for response on the XKNX issue, the checksum can be eliminated changing esp-knx-ip-send.cpp#L69 for udp.write(buf, len-1)

With this you can have a working ESP-KNX-IP Library for testing on Home Assistant until the bug is solved.

envy commented 6 years ago

So the checksum is a very interesting thing. In the KNX spec pdfs I have here, there is no mention of it, at least I can't find it at the moment.

I recorded some messages with tcpdump and found out that openHAB does not include a checksum to its packets whereas my KNX IP Router (ABB IPR/S3.1.1) is adding one but sets it to 0x00.

Maybe it is not even needed? I can't find the reference I used that said that there is a checksum field but everything worked in my environment with real KNX devices so I thought it is correct.

Maybe we should find out if it really is part of the spec or not.

ascillato commented 6 years ago

Me neither. I could not find anything about the checksum.

I'm waiting the response of the author of XKNX Library for Home Assistant but seems that there is no need for checksum. May be that the KNX Devices are ingnoring the last byte, thats why the KNX network continue working.

Better could be add the ACK response and resend if NACK is received.