Table of Contents

Class DeviceTracker

Namespace
HaMqttDiscoverable.Entities
Assembly
HaMqttDiscoverable.dll

A read-only presence report - "home", "away", or a custom zone name. For full GPS tracking (latitude/longitude/accuracy), publish JSON with a json_attributes_topic yourself via the underlying HaMqttConnection; this entity covers the common home/away case.

public sealed class DeviceTracker : HaEntity<DeviceTrackerConfig>, IAsyncDisposable
Inheritance
DeviceTracker
Implements
Inherited Members

Constructors

DeviceTracker(HaMqttConnection, DeviceTrackerConfig)

Creates a device tracker from the given config.

public DeviceTracker(HaMqttConnection connection, DeviceTrackerConfig config)

Parameters

connection HaMqttConnection
config DeviceTrackerConfig

Methods

PublishStateAsync(bool, bool, CancellationToken)

Publishes "home" or "away".

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

Parameters

isHome bool
retain bool
cancellationToken CancellationToken

Returns

Task

PublishZoneAsync(string, bool, CancellationToken)

Publishes a custom zone name (anything other than the configured home/away payloads).

public Task PublishZoneAsync(string zoneName, bool retain = true, CancellationToken cancellationToken = default)

Parameters

zoneName string
retain bool
cancellationToken CancellationToken

Returns

Task