openHAB
Additional configuration
For optimal performance it is recommended to use Basic Auth. It can be enabled through GUI or through textual configuration.
Textual configuration
The settings are in the runtime.cfg.
Remove the # before the entry to activate it.
################ REST API ###################
org.openhab.restauth:allowBasicAuth=true
GUI
It can be enabled through the gui in settings -> API Security -> Allow Basic Authentication.
OpenHAB user
In case an additional openHAB user or token is created for HABApp it has to have admin rights.
openHAB item types
Description and example
Items that are created from openHAB inherit all from OpenhabItem and
provide convenience functions which simplify many things.
Example:
from HABApp.openhab.items import ContactItem, SwitchItem
my_contact = ContactItem.get_item('MyContact')
if my_contact.is_open():
print('Contact is open!')
my_switch = SwitchItem.get_item('MySwitch')
if my_switch.is_on():
my_switch.off()
Contact is open!
/home/docs/.asdf/installs/python/3.13.14/lib/python3.13/asyncio/base_events.py:569: ResourceWarning: asynchronous generator <async_generator object HabAppObjProvider._reentrant_lock at 0x769a073ba890> was scheduled after loop.shutdown_asyncgens() call
NumberItem

- class NumberItem()
NumberItem which accepts and converts the data types from OpenHAB
- Variables:
name (str) – Item name
value (int | float) – Current item value (or state in openHAB wording)
last_value (int | float) – Last item value (or state in openHAB wording) before the current value one
dimension (str | None) – Dimension if it’s a UoM item
label (str | None) – Item label or
Noneif not configured
- classmethod get_item(name)
Returns an already existing item. If it does not exist or has a different item type an exception will occur.
- Parameters:
name (
str) – Name of the item- Return type:
Self
- command_value(value)
Send a command to the openHAB item, the same as oh_send_command
- get_persistence_data(persistence=None, start_time=None, end_time=None)
Query historical data from the OpenHAB persistence service
- get_value(default_value=None)
Return the value of the item. This is a helper function that returns a default in case the item value is None.
- Parameters:
default_value – Return this value if the item value is None
- Return type:
- Returns:
value of the item
- listen_event(callback, event_filter=None)
Register an event listener which listens to all event that the item receives
- Parameters:
callback (
Callable[[Any],Any]) – callback that accepts one parameter which will contain the eventevent_filter (
EventFilterBase|None) – Event filter. This is typicallyValueUpdateEventFilterorValueChangeEventFilterwhich will also trigger on changes/update from openhab or mqtt. Additionally, it can be an instance ofEventFilterwhich additionally filters on the values of the event. It is also possible to group filters logically with, e.g.AndFilterGroupandOrFilterGroup
- Return type:
- oh_post_update(value=<Missing>, *, source=None)
Post an update to the openHAB item
- oh_post_update_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>, source=None)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
source (
str|None) – (optional) source where this update comes from
- Return type:
- Returns:
True if the new value was posted else False
- oh_send_command(value=<Missing>, *, source=None)
Send a command to the openHAB item
- post_value(new_value)
Set a new value and post appropriate events on the HABApp event bus (
ValueUpdateEvent,ValueChangeEvent)
- post_value_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
- Return type:
- Returns:
True if the new value was posted else False
- set_value(new_value)
Set a new value without creating events on the event bus
- watch_change(secs)
Generate an event if the item does not change for a certain period of time. Has to be called from inside a rule function.
- watch_update(secs)
Generate an event if the item does not receive and update for a certain period of time. Has to be called from inside a rule function.
- property last_change: InstantView
- Returns:
Timestamp of the last time when the item has been changed (read only)
- property last_update: InstantView
- Returns:
Timestamp of the last time when the item has been updated (read only)
ContactItem

- class ContactItem()
- Variables:
- classmethod get_item(name)
Returns an already existing item. If it does not exist or has a different item type an exception will occur.
- Parameters:
name (
str) – Name of the item- Return type:
Self
- command_value(value)
Send a command to the openHAB item, the same as oh_send_command
- get_persistence_data(persistence=None, start_time=None, end_time=None)
Query historical data from the OpenHAB persistence service
- get_value(default_value=None)
Return the value of the item. This is a helper function that returns a default in case the item value is None.
- Parameters:
default_value – Return this value if the item value is None
- Return type:
- Returns:
value of the item
- listen_event(callback, event_filter=None)
Register an event listener which listens to all event that the item receives
- Parameters:
callback (
Callable[[Any],Any]) – callback that accepts one parameter which will contain the eventevent_filter (
EventFilterBase|None) – Event filter. This is typicallyValueUpdateEventFilterorValueChangeEventFilterwhich will also trigger on changes/update from openhab or mqtt. Additionally, it can be an instance ofEventFilterwhich additionally filters on the values of the event. It is also possible to group filters logically with, e.g.AndFilterGroupandOrFilterGroup
- Return type:
- oh_post_update(value=<Missing>, *, source=None)
Post an update to the openHAB item
- oh_post_update_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>, source=None)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
source (
str|None) – (optional) source where this update comes from
- Return type:
- Returns:
True if the new value was posted else False
- oh_send_command(value=<Missing>, *, source=None)
Send a command to the openHAB item
- post_value(new_value)
Set a new value and post appropriate events on the HABApp event bus (
ValueUpdateEvent,ValueChangeEvent)
- post_value_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
- Return type:
- Returns:
True if the new value was posted else False
- set_value(new_value)
Set a new value without creating events on the event bus
- Parameters:
new_value – new value of the item
- Return type:
- Returns:
True if state has changed
- watch_change(secs)
Generate an event if the item does not change for a certain period of time. Has to be called from inside a rule function.
- watch_update(secs)
Generate an event if the item does not receive and update for a certain period of time. Has to be called from inside a rule function.
- property last_change: InstantView
- Returns:
Timestamp of the last time when the item has been changed (read only)
- property last_update: InstantView
- Returns:
Timestamp of the last time when the item has been updated (read only)
SwitchItem

