Package org.openhab.core.thing.binding
Class ConfigStatusThingHandler
java.lang.Object
org.openhab.core.thing.binding.BaseThingHandler
org.openhab.core.thing.binding.ConfigStatusThingHandler
- All Implemented Interfaces:
ConfigStatusProvider,ThingHandler
@NonNullByDefault
public abstract class ConfigStatusThingHandler
extends BaseThingHandler
implements ConfigStatusProvider
The
ConfigStatusThingHandler is an extension of BaseThingHandler that implements the
ConfigStatusProvider interface. It provides default implementations for
ConfigStatusProvider.supportsEntity(String)ConfigStatusProvider.setConfigStatusCallback(ConfigStatusCallback)
ThingHandler.handleConfigurationUpdate(Map) and
BaseThingHandler.updateConfiguration(Configuration) to initiate a propagation of a new
configuration status. So sub classes need only to provide the current configuration status by implementing
ConfigStatusProvider.getConfigStatus().- Author:
- Thomas Höfer - Initial contribution, Chris Jackson - Add updateConfiguration override to handle status updates
-
Field Summary
Fields inherited from class org.openhab.core.thing.binding.BaseThingHandler
scheduler, thing -
Constructor Summary
ConstructorsConstructorDescriptionConfigStatusThingHandler(Thing thing) Creates a new instance of this class for the givenThing. -
Method Summary
Modifier and TypeMethodDescriptionvoidhandleConfigurationUpdate(Map<String, Object> configurationParameters) Handles a configuration update.voidsetConfigStatusCallback(@Nullable ConfigStatusCallback configStatusCallback) Sets the givenConfigStatusCallbackfor theConfigStatusProvider.booleansupportsEntity(String entityId) Determines if theConfigStatusProviderinstance can provide the configuration status information for the given entity.protected voidupdateConfiguration(Configuration configuration) Updates the configuration of the thing and informs the framework about it.Methods inherited from class org.openhab.core.thing.binding.BaseThingHandler
bridgeStatusChanged, changeThingType, channelLinked, channelUnlinked, dispose, editConfiguration, editProperties, editThing, getBridge, getCallback, getConfig, getConfigAs, getConfigDescription, getConfigDescription, getThing, handleRemoval, isInitialized, isLinked, isLinked, isModifyingCurrentConfig, postCommand, postCommand, sendTimeSeries, sendTimeSeries, setCallback, thingUpdated, triggerChannel, triggerChannel, triggerChannel, triggerChannel, updateProperties, updateProperty, updateState, updateState, updateStatus, updateStatus, updateStatus, updateThing, validateConfigurationParametersMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openhab.core.config.core.status.ConfigStatusProvider
getConfigStatusMethods inherited from interface org.openhab.core.thing.binding.ThingHandler
getServices, handleCommand, initialize
-
Constructor Details
-
ConfigStatusThingHandler
Creates a new instance of this class for the givenThing.- Parameters:
thing- the thing for this handler
-
-
Method Details
-
supportsEntity
Description copied from interface:ConfigStatusProviderDetermines if theConfigStatusProviderinstance can provide the configuration status information for the given entity.- Specified by:
supportsEntityin interfaceConfigStatusProvider- Parameters:
entityId- the id of the entity whose configuration status information is to be provided- Returns:
- true, if the
ConfigStatusProviderinstance supports the given entity, otherwise false
-
setConfigStatusCallback
Description copied from interface:ConfigStatusProviderSets the givenConfigStatusCallbackfor theConfigStatusProvider.- Specified by:
setConfigStatusCallbackin interfaceConfigStatusProvider- Parameters:
configStatusCallback- the configuration status callback to be set
-
handleConfigurationUpdate
Description copied from interface:ThingHandlerHandles a configuration update.Note: An implementing class needs to persist the configuration changes if necessary.
- Specified by:
handleConfigurationUpdatein interfaceThingHandler- Overrides:
handleConfigurationUpdatein classBaseThingHandler- Parameters:
configurationParameters- map of changed configuration parameters
-
updateConfiguration
Description copied from class:BaseThingHandlerUpdates the configuration of the thing and informs the framework about it. Any method overriding this method has to make sure that only valid configurations are passed to the callback. This can be achieved by callingThingHandlerCallback.validateConfigurationParameters(Thing, Map).- Overrides:
updateConfigurationin classBaseThingHandler- Parameters:
configuration- configuration, that was updated and should be persisted
-