Class Text
- Namespace
- HaMqttDiscoverable.Entities
- Assembly
- HaMqttDiscoverable.dll
A free-form string value that can be read and set from Home Assistant.
public sealed class Text : HaEntity<TextConfig>, IAsyncDisposable
- Inheritance
-
Text
- Implements
- Inherited Members
Constructors
Text(HaMqttConnection, TextConfig, Func<string, Task>?)
Creates a text entity from the given config, optionally subscribing onCommand to CommandReceived.
public Text(HaMqttConnection connection, TextConfig config, Func<string, Task>? onCommand = null)
Parameters
connectionHaMqttConnectionconfigTextConfigonCommandFunc<string, Task>
Properties
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
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
payloadstring
Returns
Events
CommandReceived
Raised when Home Assistant sends a new value.
public event Func<string, Task>? CommandReceived