Skip to content

Latest commit

 

History

History
454 lines (331 loc) · 14.2 KB

util.rst

File metadata and controls

454 lines (331 loc) · 14.2 KB

HABApp.util

util - helpers and utilities

The util package contains useful classes which make rule creation easier.

Functions

min

This function is very useful together with the all possible functions of ~HABApp.util.multimode.ValueMode for the ~HABApp.util.multimode.MultiModeItem. For example it can be used to automatically disable or calculate the new value of the ~HABApp.util.multimode.ValueMode It behaves like the standard python function except that it will ignore None values which are sometimes set as the item state.

HABApp.util.functions.min

max

This function is very useful together with the all possible functions of ~HABApp.util.multimode.ValueMode for the ~HABApp.util.multimode.MultiModeItem. For example it can be used to automatically disable or calculate the new value of the ~HABApp.util.multimode.ValueMode It behaves like the standard python function except that it will ignore None values which are sometimes set as the item state.

HABApp.util.functions.max

rgb_to_hsb

Converts a rgb value to hsb color space

HABApp.util.functions.rgb_to_hsb

hsb_to_rgb

Converts a hsb value to the rgb color space

HABApp.util.functions.hsb_to_rgb

Statistics

Example

Documentation

Statistics

Fade

Fade is a helper class which allows to easily fade a value up or down.

Example

This example shows how to fade a Dimmer from 0 to 100 in 30 secs

This example shows how to fade three values together (e.g. for an RGB strip)

Documentation

Fade

EventListenerGroup

EventListenerGroup is a helper class which allows to subscribe to multiple items at once. All subscriptions can be canceled together, too. This is useful if e.g. something has to be done once after a sensor reports a value.

Example

This is a rule which will turn on the lights once (!) in a room on the first movement in the morning. The lights will only turn on after 4 and before 8 and two movement sensors are used to pick up movement.

Documentation

EventListenerGroup

MultiModeItem

Prioritizer item which automatically switches between values with different priorities. Very useful when different states or modes overlap, e.g. automatic and manual mode. etc.

Basic Example

Advanced Example

Example SwitchItemValueMode

The SwitchItemMode is same as ValueMode but enabled/disabled of the mode is controlled by a openHAB ~HABApp.openhab.items.SwitchItem. This is very useful if the mode shall be deactivated from the openHAB sitemaps.

Documentation

MultiModeItem

HABApp.util.multimode.MultiModeItem

ValueMode

HABApp.util.multimode.ValueMode

SwitchItemValueMode

HABApp.util.multimode.SwitchItemValueMode