ItemHistory

items. ItemHistory

Class representing the historic state of an openHAB Item. If the Item receives it's state from a binding that supports units of measurement, the returned state is in the according base unit, otherwise there is no unit conversion happening. Wrapping the PersistenceExtensions.

Methods

averageBetween(begin, end, serviceIdopt) → {number|null}

Source:

Gets the average value of the state of a given Item between two certain points in time.

Parameters:
Name Type Attributes Description
begin ZonedDateTime | Date

begin

end ZonedDateTime | Date

end

serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
number | null

averageSince(timestamp, serviceIdopt) → {number|null}

Source:

Gets the average value of the state of a given Item since a certain point in time.

Example
var yesterday = new Date(new Date().getTime() - (24 * 60 * 60 * 1000));
var item = items.getItem('KitchenDimmer');
console.log('KitchenDimmer average since yesterday', item.history.averageSince(yesterday));
Parameters:
Name Type Attributes Description
timestamp ZonedDateTime | Date
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
number | null

changedBetween(begin, end, serviceIdopt) → {boolean}

Source:

Checks if the state of a given Item has changed between two certain points in time.

Parameters:
Name Type Attributes Description
begin ZonedDateTime | Date

begin

end ZonedDateTime | Date

end

serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
boolean

changedSince(timestamp, serviceIdopt) → {boolean}

Source:

Checks if the state of a given Item has changed since a certain point in time.

Parameters:
Name Type Attributes Description
timestamp ZonedDateTime | Date
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
boolean

deltaBetween(begin, end, serviceIdopt) → {number|null}

Source:

Gets the difference value of the state of a given Item between two certain points in time.

Parameters:
Name Type Attributes Description
begin ZonedDateTime | Date

begin

end ZonedDateTime | Date

end

serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
number | null

deltaSince(timestamp, serviceIdopt) → {number|null}

Source:

Gets the difference value of the state of a given Item since a certain point in time.

Parameters:
Name Type Attributes Description
timestamp ZonedDateTime | Date
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
number | null

deviationBetween(begin, end, serviceIdopt) → {number|null}

Source:

Gets the standard deviation of the state of the given Item between two certain points in time.

Parameters:
Name Type Attributes Description
begin ZonedDateTime | Date

begin

end ZonedDateTime | Date

end

serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
number | null

deviationSince(timestamp, serviceIdopt) → {number|null}

Source:

Gets the standard deviation of the state of the given Item since a certain point in time.

Parameters:
Name Type Attributes Description
timestamp ZonedDateTime | Date
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
number | null

evolutionRate(timestamp, serviceIdopt) → {number|null}

Source:
Deprecated:
  • Replaced by evolutionRateSince and evolutionRateBetween.

Gets the evolution rate of the state of a given Item since a certain point in time.

Parameters:
Name Type Attributes Description
timestamp ZonedDateTime | Date
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
number | null

evolutionRateBetween(begin, end, serviceIdopt) → {number|null}

Source:

Gets the evolution rate of the state of a given Item between two certain points in time.

Parameters:
Name Type Attributes Description
begin ZonedDateTime | Date

begin

end ZonedDateTime | Date

end

serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
number | null

evolutionRateSince(timestamp, serviceIdopt) → {number|null}

Source:

Gets the evolution rate of the state of a given Item since a certain point in time.

Parameters:
Name Type Attributes Description
timestamp ZonedDateTime | Date
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
number | null

historicState(timestamp, serviceIdopt) → {string|null}

Source:

Retrieves the historic state for a given Item at a certain point in time.

Parameters:
Name Type Attributes Description
timestamp ZonedDateTime | Date
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:

state

Type
string | null

lastUpdate(serviceIdopt) → {ZonedDateTime|null}

Source:

Query the last update time of a given Item.

Parameters:
Name Type Attributes Description
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
ZonedDateTime | null

latestState(serviceIdopt) → {string|null}

Source:

Retrieves the historic item state for a given Item at the current point in time.

Parameters:
Name Type Attributes Description
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:

state

Type
string | null

maximumBetween(begin, end, serviceIdopt) → {number|null}

Source:

Gets the state with the maximum value of a given Item between two certain points in time.

Parameters:
Name Type Attributes Description
begin ZonedDateTime | Date

begin

end ZonedDateTime | Date

end

serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:

state or null

Type
number | null

maximumSince(timestamp, serviceIdopt) → {number|null}

Source:

Gets the state with the maximum value of a given Item since a certain point in time.

Parameters:
Name Type Attributes Description
timestamp ZonedDateTime | Date
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:

state or null

Type
number | null

minimumBetween(begin, end, serviceIdopt) → {number|null}

Source:

Gets the state with the minimum value of a given Item between two certain points in time.

Parameters:
Name Type Attributes Description
begin ZonedDateTime | Date

begin

end ZonedDateTime | Date

end

serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:

state or null

Type
number | null

minimumSince(timestamp, serviceIdopt) → {number|null}

Source:

Gets the state with the minimum value of a given Item since a certain point in time.

Parameters:
Name Type Attributes Description
timestamp ZonedDateTime | Date
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:

state or null

Type
number | null

persist(serviceIdopt)

Source:

Persists the state of a given Item.

Parameters:
Name Type Attributes Description
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

previousState(skipEqualopt, serviceIdopt) → {string|null}

Source:

Returns the previous state of a given Item.

Parameters:
Name Type Attributes Description
skipEqual boolean <optional>

optional, if true, skips equal state values and searches the first state not equal the current state

serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:

state or null

Type
string | null

sumBetween(begin, end, serviceIdopt) → {number|null}

Source:

Gets the sum of the states of a given Item between two certain points in time.

Parameters:
Name Type Attributes Description
begin ZonedDateTime | Date

begin

end ZonedDateTime | Date

end

serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
number | null

sumSince(timestamp, serviceIdopt) → {number|null}

Source:

Gets the sum of the states of a given Item since a certain point in time.

Parameters:
Name Type Attributes Description
timestamp ZonedDateTime | Date
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
number | null

updatedBetween(begin, end, serviceIdopt) → {boolean}

Source:

Checks if the state of a given Item has been updated between two certain points in time.

Parameters:
Name Type Attributes Description
begin ZonedDateTime | Date

begin

end ZonedDateTime | Date

end

serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
boolean

updatedSince(timestamp, serviceIdopt) → {boolean}

Source:

Checks if the state of a given Item has been updated since a certain point in time.

Parameters:
Name Type Attributes Description
timestamp ZonedDateTime | Date
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
boolean

varianceBetween(begin, end, serviceIdopt) → {number|null}

Source:

Gets the variance of the state of the given Item between two certain points in time.

Parameters:
Name Type Attributes Description
begin ZonedDateTime | Date

begin

end ZonedDateTime | Date

end

serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
number | null

varianceSince(timestamp, serviceIdopt) → {number|null}

Source:

Gets the variance of the state of the given Item since a certain point in time.

Parameters:
Name Type Attributes Description
timestamp ZonedDateTime | Date
serviceId string <optional>

Optional persistance service ID, if omitted, the default persistance service will be used.

Returns:
Type
number | null