Class Image
- Namespace
- HaMqttDiscoverable.Entities
- Assembly
- HaMqttDiscoverable.dll
A still image published for Home Assistant to display, e.g. a camera snapshot or a generated chart. Images are always published base64-encoded, so this works over the same string-based MQTT publish path as every other entity in this library.
public sealed class Image : HaEntity<ImageConfig>, IAsyncDisposable
- Inheritance
-
Image
- Implements
- Inherited Members
Constructors
Image(HaMqttConnection, ImageConfig)
Creates an image entity from the given config.
public Image(HaMqttConnection connection, ImageConfig config)
Parameters
connectionHaMqttConnectionconfigImageConfig
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
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
PublishImageAsync(byte[], bool, CancellationToken)
Publishes new image bytes (e.g. the contents of a .jpg/.png file).
public Task PublishImageAsync(byte[] imageBytes, bool retain = true, CancellationToken cancellationToken = default)
Parameters
imageBytesbyte[]retainboolcancellationTokenCancellationToken