interface TimeSynchronizationBehavior {
    [reference]: Datasource<StateType>;
    agent: Agent;
    cluster: never;
    context: ActionContext;
    endpoint: Endpoint<Empty>;
    env: Environment;
    events: EventEmitter & Omit<ClusterEvents<Of<{
        attributes: {};
        commands: {};
        events: {};
        id: 0;
        name: "Unknown";
        revision: 0;
    }>, typeof ClusterBehavior>, never> & {
        granularity$Changing: ClusterEvents.AttributeObservable<Attribute<TimeSynchronization.Granularity, any>>;
        utcTime$Changing: ClusterEvents.AttributeObservable<Attribute<null | number | bigint, any>>;
    } & {
        timeSource$Changing: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<TimeSynchronization.TimeSource, any>>;
    } & {
        granularity$Changed: ClusterEvents.AttributeObservable<Attribute<TimeSynchronization.Granularity, any>>;
        utcTime$Changed: ClusterEvents.AttributeObservable<Attribute<null | number | bigint, any>>;
    } & {
        timeSource$Changed: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<TimeSynchronization.TimeSource, any>>;
    } & {
        timeFailure: ClusterEvents.EventObservable<Event<void, any>>;
    } & {};
    features: TypeFromBitSchema<{}> & TypeFromBitSchema<{
        ntpClient: BitFlag;
        ntpServer: BitFlag;
        timeSyncClient: BitFlag;
        timeZone: BitFlag;
    }>;
    session: SecureSession;
    state: Omit<ClusterState.Type<Of<{
        attributes: {};
        commands: {};
        events: {};
        id: 0;
        name: "Unknown";
        revision: 0;
    }>, typeof ClusterBehavior>, never> & {
        granularity: TimeSynchronization.Granularity;
        utcTime: null | number | bigint;
    } & {
        timeSource?: TimeSynchronization.TimeSource;
    } & {} & {};
    [asyncDispose](): MaybePromise;
    asAdmin(fn: (() => void)): void;
    assertAttributeEnabled<This, K>(this: This, attributeName: K): void;
    callback<A, R>(reactor: Reactor<A, R>, options?: Reactor.Options): ((...args: A) => undefined | R);
    initialize(_options?: {}): MaybePromise;
    reactTo<O>(observable: O, reactor: Reactor<Parameters<O["emit"]>, ReturnType<O["emit"]>>, options?: Reactor.Options): void;
    requireAttributeEnabled<This, K>(this: This, attributeName: K): Exclude<This["state"][K], undefined>;
    setUtcTime(request: TimeSynchronization.SetUtcTimeRequest): MaybePromise;
    toString(): string;
    State: any;
}

Hierarchy (view full)

Properties

[reference]: Datasource<StateType>
agent: Agent
cluster: never

The implemented cluster.

context: ActionContext
endpoint: Endpoint<Empty>
events: EventEmitter & Omit<ClusterEvents<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior>, never> & {
    granularity$Changing: ClusterEvents.AttributeObservable<Attribute<TimeSynchronization.Granularity, any>>;
    utcTime$Changing: ClusterEvents.AttributeObservable<Attribute<null | number | bigint, any>>;
} & {
    timeSource$Changing: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<TimeSynchronization.TimeSource, any>>;
} & {
    granularity$Changed: ClusterEvents.AttributeObservable<Attribute<TimeSynchronization.Granularity, any>>;
    utcTime$Changed: ClusterEvents.AttributeObservable<Attribute<null | number | bigint, any>>;
} & {
    timeSource$Changed: undefined | ClusterEvents.AttributeObservable<OptionalAttribute<TimeSynchronization.TimeSource, any>>;
} & {
    timeFailure: ClusterEvents.EventObservable<Event<void, any>>;
} & {}

Access the behavior's events.

Type declaration

  • ReadonlytimeFailure: ClusterEvents.EventObservable<Event<void, any>>

    This event shall be generated if the node has not generated a TimeFailure event in the last hour, and the node is unable to get a time from any source. This event SHOULD NOT be generated more often than once per hour.

    MatterSpecification.v13.Core § 11.17.10.4