- class SwitchItem()
SwitchItem which accepts and converts the data types from OpenHAB
- Variables:
- classmethod get_item(name)
Returns an already existing item. If it does not exist or has a different item type an exception will occur.
- Parameters:
name (
str) – Name of the item- Return type:
Self
- command_value(value)
Send a command to the openHAB item, the same as oh_send_command
- get_persistence_data(persistence=None, start_time=None, end_time=None)
Query historical data from the OpenHAB persistence service
- get_value(default_value=None)
Return the value of the item. This is a helper function that returns a default in case the item value is None.
- Parameters:
default_value – Return this value if the item value is None
- Return type:
- Returns:
value of the item
- listen_event(callback, event_filter=None)
Register an event listener which listens to all event that the item receives
- Parameters:
callback (
Callable[[Any],Any]) – callback that accepts one parameter which will contain the eventevent_filter (
EventFilterBase|None) – Event filter. This is typicallyValueUpdateEventFilterorValueChangeEventFilterwhich will also trigger on changes/update from openhab or mqtt. Additionally, it can be an instance ofEventFilterwhich additionally filters on the values of the event. It is also possible to group filters logically with, e.g.AndFilterGroupandOrFilterGroup
- Return type:
- oh_post_update(value=<Missing>, *, source=None)
Post an update to the openHAB item
- oh_post_update_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>, source=None)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
source (
str|None) – (optional) source where this update comes from
- Return type:
- Returns:
True if the new value was posted else False
- oh_send_command(value=<Missing>, *, source=None)
Send a command to the openHAB item
- post_value(new_value)
Set a new value and post appropriate events on the HABApp event bus (
ValueUpdateEvent,ValueChangeEvent)
- post_value_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
- Return type:
- Returns:
True if the new value was posted else False
- set_value(new_value)
Set a new value without creating events on the event bus
- toggle()
Toggle the switch. Turns the switch on when off or off when currently on.
- Return type:
- watch_change(secs)
Generate an event if the item does not change for a certain period of time. Has to be called from inside a rule function.
- watch_update(secs)
Generate an event if the item does not receive and update for a certain period of time. Has to be called from inside a rule function.
- property last_change: InstantView
- Returns:
Timestamp of the last time when the item has been changed (read only)
- property last_update: InstantView
- Returns:
Timestamp of the last time when the item has been updated (read only)
DimmerItem

- class DimmerItem()
DimmerItem which accepts and converts the data types from OpenHAB
- Variables:
- classmethod get_item(name)
Returns an already existing item. If it does not exist or has a different item type an exception will occur.
- Parameters:
name (
str) – Name of the item- Return type:
Self
- command_value(value)
Send a command to the openHAB item, the same as oh_send_command
- get_persistence_data(persistence=None, start_time=None, end_time=None)
Query historical data from the OpenHAB persistence service
- get_value(default_value=None)
Return the value of the item. This is a helper function that returns a default in case the item value is None.
- Parameters:
default_value – Return this value if the item value is None
- Return type:
- Returns:
value of the item
- listen_event(callback, event_filter=None)
Register an event listener which listens to all event that the item receives
- Parameters:
callback (
Callable[[Any],Any]) – callback that accepts one parameter which will contain the eventevent_filter (
EventFilterBase|None) – Event filter. This is typicallyValueUpdateEventFilterorValueChangeEventFilterwhich will also trigger on changes/update from openhab or mqtt. Additionally, it can be an instance ofEventFilterwhich additionally filters on the values of the event. It is also possible to group filters logically with, e.g.AndFilterGroupandOrFilterGroup
- Return type:
- oh_post_update(value=<Missing>, *, source=None)
Post an update to the openHAB item
- oh_post_update_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>, source=None)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
source (
str|None) – (optional) source where this update comes from
- Return type:
- Returns:
True if the new value was posted else False
- oh_send_command(value=<Missing>, *, source=None)
Send a command to the openHAB item
- post_value(new_value)
Set a new value and post appropriate events on the HABApp event bus (
ValueUpdateEvent,ValueChangeEvent)
- post_value_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
- Return type:
- Returns:
True if the new value was posted else False
- set_value(new_value)
Set a new value without creating events on the event bus
- watch_change(secs)
Generate an event if the item does not change for a certain period of time. Has to be called from inside a rule function.
- watch_update(secs)
Generate an event if the item does not receive and update for a certain period of time. Has to be called from inside a rule function.
- property last_change: InstantView
- Returns:
Timestamp of the last time when the item has been changed (read only)
- property last_update: InstantView
- Returns:
Timestamp of the last time when the item has been updated (read only)
DatetimeItem

