ItemHistory

items. ItemHistory

Class representing the historic state of an openHAB Item. If the Item receives its 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.

Be warned: This class can throw several exceptions from the underlying Java layer. It is recommended to wrap the methods of this class inside a try_catch block!

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 time.ZonedDateTime | Date

begin

end time.ZonedDateTime | Date

end

serviceId string <optional>

Optional persistence service ID, if omitted, the default persistence 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 time.ZonedDateTime | Date
serviceId string <optional>

Optional persistence service ID, if omitted, the default persistence 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 time.ZonedDateTime | Date

begin

end time.ZonedDateTime | Date

end

serviceId string <optional>

Optional persistence service ID, if omitted, the default persistence 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 time.ZonedDateTime | Date
serviceId string <optional>

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

Returns:
Type
boolean

countBetween(begin, end, serviceIdopt) → {number}

Source:

Gets the number of available historic data points of a given Item between two certain points in time.

Parameters:
Name Type Attributes Description
begin time.ZonedDateTime | Date

begin

end time.ZonedDateTime | Date

end

serviceId string <optional>

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

Returns:
Type
number

countSince(timestamp, serviceIdopt) → {number}

Source:

Gets the number of available historic data points of a given Item since a certain point in time.

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

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

Returns:
Type
number

countStateChangesBetween(begin, end, serviceIdopt) → {number}

Source:

Gets the number of changes in historic data points of a given Item between two certain points in time.

Parameters:
Name Type Attributes Description
begin time.ZonedDateTime | Date

begin

end time.ZonedDateTime | Date

end

serviceId string <optional>

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

Returns:
Type
number

countStateChangesSince(timestamp, serviceIdopt) → {number}

Source:

Gets the number of changes in historic data points of a given Item since a certain point in time.

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

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

Returns:
Type
number

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 time.ZonedDateTime | Date

begin

end time.ZonedDateTime | Date

end

serviceId string <optional>

Optional persistence service ID, if omitted, the default persistence 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 time.ZonedDateTime | Date
serviceId string <optional>

Optional persistence service ID, if omitted, the default persistence 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 time.ZonedDateTime | Date

begin

end time.ZonedDateTime | Date

end

serviceId string <optional>

Optional persistence service ID, if omitted, the default persistence 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 time.ZonedDateTime | Date
serviceId string <optional>

Optional persistence service ID, if omitted, the default persistence 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 time.ZonedDateTime | Date
serviceId string <optional>

Optional persistence service ID, if omitted, the default persistence 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 time.ZonedDateTime | Date

begin

end time.ZonedDateTime | Date

end

serviceId string <optional>

Optional persistence service ID, if omitted, the default persistence 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 time.ZonedDateTime | Date
serviceId string <optional>

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

Returns:
Type
number | null

getAllStatesBetween(begin, end, serviceIdopt) → {Array.<HistoricItem>}

Source:

Retrieves the HistoricItems for for a given Item between two certain points in time.

Parameters:
Name Type Attributes Description
begin time.ZonedDateTime | Date

begin

end time.ZonedDateTime | Date

end

serviceId string <optional>

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

Returns:
Type
Array.<HistoricItem>

getAllStatesSince(timestamp, serviceIdopt) → {Array.<HistoricItem>}

Source:

Retrieves the HistoricItems for for a given Item since a certain point in time.

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

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

Returns:
Type
Array.<HistoricItem>

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

Source:

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

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

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

Returns:

historic item

Type
HistoricItem | null

lastUpdate(serviceIdopt) → {time.ZonedDateTime|null}

Source:

Query the last update time of a given Item.

Parameters:
Name Type Attributes Description
serviceId string <optional>

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

Returns:
Type
time.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 persistence service ID, if omitted, the default persistence service will be used.

Returns:

state

Type
string | null

maximumBetween(begin, end, serviceIdopt) → {HistoricItem|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 time.ZonedDateTime | Date

begin

end time.ZonedDateTime | Date

end

serviceId string <optional>

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

Returns:

historic item or null

Type
HistoricItem | null

maximumSince(timestamp, serviceIdopt) → {HistoricItem|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 time.ZonedDateTime | Date
serviceId string <optional>

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

Returns:

historic item or null

Type
HistoricItem | null

minimumBetween(begin, end, serviceIdopt) → {HistoricItem|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 time.ZonedDateTime | Date

begin

end time.ZonedDateTime | Date

end

serviceId string <optional>

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

Returns:

historic item or null

Type
HistoricItem | null

minimumSince(timestamp, serviceIdopt) → {HistoricItem|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 time.ZonedDateTime | Date
serviceId string <optional>

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

Returns:

historic item or null

Type
HistoricItem | null

persist(serviceIdopt)

Source:

Persists the state of a given Item.

Parameters:
Name Type Attributes Description
serviceId string <optional>

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

previousState(skipEqualopt, serviceIdopt) → {HistoricItem|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 persistence service ID, if omitted, the default persistence service will be used.

Returns:

historic item or null

Type
HistoricItem | 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 time.ZonedDateTime | Date

begin

end time.ZonedDateTime | Date

end

serviceId string <optional>

Optional persistence service ID, if omitted, the default persistence 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 time.ZonedDateTime | Date
serviceId string <optional>

Optional persistence service ID, if omitted, the default persistence 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 time.ZonedDateTime | Date

begin

end time.ZonedDateTime | Date

end

serviceId string <optional>

Optional persistence service ID, if omitted, the default persistence 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 time.ZonedDateTime | Date
serviceId string <optional>

Optional persistence service ID, if omitted, the default persistence 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 time.ZonedDateTime | Date

begin

end time.ZonedDateTime | Date

end

serviceId string <optional>

Optional persistence service ID, if omitted, the default persistence 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 time.ZonedDateTime | Date
serviceId string <optional>

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

Returns:
Type
number | null