Filtering Bindings by OFFLINE / CLOUD

Hi,
I love to check regulary the supported Bindings but I hate reading all additional stuff regarding possibilities to get it work totally Offline (in local netzwork only) or having a Cloud-connector/Internet API in the Background.

Would be very nice to support a FLAG here inside description + a possibility to filter for this inside OH and Wiki.

Thanks for Reading (Dont know where to create Issue for this)

Issue would require changes in openhab-core to support the flag, openhab-webuis to support sort and search, openhab-docs maybe, and all the openhab-addons where the flag would have to be added to each add-on (close to 400 total add-ons if you include transformation, persistence, and automation add-ons).

AFAIK, we already added this information to the bindings addon.xml, at least a lot of them…

	<type>binding</type>
	<name>Ekey Binding</name>
	<description>This is the binding for connecting openHAB to Ekey fingerprint scanners.</description>
	<connection>local</connection>

1 Like

In that case that just needs to be exposed to and used by the UI. I don’t know if that tag is available to the docs though.

I think, it was available some time ago, but vanished again.
@florian-h05 Do I remember correct ?

It is in the developer documentation: Add-on Descriptions | openHAB

The issue used to be this information was only available until after installation of the binding. It is now also available before installation (but only for bindings in the distribution), so it is only a question of adapting the UI to be able to filter on that field.

1 Like

FWIW, this rule will log the connection type of each installed Add-on. Or remove the “if (installed == “true”)” and list all of the Add-ons in the RestAPI…

rule AddonConnectionTypesLog
when Item TestSwitch changed
then 
     // Use the RestAPI to retrieve all of the Add-ons
     val headers = newHashMap("Authorization" -> "Bearer oh.RestApiToken.<your API token", 
                              "WWW-Authenticate" -> "Basic",
                              "Accept" -> "application/json")                        
     var hostURL = "http://<openHAB IP>:8080/rest/addons?"
     var String jsonData = sendHttpGetRequest(hostURL, headers, 5000)

     // Get number of Add-ons found.  If there are none then something is terribly wrong.
     val numberOfAddons = Integer::parseInt(transform("JSONPATH","$.length()",jsonData))
     if (numberOfAddons == 0) {
          logInfo("AddonConnectionTypesLog","No Add-ons found. Something is very wrong.")
          return
     }

     var LogCount = 0
     var i = 0
     while (i < numberOfAddons) {
          var installed  = transform("JSONPATH", "$.[" + i + "].installed", jsonData)
          var connection = transform("JSONPATH", "$.[" + i + "].connection", jsonData)
          var label      = transform("JSONPATH", "$.[" + i + "].label", jsonData)
          if (installed == "true") {
               if (connection != "local" && connection != "cloud" && connection != "none") {
                   connection = "not specified"
               }
              logInfo("AddonConnectionTypesLog","Add-on: {} - Connection: {}", label, connection)
               LogCount += 1
          }
          i++
     }
     logInfo("AddonConnectionTypesLog","Connection type of {} Add-ons logged.", LogCount)
end

There is this related issue:

If it is now always available in the REST API, Main UI can make use of that data for sure :+1:
@Mherwege In case you want to work on that, I would love to get a PR for integrating the connection status into the UI‘s add-on store.

Wrt to the docs, it should be possible to extract the required information from the xml file(s) during website build, but I’m not sure what is currently done and how much work it would be to add the connection type to the website.

1 Like