Class LawnMower
- Namespace
- HaMqttDiscoverable.Entities
- Assembly
- HaMqttDiscoverable.dll
A robot lawn mower with start/pause/dock controls and an activity report.
public sealed class LawnMower : HaEntity<LawnMowerConfig>, IAsyncDisposable
- Inheritance
-
LawnMower
- Implements
- Inherited Members
Constructors
LawnMower(HaMqttConnection, LawnMowerConfig)
Creates a lawn mower from the given config.
public LawnMower(HaMqttConnection connection, LawnMowerConfig config)
Parameters
connectionHaMqttConnectionconfigLawnMowerConfig
Properties
ActivityStateTopic
The topic this mower publishes its activity to.
public string ActivityStateTopic { get; }
Property Value
DockCommandTopic
The topic this mower accepts a "dock" command on.
public string DockCommandTopic { get; }
Property Value
HasStateTopic
Whether this entity type reports a state at all. Stateless entities like Button override this to false.
protected override bool HasStateTopic { get; }
Property Value
PauseCommandTopic
The topic this mower accepts a "pause" command on.
public string PauseCommandTopic { get; }
Property Value
StartMowingCommandTopic
The topic this mower accepts a "start mowing" command on.
public string StartMowingCommandTopic { get; }
Property Value
Methods
EnrichDiscoveryPayload(JsonObject)
Allows subclasses to add fields to the discovery payload that aren't part of EntityConfig directly.
protected override void EnrichDiscoveryPayload(JsonObject payload)
Parameters
payloadJsonObject
PublishStateAsync(LawnMowerActivity, bool, CancellationToken)
Publishes the mower's current activity.
public Task PublishStateAsync(LawnMowerActivity activity, bool retain = true, CancellationToken cancellationToken = default)
Parameters
activityLawnMowerActivityretainboolcancellationTokenCancellationToken
Returns
Events
DockRequested
Raised when Home Assistant requests the mower dock.
public event Func<Task>? DockRequested
Event Type
PauseRequested
Raised when Home Assistant requests the mower pause.
public event Func<Task>? PauseRequested
Event Type
StartMowingRequested
Raised when Home Assistant requests mowing to start (or resume).
public event Func<Task>? StartMowingRequested