Table of Contents

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

connection HaMqttConnection
config LawnMowerConfig

Properties

ActivityStateTopic

The topic this mower publishes its activity to.

public string ActivityStateTopic { get; }

Property Value

string

DockCommandTopic

The topic this mower accepts a "dock" command on.

public string DockCommandTopic { get; }

Property Value

string

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

bool

PauseCommandTopic

The topic this mower accepts a "pause" command on.

public string PauseCommandTopic { get; }

Property Value

string

StartMowingCommandTopic

The topic this mower accepts a "start mowing" command on.

public string StartMowingCommandTopic { get; }

Property Value

string

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

payload JsonObject

PublishStateAsync(LawnMowerActivity, bool, CancellationToken)

Publishes the mower's current activity.

public Task PublishStateAsync(LawnMowerActivity activity, bool retain = true, CancellationToken cancellationToken = default)

Parameters

activity LawnMowerActivity
retain bool
cancellationToken CancellationToken

Returns

Task

Events

DockRequested

Raised when Home Assistant requests the mower dock.

public event Func<Task>? DockRequested

Event Type

Func<Task>

PauseRequested

Raised when Home Assistant requests the mower pause.

public event Func<Task>? PauseRequested

Event Type

Func<Task>

StartMowingRequested

Raised when Home Assistant requests mowing to start (or resume).

public event Func<Task>? StartMowingRequested

Event Type

Func<Task>