Table of Contents

Class Scene

Namespace
HaMqttDiscoverable.Entities
Assembly
HaMqttDiscoverable.dll

A stateless scene Home Assistant can activate, e.g. "Movie Night".

public sealed class Scene : HaEntity<SceneConfig>, IAsyncDisposable
Inheritance
Scene
Implements
Inherited Members

Constructors

Scene(HaMqttConnection, SceneConfig, Func<Task>?)

Creates a scene from the given config, optionally subscribing onActivated to Activated.

public Scene(HaMqttConnection connection, SceneConfig config, Func<Task>? onActivated = null)

Parameters

connection HaMqttConnection
config SceneConfig
onActivated Func<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

Activated

Raised whenever Home Assistant activates this scene.

public event Func<Task>? Activated

Event Type

Func<Task>