solarnetwork-api-core
    Preparing search index...

    Class StreamDatum

    A stream datum entity.

    A stream datum is a datum without any metadata describing the datum property names. The instantantaneous, accumulating, and status property values are stored as the array fields iProps, aProps, and sProps. A DatumStreamMetadata object is required to associate names with these arrays.

    Implements

    Index

    Constructors

    • Constructor.

      Parameters

      • streamId: string

        the datum stream ID

      • ts: string | number | Date

        the datum timestamp, either as a Date instance or a form suitable for constructing as new Date(ts)

      • OptionaliProps: number[]

        the instantaneous property values

      • OptionalaProps: number[]

        the accumulating property values

      • OptionalsProps: string[]

        the status property values

      • Optionaltags: string[] | Iterable<string, any, any>

        the tag values

      • Optionalmeta: DatumStreamMetadata | DatumStreamMetadataRegistry

        optional metadata to attach, or a metadata registry to resolve metadata based on the given streamId

      Returns StreamDatum

    Properties

    aProps?: number[]

    The accumulating property values.

    iProps?: number[]

    The instantaneous property values.

    Attached metadata.

    sProps?: string[]

    The status property values.

    streamId: string

    The stream ID.

    tags?: Set<string>

    The tag values.

    ts: Date

    The timestamp.

    Accessors

    Methods

    • Get this object as an array suitable for encoding into a standard stream datum JSON string.

      This method can encode the datum into an array using one of two ways, depending on whether the registry argument is provided. When provided, the first array element will be the stream metadata index based on calling indexOfMetadataStreamId(). Otherwise the first array element will be the stream ID itself.

      For example if a registry is used, the resulting array might look like this:

      [0, 1650667326308, 12326, null, 230.19719, 50.19501, 6472722]
      

      while without a registry the array might look like this:

      ["7714f762-2361-4ec2-98ab-7e96807b32a6", 1650667326308, 12326, null, 230.19719, 50.19501, 6472722]
      

      Parameters

      Returns any[]

      the datum stream array object

    • Get this instance as a simple object.

      The following basic properties will be set on the returned object:

      • streamId - the stream ID
      • date - the timestamp
      • sourceId - the metadata source ID
      • nodeId or locationId - either the node ID or location ID from the metadata
      • tags - any tags (as an Array)

      Beyond that, all instantaneous, accumulating, and status properties will be included. If duplicate property names exist between the different classifications, the first-available value will be used.

      Parameters

      Returns undefined | Record<string, any>

      an object populated with all available properties