In one of my scripts I am using the astro binding and thus I am verifyiing that the binding is there:
bindingRegistryInfo = get_service("org.openhab.core.binding.BindingInfoRegistry") or get_service("org.eclipse.smarthome.core.binding.BindingInfoRegistry")
After migrating to openHAB4 I now see that bindingRegistryInfo is None, but Astro binding is installed.
I was wondering if the namespace had changed, but couldn’t find anything regarding this in the discussions / release notes.
Can anybody point me in direction of what I am missing here?
It seems like it works, but I suspect that there is an error in ther call to getAddonInfo, as it returns None but if I loop all installed bindings it finds the Astro Binding in the loop.
bindingInstalled = False
bindingId = 'astro'
addonRegistryInfo = get_service("org.openhab.core.addon.AddonInfoRegistry")
self.Logger().info('[EventManager::generateTrigger] Check Astro Addon status (openHAB4 namespace): {}'.format(addonRegistryInfo.getAddonInfo(bindingId)))
if (addonRegistryInfo.getAddonInfo(bindingId) is not None):
bindingInstalled = True
else:
addonInfos = addonRegistryInfo.getAddonInfos()
for addonInfo in addonInfos:
if bindingId == addonInfo.getId():
bindingInstalled = True
self.Logger().info("[EventManager::generateTrigger] MATCHING BINDING FOUND")
break