UNPKG

mqtt-discovery-types

Version:
152 lines (126 loc) 4.47 kB
import type { OptionallyStatefulCommandComponentDiscovery } from "./BaseEntityDiscovery.ts"; import {MakeEntity} from './utils'; /** * @see https://www.home-assistant.io/integrations/cover.mqtt/ */ export interface CoverComponentDiscovery extends OptionallyStatefulCommandComponentDiscovery { platform: 'cover'; /** * Flag that defines if the cover works in optimistic mode. * If true, the cover will immediately change state after every command. * If false, the cover will only change state after it receives a state feedback from the device. * @default `false` if state_topic or position_topic are set, else `true` * */ optimistic?: boolean; /** * The command payload that closes the cover. * @defaultValue `CLOSED` * */ payload_close?: string; /** * The command payload that opens the cover. * @defaultValue `OPEN` * */ payload_open?: string; /** * The command payload that stops the cover. * @defaultValue `STOP` * */ payload_stop: string; /** * Number which represents the closed position. * @defaultValuee 0 * */ position_closed?: number; /** * Number which represents the open position. * @defaultValue 100 * */ position_open?: number; /** * Defines a template that can be used to extract the payload for the position_topic topic. * Within the template the following variables are available: * `entity_id`, `position_open`, `position_closed` `tilt_min` `tilt_max` * The entity_id can be used to reference the entity’s attributes with help of the states template function; * */ position_template?: string; /** * The MQTT topic subscribed to receive cover position messages. * */ position_topic?: string; /** * The MQTT topic to publish position commands to. * You need to set position_topic as well if you want to use position topic. * Use template if position topic wants different values than within range position_closed - position_open. * If template is not defined and position_closed != 100 and position_open != 0 * then proper position value is calculated from percentage position. * */ set_position_topic: string; /** * The payload that represents the cover is closed. * @defaultValue `closed` * */ state_closed?: string; /** * The payload that represents the cover is closing. * @defaultValue `closing` * */ state_closing?: string; /** * The payload that represents the cover is open. * @defaultValue `open` * */ state_open?: string; /** * The payload that represents the cover is opening. * @defaultValue `opening` * */ state_opening?: string; /** * The payload that represents the cover is stopped. * @defaultValue `stopped` * */ state_stopped?: string; /** * The value that will be sent on a `close_cover_tilt` command. * @defaultValue 0 */ tilt_closed_value?: number; /** * The MQTT topic to publish commands to control the cover tilt. * */ tilt_command_topic?: string; /** * The maximum tilt value. * @defaultValue 100 * */ tilt_max?: number; /** * The minimum tilt value. * @defaultValue 0 * */ tilt_min?: number; /** * The value that will be sent on a `open_cover_tilt` command. * @defaultValue 100 */ tilt_open_value?: number; /** * Flag that defines if the cover tilt works in optimistic mode. * @default `false` if tilt_status_topic is defined, else `true` */ tilt_optimistic?: boolean; /** * Defines a template that can be used to extract the payload for the tilt_status_topic topic. * Within the template the following variables are available: * `entity_id`, `position_open`, `position_closed` `tilt_min` `tilt_max` * The entity_id can be used to reference the entity’s attributes with help of the states template function; * */ tilt_status_template?: string; /** * The MQTT topic subscribed to receive cover tilt status messages. * */ tilt_status_topic?: string; device_class?: 'awning' | 'blind' | 'curtain' | 'damper' | 'door' | 'garage' | 'gate' | 'shade' | 'shutter' | 'window'; } export type CoverDiscovery = MakeEntity<CoverComponentDiscovery>;