mqtt-discovery-types
Version:
Typescript Types For HomeAssistant MQTT Discovery
41 lines (32 loc) • 1.23 kB
TypeScript
import type { OptionallyStatefulCommandEntityDiscovery } from "./BaseEntityDiscovery.ts";
export type SwitchDeviceClass = 'None' | 'outlet' | 'switch';
export interface SwitchDiscovery extends OptionallyStatefulCommandEntityDiscovery {
device_class?: SwitchDeviceClass;
/**
* Flag that defines if the switch works in optimistic mode.
* @defaultValue false if `state_topic` defined, otherwise true.
*/
optimistic?: boolean;
/**
* Payload that represents the state off.
* @defaultValue 'OFF'
*/
payload_off?: string;
/**
* Payload that represents the state on.
* @defaultValue 'ON'
*/
payload_on?: string;
/**
* Payload that represents the state off.
* Used when value that represents the state off is different from the value that should be sent to `command_topic`.
* @defaultValue `payload_off` if defined, otherwise 'OFF'.
*/
state_off?: string;
/**
* Payload that represents the state on.
* Used when value that represents the state on is different from the value that should be sent to `command_topic`.
* @defaultValue `payload_on` if defined, otherwise 'ON'.
*/
state_on?: string;
}