Class Camera
- Namespace
- HaMqttDiscoverable.Entities
- Assembly
- HaMqttDiscoverable.dll
A live-updating image feed - publish a new frame whenever one is available and Home Assistant's camera card shows the latest one. Frames 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 Camera : HaEntity<CameraConfig>, IAsyncDisposable
- Inheritance
-
Camera
- Implements
- Inherited Members
Constructors
Camera(HaMqttConnection, CameraConfig)
Creates a camera from the given config.
public Camera(HaMqttConnection connection, CameraConfig config)
Parameters
connectionHaMqttConnectionconfigCameraConfig
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
PublishFrameAsync(byte[], CancellationToken)
Publishes a new frame (e.g. the contents of a .jpg snapshot).
public Task PublishFrameAsync(byte[] imageBytes, CancellationToken cancellationToken = default)
Parameters
imageBytesbyte[]cancellationTokenCancellationToken