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
ConstructorDescriptionConfigStatusThingHandler
(Thing thing) Creates a new instance of this class for the givenThing
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
handleConfigurationUpdate
(Map<String, Object> configurationParameters) Handles a configuration update.void
setConfigStatusCallback
(@Nullable ConfigStatusCallback configStatusCallback) Sets the givenConfigStatusCallback
for theConfigStatusProvider
.boolean
supportsEntity
(String entityId) Determines if theConfigStatusProvider
instance can provide the configuration status information for the given entity.protected void
updateConfiguration
(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, validateConfigurationParameters
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.openhab.core.config.core.status.ConfigStatusProvider
getConfigStatus
Methods 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:ConfigStatusProvider
Determines if theConfigStatusProvider
instance can provide the configuration status information for the given entity.- Specified by:
supportsEntity
in interfaceConfigStatusProvider
- Parameters:
entityId
- the id of the entity whose configuration status information is to be provided- Returns:
- true, if the
ConfigStatusProvider
instance supports the given entity, otherwise false
-
setConfigStatusCallback
Description copied from interface:ConfigStatusProvider
Sets the givenConfigStatusCallback
for theConfigStatusProvider
.- Specified by:
setConfigStatusCallback
in interfaceConfigStatusProvider
- Parameters:
configStatusCallback
- the configuration status callback to be set
-
handleConfigurationUpdate
Description copied from interface:ThingHandler
Handles a configuration update.Note: An implementing class needs to persist the configuration changes if necessary.
- Specified by:
handleConfigurationUpdate
in interfaceThingHandler
- Overrides:
handleConfigurationUpdate
in classBaseThingHandler
- Parameters:
configurationParameters
- map of changed configuration parameters
-
updateConfiguration
Description copied from class:BaseThingHandler
Updates 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:
updateConfiguration
in classBaseThingHandler
- Parameters:
configuration
- configuration, that was updated and should be persisted
-