UNPKG

mqtt-discovery-types

Version:
46 lines (35 loc) 1.38 kB
import type { OptionallyStatefulCommandComponentDiscovery } from "./BaseEntityDiscovery.ts"; import { MakeEntity } from './utils'; export type SwitchDiscovery = MakeEntity<SwitchComponentDiscovery>; export type SwitchDeviceClass = 'None' | 'outlet' | 'switch'; export interface SwitchComponentDiscovery extends OptionallyStatefulCommandComponentDiscovery { platform: 'switch'; 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; }