mqtt-discovery-types
Version:
Typescript Types For HomeAssistant MQTT Discovery
40 lines (28 loc) • 1.11 kB
TypeScript
import type { DeviceOptions } from "./DeviceOptions";
/**
* @see https://www.home-assistant.io/integrations/device_trigger.mqtt/
*/
export interface DeviceTriggerComponentDiscovery {
platform: 'device_automation'
automation_type: "trigger";
/**
* Optional payload to match the payload being sent over the topic.
*/
payload?: string;
/**
* The maximum QoS level used when receiving and publishing messages.
*/
qos?: 0 | 1 | 2;
/**
* The MQTT topic subscribed to receive trigger messages.
*/
topic: string;
/**
* The type of trigger.
*/
type: string | 'button_short_press' | 'button_short_release' | 'button_long_press' | 'button_long_release' | 'button_double_press' | 'button_triple_press' | 'button_quadruple_press' | 'button_quintuple_press';
subtype: string | 'turn_on' | 'turn_off' | 'button_1' | 'button_2' | 'button_3' | 'button_4' | 'button_5' | 'button_6'
device: DeviceOptions;
value_template?: string;
}
export type DeviceTriggerDiscovery = Omit<DeviceTriggerComponentDiscovery, 'platform'>;