Table of Contents

Class Notify

Namespace
HaMqttDiscoverable.Entities
Assembly
HaMqttDiscoverable.dll

A notification target Home Assistant can send messages to (e.g. via the notify.send_message action).

public sealed class Notify : HaEntity<NotifyConfig>, IAsyncDisposable
Inheritance
Notify
Implements
Inherited Members

Constructors

Notify(HaMqttConnection, NotifyConfig, Func<string, Task>?)

Creates a notify target from the given config, optionally subscribing onMessage to MessageReceived.

public Notify(HaMqttConnection connection, NotifyConfig config, Func<string, Task>? onMessage = null)

Parameters

connection HaMqttConnection
config NotifyConfig
onMessage Func<string, Task>

Properties

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

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

Events

MessageReceived

Raised when Home Assistant sends a message to this target.

public event Func<string, Task>? MessageReceived

Event Type

Func<string, Task>