- class DatetimeItem()
DateTimeItem which accepts and converts the data types from OpenHAB
- Variables:
- classmethod get_item(name)
Returns an already existing item. If it does not exist or has a different item type an exception will occur.
- Parameters:
name (
str) – Name of the item- Return type:
Self
- command_value(value)
Send a command to the openHAB item, the same as oh_send_command
- get_persistence_data(persistence=None, start_time=None, end_time=None)
Query historical data from the OpenHAB persistence service
- get_value(default_value=None)
Return the value of the item. This is a helper function that returns a default in case the item value is None.
- Parameters:
default_value – Return this value if the item value is None
- Return type:
- Returns:
value of the item
- listen_event(callback, event_filter=None)
Register an event listener which listens to all event that the item receives
- Parameters:
callback (
Callable[[Any],Any]) – callback that accepts one parameter which will contain the eventevent_filter (
EventFilterBase|None) – Event filter. This is typicallyValueUpdateEventFilterorValueChangeEventFilterwhich will also trigger on changes/update from openhab or mqtt. Additionally, it can be an instance ofEventFilterwhich additionally filters on the values of the event. It is also possible to group filters logically with, e.g.AndFilterGroupandOrFilterGroup
- Return type:
- oh_post_update(value=<Missing>, *, source=None)
Post an update to the openHAB item
- oh_post_update_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>, source=None)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
source (
str|None) – (optional) source where this update comes from
- Return type:
- Returns:
True if the new value was posted else False
- oh_send_command(value=<Missing>, *, source=None)
Send a command to the openHAB item
- post_value(new_value)
Set a new value and post appropriate events on the HABApp event bus (
ValueUpdateEvent,ValueChangeEvent)
- post_value_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
- Return type:
- Returns:
True if the new value was posted else False
- set_value(new_value)
Set a new value without creating events on the event bus
- watch_change(secs)
Generate an event if the item does not change for a certain period of time. Has to be called from inside a rule function.
- watch_update(secs)
Generate an event if the item does not receive and update for a certain period of time. Has to be called from inside a rule function.
- property last_change: InstantView
- Returns:
Timestamp of the last time when the item has been changed (read only)
- property last_update: InstantView
- Returns:
Timestamp of the last time when the item has been updated (read only)
RollershutterItem

- class RollershutterItem()
RollershutterItem which accepts and converts the data types from OpenHAB
- Variables:
- classmethod get_item(name)
Returns an already existing item. If it does not exist or has a different item type an exception will occur.
- Parameters:
name (
str) – Name of the item- Return type:
Self
- command_value(value)
Send a command to the openHAB item, the same as oh_send_command
- get_persistence_data(persistence=None, start_time=None, end_time=None)
Query historical data from the OpenHAB persistence service
- get_value(default_value=None)
Return the value of the item. This is a helper function that returns a default in case the item value is None.
- Parameters:
default_value – Return this value if the item value is None
- Return type:
- Returns:
value of the item
- listen_event(callback, event_filter=None)
Register an event listener which listens to all event that the item receives
- Parameters:
callback (
Callable[[Any],Any]) – callback that accepts one parameter which will contain the eventevent_filter (
EventFilterBase|None) – Event filter. This is typicallyValueUpdateEventFilterorValueChangeEventFilterwhich will also trigger on changes/update from openhab or mqtt. Additionally, it can be an instance ofEventFilterwhich additionally filters on the values of the event. It is also possible to group filters logically with, e.g.AndFilterGroupandOrFilterGroup
- Return type:
- oh_post_update(value=<Missing>, *, source=None)
Post an update to the openHAB item
- oh_post_update_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>, source=None)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
source (
str|None) – (optional) source where this update comes from
- Return type:
- Returns:
True if the new value was posted else False
- oh_send_command(value=<Missing>, *, source=None)
Send a command to the openHAB item
- post_value(new_value)
Set a new value and post appropriate events on the HABApp event bus (
ValueUpdateEvent,ValueChangeEvent)
- post_value_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
- Return type:
- Returns:
True if the new value was posted else False
- set_value(new_value)
Set a new value without creating events on the event bus
- Parameters:
new_value – new value of the item
- Return type:
- Returns:
True if state has changed
- watch_change(secs)
Generate an event if the item does not change for a certain period of time. Has to be called from inside a rule function.
- watch_update(secs)
Generate an event if the item does not receive and update for a certain period of time. Has to be called from inside a rule function.
- property last_change: InstantView
- Returns:
Timestamp of the last time when the item has been changed (read only)
- property last_update: InstantView
- Returns:
Timestamp of the last time when the item has been updated (read only)
ColorItem

- class ColorItem()
ColorItem which accepts and converts the data types from OpenHAB
- Variables:
- classmethod get_item(name)
Returns an already existing item. If it does not exist or has a different item type an exception will occur.
- Parameters:
name (
str) – Name of the item- Return type:
Self
- command_value(value)
Send a command to the openHAB item, the same as oh_send_command
- get_persistence_data(persistence=None, start_time=None, end_time=None)
Query historical data from the OpenHAB persistence service
- get_value(default_value=None)
Return the value of the item. This is a helper function that returns a default in case the item value is None.
- Parameters:
default_value – Return this value if the item value is None
- Return type:
- Returns:
value of the item
- listen_event(callback, event_filter=None)
Register an event listener which listens to all event that the item receives
- Parameters:
callback (
Callable[[Any],Any]) – callback that accepts one parameter which will contain the eventevent_filter (
EventFilterBase|None) – Event filter. This is typicallyValueUpdateEventFilterorValueChangeEventFilterwhich will also trigger on changes/update from openhab or mqtt. Additionally, it can be an instance ofEventFilterwhich additionally filters on the values of the event. It is also possible to group filters logically with, e.g.AndFilterGroupandOrFilterGroup
- Return type:
- oh_post_update(value=<Missing>, *, source=None)
Post an update to the openHAB item
- oh_post_update_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>, source=None)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
source (
str|None) – (optional) source where this update comes from
- Return type:
- Returns:
True if the new value was posted else False
- oh_send_command(value=<Missing>, *, source=None)
Send a command to the openHAB item
- post_value(new_value)
Set a new value and post appropriate events on the HABApp event bus (
ValueUpdateEvent,ValueChangeEvent)
- post_value_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
- Return type:
- Returns:
True if the new value was posted else False
- set_value(new_value)
Set a new color value without creating events on the event bus
- watch_change(secs)
Generate an event if the item does not change for a certain period of time. Has to be called from inside a rule function.
- watch_update(secs)
Generate an event if the item does not receive and update for a certain period of time. Has to be called from inside a rule function.
- property last_change: InstantView
- Returns:
Timestamp of the last time when the item has been changed (read only)
- property last_update: InstantView
- Returns:
Timestamp of the last time when the item has been updated (read only)
StringItem

