Class WaterHeater
- Namespace
- HaMqttDiscoverable.Entities
- Assembly
- HaMqttDiscoverable.dll
A water heater with an operating mode plus a target/current temperature.
public sealed class WaterHeater : HaEntity<WaterHeaterConfig>, IAsyncDisposable
- Inheritance
-
WaterHeater
- Implements
- Inherited Members
Constructors
WaterHeater(HaMqttConnection, WaterHeaterConfig)
Creates a water heater from the given config.
public WaterHeater(HaMqttConnection connection, WaterHeaterConfig config)
Parameters
connectionHaMqttConnectionconfigWaterHeaterConfig
Properties
CurrentTemperatureTopic
The topic this water heater publishes the currently measured temperature to.
public string CurrentTemperatureTopic { get; }
Property Value
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
ModeCommandTopic
The topic this water heater accepts a mode on.
public string ModeCommandTopic { get; }
Property Value
ModeStateTopic
The topic this water heater publishes its mode to.
public string ModeStateTopic { get; }
Property Value
PowerCommandTopic
The topic this water heater accepts an on/off power command on, or null if SupportsPower is false.
public string? PowerCommandTopic { get; }
Property Value
TargetTemperatureCommandTopic
The topic this water heater accepts a target temperature on.
public string TargetTemperatureCommandTopic { get; }
Property Value
TargetTemperatureStateTopic
The topic this water heater publishes its target temperature to.
public string TargetTemperatureStateTopic { get; }
Property Value
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
payloadJsonObject
PublishCurrentTemperatureAsync(double, bool, CancellationToken)
Publishes the currently measured water temperature.
public Task PublishCurrentTemperatureAsync(double temperature, bool retain = true, CancellationToken cancellationToken = default)
Parameters
temperaturedoubleretainboolcancellationTokenCancellationToken
Returns
PublishModeAsync(string, bool, CancellationToken)
Publishes the water heater's current mode.
public Task PublishModeAsync(string mode, bool retain = true, CancellationToken cancellationToken = default)
Parameters
modestringretainboolcancellationTokenCancellationToken
Returns
PublishTargetTemperatureAsync(double, bool, CancellationToken)
Publishes the water heater's current target temperature.
public Task PublishTargetTemperatureAsync(double temperature, bool retain = true, CancellationToken cancellationToken = default)
Parameters
temperaturedoubleretainboolcancellationTokenCancellationToken
Returns
Events
ModeCommandReceived
Raised when Home Assistant sends a new mode (one of Modes).
public event Func<string, Task>? ModeCommandReceived
Event Type
PowerCommandReceived
Raised when Home Assistant sends an on/off power command. Only raised when SupportsPower is true.
public event Func<bool, Task>? PowerCommandReceived
Event Type
TargetTemperatureCommandReceived
Raised when Home Assistant sends a new target temperature.
public event Func<double, Task>? TargetTemperatureCommandReceived