Interface ThingHandlerCallback


  • @NonNullByDefault
    public interface ThingHandlerCallback
    ThingHandlerCallback is callback interface for ThingHandlers. The implementation of a ThingHandler must use the callback to inform the framework about changes like state updates, status updated or an update of the whole thing.
    Author:
    Dennis Nobel - Initial contribution, Stefan Bußweiler - Added new thing status info, added new configuration update info, Christoph Weitkamp - Moved OSGI ServiceTracker from BaseThingHandler to ThingHandlerCallback, Christoph Weitkamp - Added preconfigured ChannelGroupBuilder
    • Method Detail

      • stateUpdated

        void stateUpdated​(ChannelUID channelUID,
                          State state)
        Informs about an updated state for a channel.
        Parameters:
        channelUID - channel UID (must not be null)
        state - state (must not be null)
      • postCommand

        void postCommand​(ChannelUID channelUID,
                         Command command)
        Informs about a command, which is sent from the channel.
        Parameters:
        channelUID - channel UID
        command - command
      • statusUpdated

        void statusUpdated​(Thing thing,
                           ThingStatusInfo thingStatus)
        Informs about an updated status of a thing.
        Parameters:
        thing - thing (must not be null)
        thingStatus - thing status (must not be null)
      • thingUpdated

        void thingUpdated​(Thing thing)
        Informs about an update of the whole thing.
        Parameters:
        thing - thing that was updated (must not be null)
        Throws:
        IllegalStateException - if the Thing is read-only.
      • validateConfigurationParameters

        void validateConfigurationParameters​(Thing thing,
                                             Map<String,​Object> configurationParameters)
        Validates the given configuration parameters against the configuration description.
        Parameters:
        thing - thing with the updated configuration (must no be null)
        configurationParameters - the configuration parameters to be validated
        Throws:
        ConfigValidationException - if one or more of the given configuration parameters do not match their declarations in the configuration description
      • configurationUpdated

        void configurationUpdated​(Thing thing)
        Informs about an updated configuration of a thing.
        Parameters:
        thing - thing with the updated configuration (must no be null)
      • migrateThingType

        void migrateThingType​(Thing thing,
                              ThingTypeUID thingTypeUID,
                              Configuration configuration)
        Informs the framework that the ThingType of the given Thing should be changed.
        Parameters:
        thing - thing that should be migrated to another ThingType (must not be null)
        thingTypeUID - the new type of the thing (must not be null)
        configuration - a configuration that should be applied to the given Thing
      • channelTriggered

        void channelTriggered​(Thing thing,
                              ChannelUID channelUID,
                              String event)
        Informs the framework that a channel has been triggered.
        Parameters:
        thing - thing (must not be null)
        channelUID - UID of the channel over which has been triggered.
        event - Event.
      • isChannelLinked

        boolean isChannelLinked​(ChannelUID channelUID)
        Returns whether at least one item is linked for the given UID of the channel.
        Parameters:
        channelUID - UID of the channel (must not be null)
        Returns:
        true if at least one item is linked, false otherwise
      • getBridge

        @Nullable Bridge getBridge​(ThingUID bridgeUID)
        Returns the bridge of the thing.
        Parameters:
        bridgeUID - ThingUID UID of the bridge (must not be null)
        Returns:
        returns the bridge of the thing or null if the thing has no bridge