- class StringItem()
StringItem which accepts and converts the data types from OpenHAB
- Variables:
- classmethod get_item(name)
Returns an already existing item. If it does not exist or has a different item type an exception will occur.
- Parameters:
name (
str) – Name of the item- Return type:
Self
- command_value(value)
Send a command to the openHAB item, the same as oh_send_command
- get_persistence_data(persistence=None, start_time=None, end_time=None)
Query historical data from the OpenHAB persistence service
- get_value(default_value=None)
Return the value of the item. This is a helper function that returns a default in case the item value is None.
- Parameters:
default_value – Return this value if the item value is None
- Return type:
- Returns:
value of the item
- listen_event(callback, event_filter=None)
Register an event listener which listens to all event that the item receives
- Parameters:
callback (
Callable[[Any],Any]) – callback that accepts one parameter which will contain the eventevent_filter (
EventFilterBase|None) – Event filter. This is typicallyValueUpdateEventFilterorValueChangeEventFilterwhich will also trigger on changes/update from openhab or mqtt. Additionally, it can be an instance ofEventFilterwhich additionally filters on the values of the event. It is also possible to group filters logically with, e.g.AndFilterGroupandOrFilterGroup
- Return type:
- oh_post_update(value=<Missing>, *, source=None)
Post an update to the openHAB item
- oh_post_update_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>, source=None)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
source (
str|None) – (optional) source where this update comes from
- Return type:
- Returns:
True if the new value was posted else False
- oh_send_command(value=<Missing>, *, source=None)
Send a command to the openHAB item
- post_value(new_value)
Set a new value and post appropriate events on the HABApp event bus (
ValueUpdateEvent,ValueChangeEvent)
- post_value_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
- Return type:
- Returns:
True if the new value was posted else False
- set_value(new_value)
Set a new value without creating events on the event bus
- watch_change(secs)
Generate an event if the item does not change for a certain period of time. Has to be called from inside a rule function.
- watch_update(secs)
Generate an event if the item does not receive and update for a certain period of time. Has to be called from inside a rule function.
- property last_change: InstantView
- Returns:
Timestamp of the last time when the item has been changed (read only)
- property last_update: InstantView
- Returns:
Timestamp of the last time when the item has been updated (read only)
LocationItem

- class LocationItem()
LocationItem which accepts and converts the data types from OpenHAB
- Variables:
- classmethod get_item(name)
Returns an already existing item. If it does not exist or has a different item type an exception will occur.
- Parameters:
name (
str) – Name of the item- Return type:
Self
- command_value(value)
Send a command to the openHAB item, the same as oh_send_command
- get_persistence_data(persistence=None, start_time=None, end_time=None)
Query historical data from the OpenHAB persistence service
- get_value(default_value=None)
Return the value of the item. This is a helper function that returns a default in case the item value is None.
- Parameters:
default_value – Return this value if the item value is None
- Return type:
- Returns:
value of the item
- listen_event(callback, event_filter=None)
Register an event listener which listens to all event that the item receives
- Parameters:
callback (
Callable[[Any],Any]) – callback that accepts one parameter which will contain the eventevent_filter (
EventFilterBase|None) – Event filter. This is typicallyValueUpdateEventFilterorValueChangeEventFilterwhich will also trigger on changes/update from openhab or mqtt. Additionally, it can be an instance ofEventFilterwhich additionally filters on the values of the event. It is also possible to group filters logically with, e.g.AndFilterGroupandOrFilterGroup
- Return type:
- oh_post_update(value=<Missing>, *, source=None)
Post an update to the openHAB item
- oh_post_update_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>, source=None)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
source (
str|None) – (optional) source where this update comes from
- Return type:
- Returns:
True if the new value was posted else False
- oh_send_command(value=<Missing>, *, source=None)
Send a command to the openHAB item
- post_value(new_value)
Set a new value and post appropriate events on the HABApp event bus (
ValueUpdateEvent,ValueChangeEvent)
- post_value_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
- Return type:
- Returns:
True if the new value was posted else False
- set_value(new_value)
Set a new value without creating events on the event bus
- Parameters:
new_value – new value of the item
- Return type:
- Returns:
True if state has changed
- watch_change(secs)
Generate an event if the item does not change for a certain period of time. Has to be called from inside a rule function.
- watch_update(secs)
Generate an event if the item does not receive and update for a certain period of time. Has to be called from inside a rule function.
- property last_change: InstantView
- Returns:
Timestamp of the last time when the item has been changed (read only)
- property last_update: InstantView
- Returns:
Timestamp of the last time when the item has been updated (read only)
PlayerItem

