mqtt2ha
    Preparing search index...

    Type Alias CommandCallback<TCommandMap>

    CommandCallback: <TTopicName extends keyof TCommandMap & string>(
        topicName: TTopicName,
        message: string,
    ) => Promise<void>

    A callback type for handling commands received via MQTT.

    MQTT command payloads are always strings, so the values of TCommandMap are constrained to string. Components that receive a JSON-encoded payload on a command topic are responsible for decoding it inside their handler.

    Type Parameters

    • TCommandMap extends Record<string, string>

      A mapping of command topic names to their (always string) message payloads

    Type Declaration