Package org.openhab.core.thing
Interface Thing
- All Superinterfaces:
Identifiable<ThingUID>
- All Known Subinterfaces:
Bridge
A
Thing is a representation of a connected part (e.g. physical device or cloud service) from the real world.
It contains a list of Channels, which can be bound to Items.
- Author:
- Dennis Nobel - Initial contribution, Thomas Höfer - Added thing and thing type properties, Simon Kaufmann - Added label, location, Kai Kreuzer - Removed linked items from Thing, Yordan Zhelev - Added method for getting the enabled status, Christoph Weitkamp - Added method
getChannel(ChannelUID), Andrew Fiddian-Green - Added semanticEquipmentTag
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringthe key for the firmware version propertystatic final Stringthe key for the hardware version propertystatic final Stringthe key for the MAC address propertystatic final Stringthe key for the model ID propertystatic final Stringthe key for the serial number propertystatic final Stringthe key for the vendor property -
Method Summary
Modifier and TypeMethodDescription@Nullable ThingUIDGets the bridge UID.@Nullable ChannelgetChannel(String channelId) Gets the channel for the given id or null if no channel with the id exists.@Nullable ChannelgetChannel(ChannelUID channelUID) Gets the channel for the given UID or null if no channel with the UID exists.Gets the channels.getChannelsOfGroup(String channelGroupId) Gets the channels of the given channel group or an empty list if no channel group with the id exists or the channel group does not have channels.Gets the configuration.@Nullable ThingHandlerGets the handler.@Nullable StringgetLabel()Returns the human readable label for this thing.@Nullable StringGet the physical location of theThing.Returns an immutable copy of theThingproperties.@Nullable StringGet the semantic (equipment) tag of theThing.Gets the status of a thing.Gets the status info of a thing.Gets the thing type UID.getUID()Gets the uid.booleanReturns information whether theThingis enabled or not.voidsetBridgeUID(@Nullable ThingUID bridgeUID) Sets the bridge.voidsetHandler(@Nullable ThingHandler thingHandler) Sets the handler.voidSets the human readable label for this thing.voidsetLocation(@Nullable String location) Set the physical location of theThing.voidsetProperties(Map<String, String> properties) Updates all properties of the thing.@Nullable StringsetProperty(String name, @Nullable String value) Sets the property value for the property identified by the given name.voidsetSemanticEquipmentTag(@Nullable String semanticEquipmentTag) Set the semantic (equipment) tag of theThing.voidsetSemanticEquipmentTag(@Nullable SemanticTag semanticEquipmentTag) Set the semantic (equipment) tag of theThing.voidsetStatusInfo(ThingStatusInfo status) Sets the status info.
-
Field Details
-
PROPERTY_VENDOR
the key for the vendor property- See Also:
-
PROPERTY_MODEL_ID
the key for the model ID property- See Also:
-
PROPERTY_SERIAL_NUMBER
the key for the serial number property- See Also:
-
PROPERTY_HARDWARE_VERSION
the key for the hardware version property- See Also:
-
PROPERTY_FIRMWARE_VERSION
the key for the firmware version property- See Also:
-
PROPERTY_MAC_ADDRESS
the key for the MAC address property- See Also:
-
-
Method Details
-
getLabel
@Nullable String getLabel()Returns the human readable label for this thing.- Returns:
- the human readable label
-
setLabel
Sets the human readable label for this thing.- Parameters:
label- the human readable label
-
getChannels
Gets the channels.- Returns:
- the channels
-
getChannelsOfGroup
Gets the channels of the given channel group or an empty list if no channel group with the id exists or the channel group does not have channels.- Returns:
- the channels of the given channel group
-
getChannel
Gets the channel for the given id or null if no channel with the id exists.- Parameters:
channelId- channel ID- Returns:
- the channel for the given id or null if no channel with the id exists
-
getChannel
Gets the channel for the given UID or null if no channel with the UID exists.- Parameters:
channelUID- channel UID- Returns:
- the channel for the given UID or null if no channel with the UID exists
-
getStatus
ThingStatus getStatus()Gets the status of a thing. In order to get all status information (status, status detail and status description) please usegetStatusInfo().- Returns:
- the status
-
getStatusInfo
ThingStatusInfo getStatusInfo()Gets the status info of a thing. The status info consists of the status itself, the status detail and a status description.- Returns:
- the status info
-
setStatusInfo
Sets the status info.- Parameters:
status- the new status info
-
setHandler
Sets the handler.- Parameters:
thingHandler- the new handler
-
getHandler
@Nullable ThingHandler getHandler()Gets the handler.- Returns:
- the handler (can be null)
-
getBridgeUID
@Nullable ThingUID getBridgeUID()Gets the bridge UID.- Returns:
- the bridge UID (can be null)
-
setBridgeUID
Sets the bridge.- Parameters:
bridgeUID- the new bridge UID
-
getConfiguration
Configuration getConfiguration()Gets the configuration.- Returns:
- the configuration (not null)
-
getUID
ThingUID getUID()Gets the uid.- Specified by:
getUIDin interfaceIdentifiable<ThingUID>- Returns:
- the uid
-
getThingTypeUID
ThingTypeUID getThingTypeUID()Gets the thing type UID.- Returns:
- the thing type UID
-
getProperties
Returns an immutable copy of theThingproperties.- Returns:
- an immutable copy of the
Thingproperties (not null)
-
setProperty
Sets the property value for the property identified by the given name. If the value to be set is null then the property will be removed.- Parameters:
name- the name of the property to be set (must not be null or empty)value- the value of the property (if null then the property with the given name is removed)- Returns:
- the previous value associated with the name, or null if there was no mapping for the name
-
setProperties
Updates all properties of the thing.- Parameters:
properties- the properties to set (must not be null)
-
getLocation
@Nullable String getLocation()Get the physical location of theThing.- Returns:
- the location identifier (presumably an item name) or
nullif no location has been configured.
-
setLocation
Set the physical location of theThing.- Parameters:
location- the location identifier (preferably an item name) ornullif no location has been configured.
-
isEnabled
boolean isEnabled()Returns information whether theThingis enabled or not.- Returns:
- Returns
trueif the thing is enabled. Returnfalseotherwise.
-
getSemanticEquipmentTag
@Nullable String getSemanticEquipmentTag()Get the semantic (equipment) tag of theThing.- Returns:
- the semantic (equipment) tag or
nullif no tag has been configured.
-
setSemanticEquipmentTag
Set the semantic (equipment) tag of theThing.- Parameters:
semanticEquipmentTag- the semantic (equipment) tag ornullif no tag has been configured.
-
setSemanticEquipmentTag
Set the semantic (equipment) tag of theThing.- Parameters:
semanticEquipmentTag- the semantic (equipment) tag ornullif no tag has been configured.
-