- class PlayerItem()
PlayerItem which accepts and converts the data types from OpenHAB
- Variables:
- classmethod get_item(name)
Returns an already existing item. If it does not exist or has a different item type an exception will occur.
- Parameters:
name (
str) – Name of the item- Return type:
Self
- command_value(value)
Send a command to the openHAB item, the same as oh_send_command
- get_persistence_data(persistence=None, start_time=None, end_time=None)
Query historical data from the OpenHAB persistence service
- get_value(default_value=None)
Return the value of the item. This is a helper function that returns a default in case the item value is None.
- Parameters:
default_value – Return this value if the item value is None
- Return type:
- Returns:
value of the item
- listen_event(callback, event_filter=None)
Register an event listener which listens to all event that the item receives
- Parameters:
callback (
Callable[[Any],Any]) – callback that accepts one parameter which will contain the eventevent_filter (
EventFilterBase|None) – Event filter. This is typicallyValueUpdateEventFilterorValueChangeEventFilterwhich will also trigger on changes/update from openhab or mqtt. Additionally, it can be an instance ofEventFilterwhich additionally filters on the values of the event. It is also possible to group filters logically with, e.g.AndFilterGroupandOrFilterGroup
- Return type:
- oh_post_update(value=<Missing>, *, source=None)
Post an update to the openHAB item
- oh_post_update_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>, source=None)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
source (
str|None) – (optional) source where this update comes from
- Return type:
- Returns:
True if the new value was posted else False
- oh_send_command(value=<Missing>, *, source=None)
Send a command to the openHAB item
- post_value(new_value)
Set a new value and post appropriate events on the HABApp event bus (
ValueUpdateEvent,ValueChangeEvent)
- post_value_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
- Return type:
- Returns:
True if the new value was posted else False
- set_value(new_value)
Set a new value without creating events on the event bus
- watch_change(secs)
Generate an event if the item does not change for a certain period of time. Has to be called from inside a rule function.
- watch_update(secs)
Generate an event if the item does not receive and update for a certain period of time. Has to be called from inside a rule function.
- property last_change: InstantView
- Returns:
Timestamp of the last time when the item has been changed (read only)
- property last_update: InstantView
- Returns:
Timestamp of the last time when the item has been updated (read only)
GroupItem

- class GroupItem()
GroupItem which accepts and converts the data types from OpenHAB
- Variables:
- classmethod get_item(name)
Returns an already existing item. If it does not exist or has a different item type an exception will occur.
- Parameters:
name (
str) – Name of the item- Return type:
Self
- command_value(value)
Send a command to the openHAB item, the same as oh_send_command
- get_persistence_data(persistence=None, start_time=None, end_time=None)
Query historical data from the OpenHAB persistence service
- get_value(default_value=None)
Return the value of the item. This is a helper function that returns a default in case the item value is None.
- Parameters:
default_value – Return this value if the item value is None
- Return type:
- Returns:
value of the item
- listen_event(callback, event_filter=None)
Register an event listener which listens to all event that the item receives
- Parameters:
callback (
Callable[[Any],Any]) – callback that accepts one parameter which will contain the eventevent_filter (
EventFilterBase|None) – Event filter. This is typicallyValueUpdateEventFilterorValueChangeEventFilterwhich will also trigger on changes/update from openhab or mqtt. Additionally, it can be an instance ofEventFilterwhich additionally filters on the values of the event. It is also possible to group filters logically with, e.g.AndFilterGroupandOrFilterGroup
- Return type:
- oh_post_update(value=<Missing>, source=None)
Post an update to the openHAB item
- oh_post_update_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>, source=None)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
source (
str|None) – (optional) source where this update comes from
- Return type:
- Returns:
True if the new value was posted else False
- oh_send_command(value=<Missing>, *, source=None)
Send a command to the openHAB item
- post_value(new_value)
Set a new value and post appropriate events on the HABApp event bus (
ValueUpdateEvent,ValueChangeEvent)
- post_value_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
- Return type:
- Returns:
True if the new value was posted else False
- set_value(new_value)
Set a new value without creating events on the event bus
- watch_change(secs)
Generate an event if the item does not change for a certain period of time. Has to be called from inside a rule function.
- watch_update(secs)
Generate an event if the item does not receive and update for a certain period of time. Has to be called from inside a rule function.
- property last_change: InstantView
- Returns:
Timestamp of the last time when the item has been changed (read only)
- property last_update: InstantView
- Returns:
Timestamp of the last time when the item has been updated (read only)
- property members: tuple[OpenhabItem, ...]
Resolves and then returns all group members
ImageItem

- class ImageItem()
ImageItem which accepts and converts the data types from OpenHAB
- Variables:
- classmethod get_item(name)
Returns an already existing item. If it does not exist or has a different item type an exception will occur.
- Parameters:
name (
str) – Name of the item- Return type:
Self
- command_value(value)
Send a command to the openHAB item, the same as oh_send_command
- get_persistence_data(persistence=None, start_time=None, end_time=None)
Query historical data from the OpenHAB persistence service
- get_value(default_value=None)
Return the value of the item. This is a helper function that returns a default in case the item value is None.
- Parameters:
default_value – Return this value if the item value is None
- Return type:
- Returns:
value of the item
- listen_event(callback, event_filter=None)
Register an event listener which listens to all event that the item receives
- Parameters:
callback (
Callable[[Any],Any]) – callback that accepts one parameter which will contain the eventevent_filter (
EventFilterBase|None) – Event filter. This is typicallyValueUpdateEventFilterorValueChangeEventFilterwhich will also trigger on changes/update from openhab or mqtt. Additionally, it can be an instance ofEventFilterwhich additionally filters on the values of the event. It is also possible to group filters logically with, e.g.AndFilterGroupandOrFilterGroup
- Return type:
- oh_post_update(value=<Missing>, *, image_type=None, source=None)
Post an update to an openHAB image with new image data. Image type is automatically detected, in rare cases when this does not work it can be set manually.
- oh_post_update_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>, source=None)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
source (
str|None) – (optional) source where this update comes from
- Return type:
- Returns:
True if the new value was posted else False
- oh_send_command(value=<Missing>, *, image_type=None, source=None)
Send a command to an openHAB image with new image data. Image type is automatically detected, in rare cases when this does not work it can be set manually.
- post_value(new_value)
Set a new value and post appropriate events on the HABApp event bus (
ValueUpdateEvent,ValueChangeEvent)
- post_value_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
- Return type:
- Returns:
True if the new value was posted else False
- set_value(new_value)
Set a new value without creating events on the event bus
- watch_change(secs)
Generate an event if the item does not change for a certain period of time. Has to be called from inside a rule function.
- watch_update(secs)
Generate an event if the item does not receive and update for a certain period of time. Has to be called from inside a rule function.
- property last_change: InstantView
- Returns:
Timestamp of the last time when the item has been changed (read only)
- property last_update: InstantView
- Returns:
Timestamp of the last time when the item has been updated (read only)
CallItem

