Table of Contents

Class Device

Namespace
HaMqttDiscoverable
Assembly
HaMqttDiscoverable.dll

Describes the physical device an entity belongs to, as understood by Home Assistant's device registry. Entities that share the same Identifiers are grouped under a single device in Home Assistant.

public sealed class Device
Inheritance
Device
Inherited Members

Properties

ConfigurationUrl

A URL that shows more info about the device.

[JsonPropertyName("configuration_url")]
public string? ConfigurationUrl { get; set; }

Property Value

string

Connections

A list of [connection_type, connection_identifier] tuples, e.g. ["mac", "AA:BB:CC:DD:EE:FF"].

[JsonPropertyName("connections")]
public List<List<string>>? Connections { get; set; }

Property Value

List<List<string>>

HardwareVersion

The hardware version of the device.

[JsonPropertyName("hw_version")]
public string? HardwareVersion { get; set; }

Property Value

string

Identifiers

One or more unique identifiers for the device (e.g. a serial number). At least one identifier or a Connections entry is required for Home Assistant to be able to link entities to this device.

[JsonPropertyName("identifiers")]
public List<string> Identifiers { get; set; }

Property Value

List<string>

Manufacturer

The manufacturer of the device.

[JsonPropertyName("manufacturer")]
public string? Manufacturer { get; set; }

Property Value

string

Model

The model name of the device.

[JsonPropertyName("model")]
public string? Model { get; set; }

Property Value

string

ModelId

The model identifier/SKU of the device.

[JsonPropertyName("model_id")]
public string? ModelId { get; set; }

Property Value

string

Name

The name of the device as shown in Home Assistant.

[JsonPropertyName("name")]
public string? Name { get; set; }

Property Value

string

SoftwareVersion

The firmware/software version running on the device.

[JsonPropertyName("sw_version")]
public string? SoftwareVersion { get; set; }

Property Value

string

SuggestedArea

Suggests an area in Home Assistant this device should be placed in.

[JsonPropertyName("suggested_area")]
public string? SuggestedArea { get; set; }

Property Value

string

ViaDevice

The identifier of a device that "routes" messages for this device, e.g. a hub or gateway. Must match the Identifiers of another discovered device.

[JsonPropertyName("via_device")]
public string? ViaDevice { get; set; }

Property Value

string

Methods

Create(string, string, string?, string?, string?)

Creates a device with a single identifier, which covers the common case.

public static Device Create(string identifier, string name, string? manufacturer = null, string? model = null, string? softwareVersion = null)

Parameters

identifier string
name string
manufacturer string
model string
softwareVersion string

Returns

Device