rossko57
(Rossko57)
February 3, 2022, 1:04pm
2
Whatever you are trying to achieve, it is likely some kind of kludge.
There are no simple tools for traversing the hierarchy. But if the GUI can do, so can you.
Remember that starting with an Item, the next step is the channel link - you can’t go directly to Thing. Remember also that this will be a List - Items may link to multiple channels.
The hierarchy is mapped out in internal registers, so that’s where you must look.
Old OH2 posts, but show the kind of methods -
In order to ease items file definitions, did I propose this tools that create a group for each installed binding, containing a group for each thing defined, containing the list of linked items :
from core.log import logging, LOG_PREFIX, log_traceback
from core.items import add_item, remove_item
from core.utils import validate_item
import requests
import sys
# Modify these variables to fit your system
URL_OPENHAB = "http://localhost:8080"
bindingTag = "BindingDiscovery"
def normalizeBindingI…
I have a lot of things in my test script that I need to get into the docs! Instead of using a group and associated Items, you could trigger on Thing change and then iterate through the Items linked to the Thing’s Channels…
from core.rules import rule
from core.triggers import when
from core import osgi
ItemChannelLinkRegistry = osgi.get_service("org.eclipse.smarthome.core.thing.link.ItemChannelLinkRegistry")
@rule("Reset offline")
@when("Thing kodi:kodi:familyroom changed to OFFLINE")
def dev…
Newer -
For anyone else that wants to try this, here is code that can be placed in your library that implements a get_thing() function … major limitation: it only returns the first, if any, Thing UID that is associated with an Item also might not work for all Thing binding types
"""
This module allows discovery of first Thing UID for given Item.
"""
try:
import typing as t
if t.TYPE_CHECKING:
try:
from org.openhab.core.thing.link import ItemChannelLinkRegistry, ManagedItemC…
Hi,
I am new to OpenHAB and started to work with version 3.
I struggle with a few things and unfortunately I am a bit confused on which instructions still work for OH3 and which don’t. I’ll post separate questions for each of my problems.
This question is about the Thing Status .
Problem / Goal:
While the thing status is very prominently exposed on the thing itself I cannot find anything similar on the items. All UIs however only seem to work with items.
Therefore, I want to see at first gla…
Keyword ItemChannelLinkRegistry