- class CallItem()
CallItem which accepts and converts the data types from OpenHAB
- Variables:
name (str) – Item name
value (StringList) – Current item value (or state in openHAB wording)
last_value (StringList) – Last item value (or state in openHAB wording) before the current value one
label (str | None) – Item label or
Noneif not configured
- classmethod get_item(name)
Returns an already existing item. If it does not exist or has a different item type an exception will occur.
- Parameters:
name (
str) – Name of the item- Return type:
Self
- command_value(value)
Send a command to the openHAB item, the same as oh_send_command
- get_persistence_data(persistence=None, start_time=None, end_time=None)
Query historical data from the OpenHAB persistence service
- get_value(default_value=None)
Return the value of the item. This is a helper function that returns a default in case the item value is None.
- Parameters:
default_value – Return this value if the item value is None
- Return type:
- Returns:
value of the item
- listen_event(callback, event_filter=None)
Register an event listener which listens to all event that the item receives
- Parameters:
callback (
Callable[[Any],Any]) – callback that accepts one parameter which will contain the eventevent_filter (
EventFilterBase|None) – Event filter. This is typicallyValueUpdateEventFilterorValueChangeEventFilterwhich will also trigger on changes/update from openhab or mqtt. Additionally, it can be an instance ofEventFilterwhich additionally filters on the values of the event. It is also possible to group filters logically with, e.g.AndFilterGroupandOrFilterGroup
- Return type:
- oh_post_update(value=<Missing>, *, source=None)
Post an update to the openHAB item
- oh_post_update_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>, source=None)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
source (
str|None) – (optional) source where this update comes from
- Return type:
- Returns:
True if the new value was posted else False
- oh_send_command(value=<Missing>, *, source=None)
Send a command to the openHAB item
- post_value(new_value)
Set a new value and post appropriate events on the HABApp event bus (
ValueUpdateEvent,ValueChangeEvent)
- post_value_if(new_value, *, equal=<Missing>, eq=<Missing>, not_equal=<Missing>, ne=<Missing>, lower_than=<Missing>, lt=<Missing>, lower_equal=<Missing>, le=<Missing>, greater_than=<Missing>, gt=<Missing>, greater_equal=<Missing>, ge=<Missing>, is_=<Missing>, is_not=<Missing>)
Post a value depending on the current state of the item. If one of the comparisons is true the new state will be posted.
- Parameters:
new_value – new value to post
equal – item state has to be equal to the passed value
eq – item state has to be equal to the passed value
not_equal – item state has to be not equal to the passed value
ne – item state has to be not equal to the passed value
lower_than – item state has to be lower than the passed value
lt – item state has to be lower than the passed value
lower_equal – item state has to be lower equal the passed value
le – item state has to be lower equal the passed value
greater_than – item state has to be greater than the passed value
gt – item state has to be greater than the passed value
greater_equal – item state has to be greater equal the passed value
ge – item state has to be greater equal the passed value
is_ – item state has to be the same object as the passt value (e.g. None)
is_not – item state has to be not the same object as the passt value (e.g. None)
- Return type:
- Returns:
True if the new value was posted else False
- set_value(new_value)
Set a new value without creating events on the event bus
- watch_change(secs)
Generate an event if the item does not change for a certain period of time. Has to be called from inside a rule function.
- watch_update(secs)
Generate an event if the item does not receive and update for a certain period of time. Has to be called from inside a rule function.
- property last_change: InstantView
- Returns:
Timestamp of the last time when the item has been changed (read only)
- property last_update: InstantView
- Returns:
Timestamp of the last time when the item has been updated (read only)
Thing

