openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.58k forks source link

[tr064] Binding composes wrong URL when using FRITZ!Box IP-Address - COMMUNICATION_ERROR #13720

Closed danielkr123 closed 1 year ago

danielkr123 commented 1 year ago

I have a FRITZ!Box7590AX which I would like to connect to openHAB3. To create a thing for the FRITZ!Box and configure the binding I am using the openHAB GUI. When I enter the IP-Address, the GUI always adds a trailing "/". Subsequently, the binding throws an error:

Expected Behavior

Binding should pull the device definitions from URL: http://192.168.17.23:49000/tr64desc.xml and connect to the FRITZ!Box

Current Behavior

Setting the openHAB log to debugging mode for the binding (log:set DEBUG org.openhab.binding.tr064) and reviewing the output it becomes apparent that the binding tries to pull the device definitions from URL: http://192.168.17.23/:49000/tr64desc.xml

22:02:49.001 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tr064:fritzbox:2687d134fe' changed from INITIALIZING to UNKNOWN
22:02:49.002 [DEBUG] [nhab.binding.tr064.internal.util.Util] - HTTP Failed to GET uri 'http://192.168.17.23/:49000/tr64desc.xml': java.util.concurrent.RejectedExecutionException: HttpClient@18d4c330{STOPPED} is stopped
22:02:49.002 [INFO ] [hab.event.ThingStatusInfoChangedEvent] - Thing 'tr064:fritzbox:2687d134fe' changed from UNKNOWN to OFFLINE (COMMUNICATION_ERROR): could not get device definitions from 192.168.17.23/

Entering the above (wrong) URL in a local browser, a FRITZ!Box page appears stating that the URL cannot be found. Removing the trailing "/" after the IP-Address a XML file with the device information is displayed.

Possible Solution

The GUI should not add a trailing "/" to the URL after the IP-Address

Your Environment

lsiepel commented 1 year ago

I cannot (yet) reproduce this behaviour from the add-on. As you mention the GUI. Did you test it with other browsers? And does the / get addded in the input box? Or afterwards?

lsiepel commented 1 year ago

Checked the code and the trailing slash is not added by the TR064 bundle. I think it might be added in the GUI due to the browser using some autofill feature.

Can you please confirm/test with other browser?

danielkr123 commented 1 year ago

Thanks for following-up. I did manage to get rid of the trailing "/" now by editing the Thing definition in the "Code"-Tab and saving. When I tried to remove it in the "Thing"-Tab and click save, the update was not saved (probably because it did not recognize that something changed!?).

After applying the change and enabling the thing, it changed the status to "Online".