@ginden/ha-mqtt-discoverable
    Preparing search index...

    Class Discoverable<E, Events>Abstract

    Base class for making MQTT discoverable objects

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    attributesTopic: string
    availabilityTopic?: string
    configTopic: string
    entity: E
    entityTopic: string
    stateTopic: string
    wroteConfiguration: boolean = false

    Accessors

    Methods

    • Parameters

      • state: null | string | number | Buffer<ArrayBufferLike> = null
      • topic: null | string = null
      • last_reset: null | string = null
      • retain: boolean = true

      Returns Promise<undefined | Packet>

    • Returns {
          availability_topic?: string;
          json_attributes_topic: string;
          state_topic: string;
      }

    • Register the entity within Home Assistant

      Returns Promise<void>

    • Parameters

      • attributes: Record<string, unknown>

      Returns Promise<undefined | Packet>

    • This method will throw an error if the availability topic is not set

      Parameters

      • available: boolean

      Returns Promise<undefined | Packet>

    • Parameters

      • n: number

      Returns this

    • Unregister the entity from Home Assistant

      Returns Promise<void>

    • Writes the configuration to the MQTT broker

      Returns Promise<undefined | Packet>