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

    Class Button

    Implements an MQTT button for Home Assistant discovery

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    attributesTopic: string
    availabilityTopic?: string
    configTopic: string
    entity: ButtonInfo
    entityTopic: string
    isBuffer: boolean = false
    parseJson: boolean = true
    stateTopic: string
    wroteConfiguration: boolean = false

    Accessors

    • get commandTopic(): string

      Returns string

    • get mqtt(): MqttClient

      Returns MqttClient

    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>

    • Override base config to add the command topic of this switch

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

    • Parameters

      • topic: string
      • payload: string | Buffer<ArrayBufferLike>

      Returns Promise<undefined | Packet>

    • 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>