Interface Thing

  • All Superinterfaces:
    Identifiable<ThingUID>
    All Known Subinterfaces:
    Bridge

    @NonNullByDefault
    public interface Thing
    extends Identifiable<ThingUID>
    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.

    A Thing might be connected through a Bridge.

    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)`
    • Method Detail

      • getLabel

        @Nullable String getLabel()
        Returns the human readable label for this thing.
        Returns:
        the human readable label
      • setLabel

        void setLabel​(@Nullable String label)
        Sets the human readable label for this thing.
        Parameters:
        label - the human readable label
      • getChannels

        List<Channel> getChannels()
        Gets the channels.
        Returns:
        the channels
      • getChannelsOfGroup

        List<Channel> 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.
        Returns:
        the channels of the given channel group
      • getChannel

        @Nullable Channel getChannel​(String channelId)
        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

        @Nullable Channel getChannel​(ChannelUID channelUID)
        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 use getStatusInfo().
        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

        void setStatusInfo​(ThingStatusInfo status)
        Sets the status info.
        Parameters:
        status - the new status info
      • setHandler

        void setHandler​(@Nullable ThingHandler thingHandler)
        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

        void setBridgeUID​(@Nullable ThingUID bridgeUID)
        Sets the bridge.
        Parameters:
        bridgeUID - the new bridge UID
      • getConfiguration

        Configuration getConfiguration()
        Gets the configuration.
        Returns:
        the configuration (not null)
      • getThingTypeUID

        ThingTypeUID getThingTypeUID()
        Gets the thing type UID.
        Returns:
        the thing type UID
      • getProperties

        Map<String,​String> getProperties()
        Returns an immutable copy of the Thing properties.
        Returns:
        an immutable copy of the Thing properties (not null)
      • setProperty

        @Nullable String setProperty​(String name,
                                     @Nullable String value)
        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

        void setProperties​(Map<String,​String> properties)
        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 the Thing.
        Returns:
        the location identifier (presumably an item name) or null if no location has been configured.
      • setLocation

        void setLocation​(@Nullable String location)
        Set the physical location of the Thing.
        Parameters:
        location - the location identifier (preferably an item name) or null if no location has been configured.
      • isEnabled

        boolean isEnabled()
        Returns information whether the Thing is enabled or not.
        Returns:
        Returns true if the thing is enabled. Return false otherwise.