mqtt-discovery-types
Version:
Typescript Types For HomeAssistant MQTT Discovery
46 lines (39 loc) • 1.61 kB
TypeScript
import type { BaseEntityDiscovery } from './BaseEntityDiscovery.ts';
/**
* @see https://www.home-assistant.io/integrations/image.mqtt/
*/
export type ImageDiscovery = UrlImageDiscovery | TopicImageDiscovery;
export interface UrlImageDiscovery extends BaseEntityDiscovery {
/**
* Defines a template to extract the image URL from a message received at url_topic.
*/
url_template?: string;
/**
* The MQTT topic to subscribe to receive an image URL.
* A url_template option can extract the URL from the message.
* The content_type will be derived from the image when downloaded.
* This option cannot be used together with the image_topic option, but at least one of these options is required.
*/
url_topic?: string;
}
export interface TopicImageDiscovery extends BaseEntityDiscovery {
/**
* The content type of and image data message received on image_topic.
* This option cannot be used with the url_topic because the content type is derived when downloading the image.
* @defaultValue image/jpeg
*/
content_type?: string;
/**
* The encoding of the image payloads received.
* Set to "b64" to enable base64 decoding of image payload.
* If not set, the image payload must be raw binary data.
* @defaultValue None
*/
image_encoding?: 'b64';
/**
* The MQTT topic to subscribe to receive the image payload of the image to be downloaded.
* Ensure the content_type type option is set to the corresponding content type.
* This option cannot be used together with the url_topic option. But at least one of these option is required.
*/
image_topic?: string;
}