Table of Contents

Class Update

Namespace
HaMqttDiscoverable.Entities
Assembly
HaMqttDiscoverable.dll

Reports available firmware/software updates for a device, with an optional "Install" action.

public sealed class Update : HaEntity<UpdateConfig>, IAsyncDisposable
Inheritance
Update
Implements
Inherited Members

Constructors

Update(HaMqttConnection, UpdateConfig, Func<Task>?)

Creates an update entity from the given config, optionally subscribing onInstallRequested to InstallRequested.

public Update(HaMqttConnection connection, UpdateConfig config, Func<Task>? onInstallRequested = null)

Parameters

connection HaMqttConnection
config UpdateConfig
onInstallRequested Func<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

PublishStateAsync(UpdateState, bool, CancellationToken)

Publishes the current/available version info.

public Task PublishStateAsync(UpdateState state, bool retain = true, CancellationToken cancellationToken = default)

Parameters

state UpdateState
retain bool
cancellationToken CancellationToken

Returns

Task

Events

InstallRequested

Raised when the user clicks "Install" in Home Assistant.

public event Func<Task>? InstallRequested

Event Type

Func<Task>