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
connectionHaMqttConnectionconfigUpdateConfigonInstallRequestedFunc<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
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
payloadstring
Returns
PublishStateAsync(UpdateState, bool, CancellationToken)
Publishes the current/available version info.
public Task PublishStateAsync(UpdateState state, bool retain = true, CancellationToken cancellationToken = default)
Parameters
stateUpdateStateretainboolcancellationTokenCancellationToken
Returns
Events
InstallRequested
Raised when the user clicks "Install" in Home Assistant.
public event Func<Task>? InstallRequested