- class Thing(name, *, interface)
Base class for Things
- Variables:
status (ThingStatusEnum) – Status of the thing (e.g. OFFLINE, ONLINE, …)
status_detail (ThingStatusDetailEnum) – Additional detail for the status
status_description (str) – Additional description for the status
label (str) – Thing label
location (str) – Thing location
configuration (Mapping[str, Any]) – Thing configuration
properties (Mapping[str, Any]) – Thing properties
- classmethod get_item(name)
Returns an already existing item. If it does not exist or has a different item type an exception will occur.
- Parameters:
name (
str) – Name of the item- Return type:
Self
- listen_event(callback, event_filter=None)
Register an event listener which listens to all event that the item receives
- Parameters:
callback (
Callable[[Any],Any]) – callback that accepts one parameter which will contain the eventevent_filter (
EventFilterBase|None) – Event filter. This is typicallyValueUpdateEventFilterorValueChangeEventFilterwhich will also trigger on changes/update from openhab or mqtt. Additionally, it can be an instance ofEventFilterwhich additionally filters on the values of the event. It is also possible to group filters logically with, e.g.AndFilterGroupandOrFilterGroup
- Return type:
- set_enabled(enable=True)
Enable/disable the thing
- Parameters:
enable (
bool) – True to enable, False to disable the thing- Returns:
- watch_change(secs)
Generate an event if the item does not change for a certain period of time. Has to be called from inside a rule function.
- watch_update(secs)
Generate an event if the item does not receive and update for a certain period of time. Has to be called from inside a rule function.
- property last_change: InstantView
- Returns:
Timestamp of the last time when the item has been changed (read only)
- property last_update: InstantView
- Returns:
Timestamp of the last time when the item has been updated (read only)
Interaction with a openHAB
All interaction with the openHAB is done through the self.oh or self.openhab object in the rule
or through an OpenhabItem.
Interface
- class OpenHabSyncInterface()
- post_update(item, state, *, source=None, transport='websocket')
Post an update to the item
- send_command(item, command, *, source=None, transport='websocket')
Send the specified command to the item
- get_item(item)
Return the complete openHAB item definition
- Parameters:
item (
str|ItemRegistryItem) – name of the item or item- Return type:
ItemResp|None- Returns:
openHAB item
- item_exists(item)
Check if an item exists in the openHAB item registry
- Parameters:
item (
str|ItemRegistryItem) – name of the item or item- Return type:
- Returns:
True if item was found
- remove_item(item)
Removes an item from the openHAB item registry
- Parameters:
item (
str|ItemRegistryItem) – name- Return type:
- Returns:
True if item was found and removed
- create_item(item_type, name, label=None, category=None, tags=None, groups=None, group_type=None, group_function=None, group_function_params=None)
Creates a new item in the openHAB item registry or updates an existing one
- remove_metadata(item, namespace)
Remove metadata from an item
- Parameters:
item (
str|ItemRegistryItem) – name of the item or itemnamespace (
str) – namespace
- Return type:
- Returns:
True if metadata was successfully removed
- set_metadata(item, namespace, value, config)
Add/set metadata to an item
- get_thing(thing)
Return the complete openHAB thing definition
- Parameters:
thing (
str|ItemRegistryItem) – name of the thing or the item- Return type:
ThingResp- Returns:
openHAB thing
- set_thing_enabled(thing, enabled)
Enable/disable a thing
- Parameters:
thing (
str|ItemRegistryItem) – name of the thing or the thing objectenabled (
bool) – True to enable thing, False to disable thing
- Return type:
- remove_obj_links(name)
Remove links from an item or a thing
- Parameters:
name (
str|ItemRegistryItem) – name of thing or item- Return type:
- get_link(item, channel)
returns the link between an item and a (things) channel
- Parameters:
item (
str|ItemRegistryItem) – name of the item or itemchannel (
str) – uid of the (things) channel (usually something like AAAA:BBBBB:CCCCC:DDDD:0#SOME_NAME)
- Return type:
ItemChannelLinkResp
- create_link(item, channel, configuration=None)
creates a link between an item and a (things) channel
- Parameters:
- Return type:
- Returns:
True on successful creation, otherwise False
- remove_link(item, channel)
removes a link between a (things) channel and an item
- Parameters:
item (
str|ItemRegistryItem) – name of the item or itemchannel (
str) – uid of the (things) channel (usually something like AAAA:BBBBB:CCCCC:DDDD:0#SOME_NAME)
- Return type:
- Returns:
True on successful removal, otherwise False
- get_persistence_services()
Return all available persistence services
- get_persistence_data(item, persistence, start_time, end_time)
Query historical data from the openHAB persistence service
- Parameters:
item (
str|ItemRegistryItem) – name of the persistent itempersistence (
str|None) – name of the persistence service (e.g.rrd4j,mapdb). If not set default will be usedstart_time (
datetime|None) – return only items which are newer than thisend_time (
datetime|None) – return only items which are older than this
- Return type:
OpenhabPersistenceData- Returns:
last stored data from persistency service
- set_persistence_data(item, persistence, time, state)
Set a measurement for a item in the persistence serivce
openHAB event types
openHAB produces various events that are mapped to the internal event bus. On the openHAB page there is an explanation for the various events.
Item events
ItemStateEvent
Since this event inherits from ValueUpdateEvent you can listen to ValueUpdateEvent
and it will also trigger for ItemStateEvent.

- class ItemStateEvent(name, value)
ItemStateChangedEvent
Since this event inherits from ValueChangeEvent you can listen to ValueChangeEvent
and it will also trigger for ItemStateChangedEvent.

- class ItemStateChangedEvent(name, value, old_value, *, last_state_update, last_state_change, source=None)
- Variables:
last_state_update (Instant | None) – Optional timestamp of the state update
last_state_change (Instant | None) – Optional timestamp of the state change
source (str | None) – Optional source of the update
ItemCommandEvent

ItemAddedEvent

ItemUpdatedEvent

ItemRemovedEvent

ItemStatePredictedEvent

GroupStateChangedEvent

Channel events
ChannelTriggeredEvent

Thing events
ThingAddedEvent

- class ThingAddedEvent(name, thing_type, label, location, channels, configuration, properties)
ThingUpdatedEvent

- class ThingUpdatedEvent(name, thing_type, label, location, channels, configuration, properties)
ThingRemovedEvent

- class ThingRemovedEvent(name, thing_type, label, location, channels, configuration, properties)
ThingStatusInfoEvent

- class ThingStatusInfoEvent(name='', status=ThingStatusEnum.UNINITIALIZED, detail=ThingStatusDetailEnum.NONE, description='')
- Variables:
name (str)
status (ThingStatusEnum)
detail (ThingStatusDetailEnum)
description (str)
ThingStatusInfoChangedEvent

- class ThingStatusInfoChangedEvent(name='', status=ThingStatusEnum.UNINITIALIZED, detail=ThingStatusDetailEnum.NONE, description='', old_status=ThingStatusEnum.UNINITIALIZED, old_detail=ThingStatusDetailEnum.NONE, old_description='')
- Variables:
name (str)
status (ThingStatusEnum)
detail (ThingStatusDetailEnum)
description (str)
old_status (ThingStatusEnum)
old_detail (ThingStatusDetailEnum)
old_description (str)
ThingFirmwareStatusInfoEvent

Event filters
ItemStateUpdatedEventFilter

- class ItemStateUpdatedEventFilter(value=<Missing>)
ItemStateChangedEventFilter

- class ItemStateChangedEventFilter(value=<Missing>, old_value=<Missing>)
ItemCommandEventFilter

- class ItemCommandEventFilter(value=<Missing>)
Transformations
From openHAB 4 on it’s possible to use the existing transformations in HABApp. Transformations are loaded every time when HABApp connects to openHAB. OpenHAB does not issue an event when the transformations change so in order for HABApp to pick up the changes either HABApp or openHAB has to be restarted. Available transformations are logged on connect.
map
The map transformation is returned as a dict. If the map transformation is defined with a default the default is used accordingly.
Example:
from HABApp.openhab import transformations
TEST_MAP = transformations.map['test.map'] # load the transformation, can be used anywhere
print(TEST_MAP['test_key']) # It's a normal dict with keys as str and values as str
# if all keys or values are numbers they are automatically casted to an int
NUMBERS = transformations.map['numbers.map']
print(NUMBERS[1]) # Note that the key is an int
test_value
test number meaning
Example openHAB rules
Example 1
import HABApp
from HABApp.core.events import ValueChangeEvent, ValueUpdateEvent
from HABApp.openhab.events import ItemCommandEvent, ItemStateChangedEvent, ItemStateEvent
from HABApp.openhab.items import ContactItem, DatetimeItem, SwitchItem
class MyOpenhabRule(HABApp.Rule):
def __init__(self) -> None:
super().__init__()
# get items
test_contact = ContactItem.get_item('TestContact')
test_date_time = DatetimeItem.get_item('TestDateTime')
test_switch = SwitchItem.get_item('TestSwitch')
# Trigger on item updates
test_contact.listen_event(self.item_state_update, ItemStateEvent)
test_date_time.listen_event(self.item_state_update, ValueUpdateEvent)
# Trigger on item changes
test_contact.listen_event(self.item_state_change, ItemStateChangedEvent)
test_date_time.listen_event(self.item_state_change, ValueChangeEvent)
# Trigger on item commands
test_switch.listen_event(self.item_command, ItemCommandEvent)
def item_state_update(self, event) -> None:
assert isinstance(event, ValueUpdateEvent)
print(f'{event}')
def item_state_change(self, event) -> None:
assert isinstance(event, ValueChangeEvent)
print(f'{event}')
# interaction is available through self.openhab or self.oh
self.openhab.send_command('TestItemCommand', 'ON')
# example for interaction with openhab item type
switch_item = SwitchItem.get_item('TestSwitch')
if switch_item.is_on():
switch_item.off()
def item_command(self, event) -> None:
assert isinstance(event, ItemCommandEvent)
print( f'{event}')
# interaction is available through self.openhab or self.oh
self.oh.post_update('ReceivedCommand', str(event))
MyOpenhabRule()
Check status of things
This rule prints the status of all Things and shows how to subscribe to events of the Thing status
from HABApp import Rule
from HABApp.core.events import EventFilter
from HABApp.openhab.events import ThingStatusInfoChangedEvent
from HABApp.openhab.items import Thing
class CheckAllThings(Rule):
def __init__(self) -> None:
super().__init__()
for thing in self.get_items(Thing):
thing.listen_event(self.thing_status_changed, EventFilter(ThingStatusInfoChangedEvent))
print(f'{thing.name}: {thing.status}')
def thing_status_changed(self, event: ThingStatusInfoChangedEvent) -> None:
print(f'{event.name} changed from {event.old_status} to {event.status}')
CheckAllThings()
Check status if thing is constant
Sometimes Things recover automatically from small outages. This rule only triggers when the Thing is constant
for 60 seconds.
from HABApp import Rule
from HABApp.core.events import ItemNoChangeEvent
from HABApp.openhab.items import Thing
class CheckThing(Rule):
def __init__(self, name: str):
super().__init__()
self.thing = Thing.get_item(name)
watcher = self.thing.watch_change(60)
watcher.listen_event(self.thing_no_change)
def thing_no_change(self, event: ItemNoChangeEvent):
print(f'Thing {event.name} constant for {event.seconds}')
print(f'Status: {self.thing.status}')
CheckThing('my:thing:uid')
Thing test_watch constant for 60
Status: ONLINE
/home/docs/.asdf/installs/python/3.13.14/lib/python3.13/asyncio/base_events.py:569: ResourceWarning: asynchronous generator <async_generator object HabAppObjProvider._reentrant_lock at 0x73da6c43e890> was scheduled after loop.shutdown_asyncgens() call