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

addon info missing in REST response #3795

Closed
mherwege opened this issue Sep 7, 2023 · 10 comments
Closed

addon info missing in REST response #3795

mherwege opened this issue Sep 7, 2023 · 10 comments
Labels
bug An unexpected problem or unintended behavior of the Core

Comments

@mherwege
Copy link
Contributor

mherwege commented Sep 7, 2023

Work has been done to include 'connection' and 'country' information in the addon info data structures. This could be useful to filter in a UI.
However, when testing the REST call for an addon, it looks like the connection and country info is lost somewhere and never filled in the REST response (at least for the addons in the openhab repository).

Try:

http://192.168.0.10:8080/rest/addons/binding-dsmr

The response body is:

{
  "uid": "binding-dsmr",
  "id": "dsmr",
  "label": "DSMR Binding",
  "version": "4.0.2",
  "compatible": true,
  "contentType": "application/vnd.openhab.feature;type=karaf",
  "link": "https://www.openhab.org/addons/bindings/dsmr/",
  "author": "openHAB",
  "verifiedAuthor": true,
  "installed": false,
  "type": "binding",
  "configDescriptionURI": "",
  "keywords": "",
  "countries": [],
  "connection": "",
  "properties": {},
  "loggerPackages": [
    "org.openhab.binding.dsmr"
  ]
}

countries and connection is empty. The content of the addon.xml file for the binding contains values for these fields: https://github.com/openhab/openhab-addons/blob/main/bundles/org.openhab.binding.dsmr/src/main/resources/OH-INF/addon/addon.xml

@mherwege mherwege added the bug An unexpected problem or unintended behavior of the Core label Sep 7, 2023
@wborn
Copy link
Member

wborn commented Sep 8, 2023

"installed": false,

It's currently only possible to add this data for installed add-ons because without installation the data is not available, see: #1701

@mherwege
Copy link
Contributor Author

mherwege commented Sep 8, 2023

Unfortunately, it also did not show for installed addons.

@wborn
Copy link
Member

wborn commented Sep 8, 2023

I see countries but no connection:

{
  "uid": "binding-dsmr",
  "id": "dsmr",
  "label": "DSMR Binding",
  "version": "4.1.0.SNAPSHOT",
  "compatible": true,
  "contentType": "application/vnd.openhab.feature;type=karaf",
  "link": "https://www.openhab.org/addons/bindings/dsmr/",
  "author": "openHAB",
  "verifiedAuthor": true,
  "installed": true,
  "type": "binding",
  "description": "This binding integrates Dutch, Belgium, Luxembourg and Austrian Smart Meters",
  "configDescriptionURI": "",
  "keywords": "",
  "countries": [
    "nl",
    "be",
    "lu",
    "at"
  ],
  "connection": "",
  "properties": {},
  "loggerPackages": [
    "org.openhab.binding.dsmr"
  ]
}

@mherwege
Copy link
Contributor Author

mherwege commented Sep 8, 2023

Indeed, connection is missing in my test as well (I didn't have an addon with countries specified installed).

@mherwege
Copy link
Contributor Author

mherwege commented Sep 8, 2023

I also understand the issue with the Karaf feature only providing the extra info when the addon is installed. That's unfortunate and not very satisfying, also in the context of #2645. Additional info on an addon could be used to create some automated binding suggestions. So this means somehow the info needs to be extracted from the addon.xml files in the repository and served separately somehow.

@lolodomo
Copy link
Contributor

lolodomo commented Sep 9, 2023

Indeed, connection is missing in my test as well

I can also confirm.

(I didn't have an addon with countries specified installed).

Seems to work, I just checked with the linky biinding.

When there is no country for an installed binding, it also looks like the API is returning one country with an empty content. Not what is expected.

wborn added a commit to wborn/openhab-core that referenced this issue Sep 9, 2023
Fixes the following:

* connection and countries details missing for some AddonServices
* missing connection getter on AddonInfo
* countries lists has empty String when when countries info is missing

Related to openhab#3795

Signed-off-by: Wouter Born <github@maindrain.net>
wborn added a commit to wborn/openhab-core that referenced this issue Sep 9, 2023
Fixes the following:

* connection and countries details missing for some AddonServices
* missing connection getter on AddonInfo
* countries lists has empty String when when countries info is missing

Related to openhab#3795

Signed-off-by: Wouter Born <github@maindrain.net>
@wborn
Copy link
Member

wborn commented Sep 9, 2023

With #3797 it should work as expected for installed add-ons.

J-N-K pushed a commit that referenced this issue Sep 9, 2023
Fixes the following:

* connection and countries details missing for some AddonServices
* missing connection getter on AddonInfo
* countries lists has empty String when when countries info is missing

Related to #3795

Signed-off-by: Wouter Born <github@maindrain.net>
@lolodomo
Copy link
Contributor

I checked again with OH 4.1 milestone 1 and my installed bindings. countries and connection fields are now set properly in REST response except for zwave binding (no connection field).

@lolodomo
Copy link
Contributor

In fact, connection tag is missing in addon.xml for zigbee and zwave bindings.

@mherwege
Copy link
Contributor Author

mherwege commented Feb 9, 2024

REST API now provides full info for addons from distribution. It would as well for marketplace or 3rd-party providers if they provide the info.
Therefore closing this.

@mherwege mherwege closed this as completed Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of the Core
Projects
None yet
Development

No branches or pull requests

3 participants