features: TypeFromBitSchema<{}> & TypeFromBitSchema<{
    ntpClient: BitFlag;
    ntpServer: BitFlag;
    timeSyncClient: BitFlag;
    timeZone: BitFlag;
}>

Supported features as a flag object.

session: SecureSession
state: Omit<ClusterState.Type<Of<{
    attributes: {};
    commands: {};
    events: {};
    id: 0;
    name: "Unknown";
    revision: 0;
}>, typeof ClusterBehavior>, never> & {
    granularity: TimeSynchronization.Granularity;
    utcTime: null | number | bigint;
} & {
    timeSource?: TimeSynchronization.TimeSource;
} & {} & {}

Access the behavior's state.

Type declaration

  • Readonlygranularity: TimeSynchronization.Granularity

    The granularity of the error that the node is willing to guarantee on the time synchronization. It is of type GranularityEnum.

    This value shall be set to NoTimeGranularity if UTCTime is null and shall NOT be set to NoTimeGranularity if UTCTime is non-null.

    MatterSpecification.v13.Core § 11.17.8.2

  • ReadonlyutcTime: null | number | bigint

    If the node has achieved time synchronization, this shall indicate the current time as a UTC epoch-us (Epoch Time in Microseconds).

    If the node has not achieved time synchronization, this shall be null. This attribute may be set when a SetUTCTime is received.

    MatterSpecification.v13.Core § 11.17.8.1

Type declaration

  • Optional ReadonlytimeSource?: TimeSynchronization.TimeSource

    The node’s time source. This attribute indicates what method the node is using to sync, whether the source uses NTS or not and whether the source is internal or external to the Matter network. This attribute may be used by a client to determine its level of trust in the UTCTime. It is of type TimeSourceEnum.

    If a node is unsure if the selected NTP server is within the Matter network, it SHOULD select one of the NonMatter* values.

    This value shall be set to None if UTCTime is null and shall NOT be set to None if UTCTime is non-null.

    MatterSpecification.v13.Core § 11.17.8.3

Methods

  • Create a generic callback function that has the same properties as a Reactor.

    Like a reactor, the callback's "this" will be bound to an active Behavior instance. Because of this: The reactor MUST be a real JS function - arrow functions will not work!

    Type Parameters

    • A extends any[]
    • R

    Parameters

    Returns ((...args: A) => undefined | R)

      • (...args): undefined | R
      • Parameters

        • Rest...args: A

        Returns undefined | R

  • Behaviors are ephemeral and should not perform initialization in their constructor. They can override this method instead.

    This method may be synchronous or asyncronous. If asynchronous, the behavior will not be available for external use until initialization completes.

    Parameters

    • Optional_options: {}

      Returns MaybePromise

    • Install a Reactor.

      Important: The reactor MUST be a real JS function - arrow functions will not work!

      Type Parameters

      Parameters

      Returns void

    • This command may be issued by Administrator to set the time. If the Commissioner does not have a valid time source, it may send a Granularity of NoTimeGranularity.

      Upon receipt of this command, the node may update its UTCTime attribute to match the time specified in the command, if the stated Granularity and TimeSource are acceptable. The node shall update its UTCTime attribute if its current Granularity is NoTimeGranularity.

      If the time is updated, the node shall also update its Granularity attribute based on the granularity specified in the command and the expected clock drift of the node. This SHOULD normally be one level lower than the stated command Granularity. It shall also update its TimeSource attribute to Admin. It shall also update its Last Known Good UTC Time as defined in Section 3.5.6.1, “Last Known Good UTC Time”.

      If the node updates its UTCTime attribute, it shall accept the command with a status code of SUCCESS. If it opts to not update its time, it shall fail the command with a cluster specific Status Code of TimeNotAccepted.

      Returns MaybePromise

      MatterSpecification.v13.Core § 11.17.9.1