Table of Contents

Class MqttSettings

Namespace
HaMqttDiscoverable
Assembly
HaMqttDiscoverable.dll

Connection settings for the MQTT broker used to talk to Home Assistant.

public sealed class MqttSettings
Inheritance
MqttSettings
Inherited Members

Properties

ClientId

The MQTT client id to use. When omitted, a random id is generated so multiple instances of your application don't collide.

public string? ClientId { get; set; }

Property Value

string

DiscoveryPrefix

The homeassistant discovery prefix configured on the Home Assistant side. Defaults to "homeassistant".

public string DiscoveryPrefix { get; set; }

Property Value

string

EffectivePort

Resolves the effective port, taking UseTls into account.

public int EffectivePort { get; }

Property Value

int

Host

Hostname or IP address of the MQTT broker.

public string Host { get; set; }

Property Value

string

Password

Password used to authenticate with the broker, if required.

public string? Password { get; set; }

Property Value

string

Port

TCP port of the MQTT broker. Defaults to 1883 (or 8883 when UseTls is true).

public int? Port { get; set; }

Property Value

int?

PublishClientAvailability

When true (the default), the connection publishes a device-wide availability topic and registers it as an MQTT last-will message, so Home Assistant marks every entity that doesn't define its own Availability unavailable if the process dies unexpectedly.

public bool PublishClientAvailability { get; set; }

Property Value

bool

UseTls

Whether to connect over TLS.

public bool UseTls { get; set; }

Property Value

bool

Username

Username used to authenticate with the broker, if required.

public string? Username { get; set; }

Property Value

string