Class SwitchItem
- All Implemented Interfaces:
Identifiable<String>,ActiveItem,Item
- Direct Known Subclasses:
DimmerItem
- Author:
- Kai Kreuzer - Initial contribution
-
Field Summary
Fields inherited from class org.openhab.core.items.GenericItem
category, eventPublisher, groupNames, itemStateConverter, label, lastState, lastStateChange, lastStateUpdate, listeners, name, state, tags, timeSeriesListeners, type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis method provides a list of all command types that can be used for this itemThis method provides a list of all data types that can be used to update the item statevoidSend an ON/OFF command to the item.voidSend an ON/OFF command to the item.voidSet a new state.voidsetTimeSeries(TimeSeries timeSeries) Set a new time series.Methods inherited from class org.openhab.core.items.GenericItem
addGroupName, addGroupNames, addGroupNames, addStateChangeListener, addTag, addTags, addTags, addTimeSeriesListener, applyState, applyTimeSeries, dispose, equals, getCategory, getCommandDescription, getCommandOptions, getGroupNames, getLabel, getLastState, getLastStateChange, getLastStateUpdate, getName, getState, getStateAs, getStateDescription, getStateDescription, getTags, getType, getUID, hashCode, hasTag, internalSend, isAcceptedState, logSetTypeError, logSetTypeError, notifyListeners, removeAllTags, removeGroupName, removeStateChangeListener, removeTag, removeTimeSeriesListener, send, send, setCategory, setCommandDescriptionService, setEventPublisher, setItemStateConverter, setLabel, setState, setStateDescriptionService, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.openhab.core.items.Item
getCommandDescription
-
Constructor Details
-
SwitchItem
-
-
Method Details
-
send
Send an ON/OFF command to the item.- Parameters:
command- the command to be sent
-
send
Send an ON/OFF command to the item.- Parameters:
command- the command to be sentsource- the source of the command. See https://www.openhab.org/docs/developer/utils/events.html#the-core-events
-
getAcceptedDataTypes
Description copied from interface:ItemThis method provides a list of all data types that can be used to update the item state
Imagine e.g. a dimmer device: It's status could be 0%, 10%, 50%, 100%, but also OFF or ON and maybe UNDEFINED. So the accepted data types would be in this case
PercentType, andUnDefTypeThe order of data types denotes the order of preference. So in case a state needs to be converted in order to be accepted, it will be attempted to convert it to a type from top to bottom. Therefore the type with the least information loss should be on top of the list - in the example above the
PercentTypecarries more information than the , hence it is listed first.- Returns:
- a list of data types that can be used to update the item state
-
getAcceptedCommandTypes
Description copied from interface:ItemThis method provides a list of all command types that can be used for this item
Imagine e.g. a dimmer device: You could ask it to dim to 0%, 10%, 50%, 100%, but also to turn OFF or ON. So the accepted command types would be in this case
PercentType,- Returns:
- a list of all command types that can be used for this item
-
setState
Description copied from class:GenericItemSet a new state. Subclasses may override this method in order to do necessary conversions upfront. Afterwards,GenericItem.applyState(State)should be called by classes overriding this method.- Overrides:
setStatein classGenericItem- Parameters:
state- new state of this item
-
setTimeSeries
Description copied from class:GenericItemSet a new time series. Subclasses may override this method in order to do necessary conversions upfront. Afterwards,GenericItem.applyTimeSeries(TimeSeries)should be called by classes overriding this method. A time series may only contain events that are compatible with the item's internal state.- Overrides:
setTimeSeriesin classGenericItem- Parameters:
timeSeries- new time series of this item
-