Table of Contents

Class Select

Namespace
HaMqttDiscoverable.Entities
Assembly
HaMqttDiscoverable.dll

A value picked from a fixed list of options, e.g. an operating mode.

public sealed class Select : HaEntity<SelectConfig>, IAsyncDisposable
Inheritance
Select
Implements
Inherited Members

Constructors

Select(HaMqttConnection, SelectConfig, Func<string, Task>?)

Creates a select from the given config, optionally subscribing onCommand to CommandReceived.

public Select(HaMqttConnection connection, SelectConfig config, Func<string, Task>? onCommand = null)

Parameters

connection HaMqttConnection
config SelectConfig
onCommand Func<string, Task>

Properties

SupportsCommands

Whether this entity type accepts commands from Home Assistant (e.g. switches, numbers). Sensors are read-only and return false.

protected override bool SupportsCommands { get; }

Property Value

bool

Methods

OnCommandReceivedAsync(string)

Called with the raw payload every time a message arrives on CommandTopic. Overridden by controllable entity types.

protected override Task OnCommandReceivedAsync(string payload)

Parameters

payload string

Returns

Task

Events

CommandReceived

Raised when Home Assistant sends a newly selected option.

public event Func<string, Task>? CommandReceived

Event Type

Func<string, Task>