TimeSeries

items. TimeSeries

A TimeSeries is used to transport a set of states together with their timestamp. It is usually used for persisting historic state or forecasts in a persistence service.

Constructor

new TimeSeries(policy)

Description:
  • Creates a new TimeSeries.

    The TimeSeries policy defines how the TimeSeries is persisted in a persistence service: ADD adds the content to the persistence, REPLACE first removes all persisted elements in the timespan given by begin and end.

Source:
Parameters:
Name Type Description
policy string

TimeSeries policy ADD or REPLACE

Members

begin :time.Instant

Description:
  • Timestamp of the first element in the TimeSeries

Source:

Timestamp of the first element in the TimeSeries

Type:
  • time.Instant

end :time.Instant

Description:
  • Timestamp of the last element in the TimeSeries

Source:

Timestamp of the last element in the TimeSeries

Type:
  • time.Instant

policy :string

Description:
  • The persistence policy of this TimeSeries

Source:

The persistence policy of this TimeSeries

Type:
  • string

size :number

Description:
  • Number of elements in the TimeSeries

Source:

Number of elements in the TimeSeries

Type:
  • number

states :Array

Description:
  • States of the TimeSeries together with their timestamp and sorted by their timestamps

    Be aware that this method returns a reference to the internal state array, so changes to the array will affect the TimeSeries.

Source:

States of the TimeSeries together with their timestamp and sorted by their timestamps

Be aware that this method returns a reference to the internal state array, so changes to the array will affect the TimeSeries.

Type:
  • Array

Methods

add(timestamp, state) → {TimeSeries}

Description:
  • Add a new element to the TimeSeries.

    Elements can be added in an arbitrary order and are sorted chronologically.

Source:
Parameters:
Name Type Description
timestamp time.Instant | time.ZonedDateTime | string | Date

a timestamp for the given state

state string | number | Quantity | HostState

the state at the given timestamp

Returns:

this TimeSeries instance

Type
TimeSeries