itemutils

Namespace

itemutils

Description:
  • Items namespace

    This namespace provides tools for Items.

Source:

Classes

GroupUtils

Methods

(static) createExpireCountdownRule(config)

Description:
  • Creates a universal expire rule with a second-accurate countdown.

Source:
Parameters:
Name Type Description
config Object

Configuration object

Properties
Name Type Attributes Default Description
itemName string

The item to monitor (e.g., Switch, Dimmer, etc.)

delay time.Duration

Delay to wait before the timer expires and the specified action is performed

action 'STATE' | 'COMMAND' <optional>
'COMMAND'

The action to be performed when the timer expires

targetState string

The state or command to be sent to the item when the timer expires

ignoreStateUpdates boolean <optional>
false

Whether to ignore state updates and don't reset the timer

ignoreCommands boolean <optional>
false

Whether to ignore commands and don't reset the timer

countdownItemName string <optional>

The optional {@code Number:Time} item for the remaining countdown in seconds

Throws:

when {@code config} is invalid

Type
TypeError

(static) dimItem(itemName, targetState, step, time, ignoreExternalChangeopt, overwriteopt)

Description:
  • Dims an Item step-by-step to a target state.

    Only works for Items with support for float states. The dimmer uses the shared cache to ensure that there are not multiple timers for the same Item active at the same time.

Source:
Example
// Dim the Bedroom_Light to 50% in 750 seconds (1% each 15 seconds).
itemutils.dimItem('Bedroom_Light', 50.0, 1, 15 * 1000);
Parameters:
Name Type Attributes Default Description
itemName string

name of the Item to control

targetState number

float number to dim to

step number

dimming step size

time number

time in milliseconds between each step

ignoreExternalChange boolean <optional>
false

whether to break dimmer if Item receives a large external change

overwrite boolean <optional>
false

whether to cancel an existing dimmer and create a new one

Throws:

when a parameter has wrong type

Type
TypeError

(static) getGroupUtils(groupName) → {GroupUtils}

Description:
  • Gets an instance of groupUtils.

Source:
Parameters:
Name Type Description
groupName string

the name of the group

Returns:
Type
GroupUtils