mqtt-discovery-types
Version:
Typescript Types For HomeAssistant MQTT Discovery
39 lines (33 loc) • 1.77 kB
TypeScript
import type { StatefulEntityDiscovery } from "./BaseEntityDiscovery.js";
/**
* @see https://www.home-assistant.io/integrations/binary_sensor.mqtt/#discovery
*/
export interface BinarySensorDiscovery extends StatefulEntityDiscovery {
/**
* If set, it defines the number of seconds after the sensor’s state expires,
* if it’s not updated. After expiry, the sensor’s state becomes unavailable.
* Default the sensors state never expires.
*/
expire_after?: number;
/**
* Sends update events (which results in update of state object’s last_changed) even if the sensor’s
* state hasn’t changed. Useful if you want to have meaningful value graphs in history or want to
* create an automation that triggers on every incoming state message
* (not only when the sensor’s new state is different to the current one).
*/
force_update?: boolean;
/**
* For sensors that only send on state updates (like PIRs), this variable sets a delay in seconds
* after which the sensor’s state will be updated back to off.
*/
off_delay?: number;
/**
* The payload that represents the `off` state. It will be compared to the message in the `state_topic`.
*/
payload_off?: string;
/**
* The payload that represents the `on` state. It will be compared to the message in the `state_topic`.
*/
payload_on?: string;
device_class?: "battery" | "battery_charging" | "carbon_monoxide" | "cold" | "connectivity" | "door" | "garage_door" | "gas" | "heat" | "light" | "lock" | "moisture" | "motion" | "moving" | "occupancy" | "opening" | "plug" | "power" | "presence" | "problem" | "safety" | "smoke" | "sound" | "tamper" | "update" | "vibration" | "window";
}