Improve MQTT components interfaces

This commit is contained in:
Adrian Jagielak 2025-07-26 20:26:12 +02:00
parent 5d8ce20bff
commit e079b47760
No known key found for this signature in database
GPG Key ID: 0818CF7AF6C62BFB
35 changed files with 7627 additions and 1704 deletions

3
futurehome/.prettierrc Normal file
View File

@ -0,0 +1,3 @@
{
"singleQuote": true
}

View File

@ -1,6 +1,6 @@
# https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config # https://developers.home-assistant.io/docs/add-ons/configuration#add-on-config
name: Futurehome name: Futurehome
version: "0.1.5" version: "0.1.6"
slug: futurehome slug: futurehome
description: Local Futurehome Smarthub integration description: Local Futurehome Smarthub integration
url: "https://github.com/adrianjagielak/home-assistant-futurehome" url: "https://github.com/adrianjagielak/home-assistant-futurehome"

View File

@ -1,33 +1,34 @@
import js from "@eslint/js"; import js from '@eslint/js';
import globals from "globals"; import globals from 'globals';
import tseslint from "typescript-eslint"; import tseslint from 'typescript-eslint';
import { defineConfig } from "eslint/config"; import { defineConfig } from 'eslint/config';
export default defineConfig([ export default defineConfig([
js.configs.recommended, js.configs.recommended,
tseslint.configs.recommended, tseslint.configs.recommended,
{ {
files: ["**/*.{ts,tsx}"], files: ['**/*.{ts,tsx}'],
languageOptions: { languageOptions: {
parser: tseslint.parser, parser: tseslint.parser,
parserOptions: { parserOptions: {
ecmaVersion: "latest", ecmaVersion: 'latest',
sourceType: "module", sourceType: 'module',
}, },
globals: globals.node, globals: globals.node,
}, },
plugins: { plugins: {
"@typescript-eslint": tseslint.plugin, '@typescript-eslint': tseslint.plugin,
}, },
rules: { rules: {
"@typescript-eslint/no-explicit-any": "off", '@typescript-eslint/no-explicit-any': 'off',
"@typescript-eslint/no-unused-vars": [ '@typescript-eslint/no-unused-vars': [
"error", 'error',
{ {
argsIgnorePattern: "^_", argsIgnorePattern: '^_',
varsIgnorePattern: "^_", varsIgnorePattern: '^_',
}, },
], ],
}, },
quotes: ['error', 'single'],
}, },
]); ]);

View File

@ -0,0 +1,70 @@
import { MaterialDesignIcon } from './_material_design_icon';
export interface BaseComponent {
/**
* An ID that uniquely identifies this entity.
* If two entities have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
* When set, the entity category must be `diagnostic` for sensors.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/**
* The name to use when displaying this entity.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT <component>' name.
*/
name?: string | null;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: MaterialDesignIcon;
/**
* Used instead of `name` for automatic generation of `entity_id`
*/
object_id?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: 0 | 1 | 2;
/**
* If the published message should have the retain flag on or not.
* Default: false
*/
retain?: boolean;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents an MQTT Alarm Control Panel component for Home Assistant MQTT Discovery. * Represents an MQTT Alarm Control Panel component for Home Assistant MQTT Discovery.
* *
@ -12,30 +14,13 @@
* For full documentation see: * For full documentation see:
* https://www.home-assistant.io/integrations/alarm_control_panel.mqtt/ * https://www.home-assistant.io/integrations/alarm_control_panel.mqtt/
*/ */
export interface AlarmControlPanelComponent { export interface AlarmControlPanelComponent extends BaseComponent {
/** /**
* Must be `alarm_control_panel`. * Must be `alarm_control_panel`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'alarm_control_panel'; platform: 'alarm_control_panel';
/**
* An ID that uniquely identifies this alarm panel.
* If two alarm panels have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic subscribed to receive state updates. * The MQTT topic subscribed to receive state updates.
* A `None` payload resets to an `unknown` state. * A `None` payload resets to an `unknown` state.
@ -86,30 +71,6 @@ export interface AlarmControlPanelComponent {
*/ */
command_template?: string; command_template?: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.
@ -123,21 +84,6 @@ export interface AlarmControlPanelComponent {
*/ */
json_attributes_topic?: string; json_attributes_topic?: string;
/**
* The name of the alarm.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: "MQTT Alarm"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/** /**
* The payload to set armed-away mode on your Alarm Panel. * The payload to set armed-away mode on your Alarm Panel.
* Default: "ARM_AWAY" * Default: "ARM_AWAY"
@ -192,18 +138,6 @@ export interface AlarmControlPanelComponent {
*/ */
payload_trigger?: string; payload_trigger?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* If the published message should have the retain flag on or not.
* Default: false
*/
retain?: boolean;
/** /**
* A list of features that the alarm control panel supports. * A list of features that the alarm control panel supports.
* The available list options are `arm_home`, `arm_away`, `arm_night`, `arm_vacation`, `arm_custom_bypass`, and `trigger`. * The available list options are `arm_home`, `arm_away`, `arm_night`, `arm_vacation`, `arm_custom_bypass`, and `trigger`.

View File

@ -1,4 +1,5 @@
import { BinarySensorDeviceClass } from "./_enums"; import { BaseComponent } from './_base_component';
import { BinarySensorDeviceClass } from './_enums';
/** /**
* Represents a MQTT Binary Sensor component for Home Assistant MQTT Discovery. * Represents a MQTT Binary Sensor component for Home Assistant MQTT Discovery.
@ -8,31 +9,13 @@ import { BinarySensorDeviceClass } from "./_enums";
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/binary_sensor.mqtt/ * https://www.home-assistant.io/integrations/binary_sensor.mqtt/
*/ */
export interface BinarySensorComponent { export interface BinarySensorComponent extends BaseComponent {
/** /**
* Must be `binary_sensor`. * Must be `binary_sensor`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'binary_sensor'; platform: 'binary_sensor';
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
* When set, the entity category must be `diagnostic` for sensors.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/**
* An ID that uniquely identifies this sensor.
* If two sensors have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/** /**
* The MQTT topic subscribed to receive sensor's state. * The MQTT topic subscribed to receive sensor's state.
* Valid states are `OFF` and `ON`. * Valid states are `OFF` and `ON`.
@ -85,51 +68,6 @@ export interface BinarySensorComponent {
*/ */
expire_after?: number; expire_after?: number;
/**
* The encoding of the payloads received.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The name of the binary sensor.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: "MQTT binary sensor"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Button component for Home Assistant MQTT Discovery. * Represents a MQTT Button component for Home Assistant MQTT Discovery.
* *
@ -7,30 +9,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/button.mqtt/ * https://www.home-assistant.io/integrations/button.mqtt/
*/ */
export interface ButtonComponent { export interface ButtonComponent extends BaseComponent {
/** /**
* Must be `button`. * Must be `button`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'button'; platform: 'button';
/**
* An ID that uniquely identifies this button.
* If two buttons have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic to publish commands to trigger the button. * The MQTT topic to publish commands to trigger the button.
*/ */
@ -54,29 +39,6 @@ export interface ButtonComponent {
*/ */
device_class?: 'identify' | 'restart' | 'update' | null; device_class?: 'identify' | 'restart' | 'update' | null;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the published messages.
* Default: "utf-8"
*/
encoding?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.
@ -90,21 +52,6 @@ export interface ButtonComponent {
*/ */
json_attributes_topic?: string; json_attributes_topic?: string;
/**
* The name to use when displaying this button.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: "MQTT Button"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`
*/
object_id?: string;
/** /**
* The payload that represents the available state. * The payload that represents the available state.
* Default: "online" * Default: "online"
@ -116,16 +63,4 @@ export interface ButtonComponent {
* Default: "offline" * Default: "offline"
*/ */
payload_not_available?: string; payload_not_available?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* If the published message should have the retain flag on or not.
* Default: false
*/
retain?: boolean;
} }

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents an MQTT Camera component for Home Assistant MQTT Discovery. * Represents an MQTT Camera component for Home Assistant MQTT Discovery.
* *
@ -8,60 +10,18 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/camera.mqtt/ * https://www.home-assistant.io/integrations/camera.mqtt/
*/ */
export interface CameraComponent { export interface CameraComponent extends BaseComponent {
/** /**
* Must be `camera`. * Must be `camera`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'camera'; platform: 'camera';
/**
* An ID that uniquely identifies this camera.
* If two cameras have the same unique ID Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic to subscribe to. * The MQTT topic to subscribe to.
*/ */
topic: string; topic: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the payloads received.
* Set to `""` to disable decoding of incoming payload.
* Use `image_encoding` to enable Base64 decoding on `topic`.
* Default: "utf-8"
*/
encoding?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* The encoding of the image payloads received. * The encoding of the image payloads received.
* Set to `"b64"` to enable base64 decoding of image payload. * Set to `"b64"` to enable base64 decoding of image payload.
@ -80,18 +40,4 @@ export interface CameraComponent {
* Implies `force_update` of the current sensor state when a message is received on this topic. * Implies `force_update` of the current sensor state when a message is received on this topic.
*/ */
json_attributes_topic?: string; json_attributes_topic?: string;
/**
* The name of the camera.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
} }

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents an MQTT HVAC (Climate) component for Home Assistant MQTT Discovery. * Represents an MQTT HVAC (Climate) component for Home Assistant MQTT Discovery.
* *
@ -6,30 +8,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/climate.mqtt/ * https://www.home-assistant.io/integrations/climate.mqtt/
*/ */
export interface ClimateComponent { export interface ClimateComponent extends BaseComponent {
/** /**
* Must be `climate`. * Must be `climate`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'climate'; platform: 'climate';
/**
* An ID that uniquely identifies this HVAC.
* If two HVACs have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* A template to render the value received on the `action_topic` with. * A template to render the value received on the `action_topic` with.
*/ */
@ -67,19 +52,6 @@ export interface ClimateComponent {
*/ */
current_temperature_topic?: string; current_temperature_topic?: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true.
*/
enabled_by_default?: boolean;
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/** /**
* A template to render the value sent to the `fan_mode_command_topic` with. * A template to render the value sent to the `fan_mode_command_topic` with.
*/ */
@ -114,17 +86,6 @@ export interface ClimateComponent {
*/ */
initial?: number; initial?: number;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.
@ -190,21 +151,6 @@ export interface ClimateComponent {
*/ */
modes?: string[]; modes?: string[];
/**
* The name of the HVAC.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: "MQTT HVAC"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/** /**
* Flag that defines if the climate works in optimistic mode (not waiting for state update before showing the change in Home Assistant). * Flag that defines if the climate works in optimistic mode (not waiting for state update before showing the change in Home Assistant).
* Default: `true` if no state topic defined, else `false`. * Default: `true` if no state topic defined, else `false`.
@ -289,18 +235,6 @@ export interface ClimateComponent {
*/ */
preset_modes?: string[]; preset_modes?: string[];
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* Defines if published messages should have the retain flag set.
* Default: false
*/
retain?: boolean;
/** /**
* A template to render the value sent to the `swing_horizontal_mode_command_topic` with. * A template to render the value sent to the `swing_horizontal_mode_command_topic` with.
*/ */

View File

@ -1,3 +1,4 @@
import { BaseComponent } from './_base_component';
import { CoverDeviceClass } from './_enums'; import { CoverDeviceClass } from './_enums';
/** /**
@ -8,30 +9,13 @@ import { CoverDeviceClass } from './_enums';
* A cover entity can be in states (`open`, `opening`, `closed`, `closing` or `stopped`). * A cover entity can be in states (`open`, `opening`, `closed`, `closing` or `stopped`).
* See the full documentation at https://www.home-assistant.io/integrations/cover.mqtt/ * See the full documentation at https://www.home-assistant.io/integrations/cover.mqtt/
*/ */
export interface CoverComponent { export interface CoverComponent extends BaseComponent {
/** /**
* Must be `cover`. * Must be `cover`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'cover'; platform: 'cover';
/**
* An ID that uniquely identifies this cover.
* If two covers have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic to publish commands to control the cover. * The MQTT topic to publish commands to control the cover.
*/ */
@ -44,30 +28,6 @@ export interface CoverComponent {
*/ */
device_class?: CoverDeviceClass; device_class?: CoverDeviceClass;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.
@ -81,21 +41,6 @@ export interface CoverComponent {
*/ */
json_attributes_topic?: string; json_attributes_topic?: string;
/**
* The name of the cover.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: "MQTT Cover"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/** /**
* Flag that defines if switch works in optimistic mode (not waiting for state update before showing the change in Home Assistant). * Flag that defines if switch works in optimistic mode (not waiting for state update before showing the change in Home Assistant).
* Default: `false` if `state_topic` or `position_topic` defined, else `true`. * Default: `false` if `state_topic` or `position_topic` defined, else `true`.
@ -160,18 +105,6 @@ export interface CoverComponent {
*/ */
position_topic?: string; position_topic?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* Defines if published messages should have the retain flag set.
* Default: false
*/
retain?: boolean;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-command-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-command-templates-with-mqtt)
* to define the position to be sent to the `set_position_topic` topic. * to define the position to be sent to the `set_position_topic` topic.

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Device Trigger component for Home Assistant MQTT Discovery. * Represents a MQTT Device Trigger component for Home Assistant MQTT Discovery.
* *
@ -12,29 +14,12 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/device_automation.mqtt/ * https://www.home-assistant.io/integrations/device_automation.mqtt/
*/ */
export interface DeviceAutomationComponent { export interface DeviceAutomationComponent extends BaseComponent {
/** /**
* Must be `device_automation`. Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Must be `device_automation`. Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'device_automation'; platform: 'device_automation';
/**
* An ID that uniquely identifies this device trigger.
* If two device triggers have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The type of automation, must be 'trigger'. * The type of automation, must be 'trigger'.
*/ */
@ -45,12 +30,6 @@ export interface DeviceAutomationComponent {
*/ */
payload?: string; payload?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/** /**
* The MQTT topic subscribed to receive trigger events. * The MQTT topic subscribed to receive trigger events.
*/ */

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Device Tracker component for Home Assistant MQTT Discovery. * Represents a MQTT Device Tracker component for Home Assistant MQTT Discovery.
* *
@ -7,30 +9,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/device_tracker.mqtt/ * https://www.home-assistant.io/integrations/device_tracker.mqtt/
*/ */
export interface DeviceTrackerComponent { export interface DeviceTrackerComponent extends BaseComponent {
/** /**
* Must be `device_tracker`. * Must be `device_tracker`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'device_tracker'; platform: 'device_tracker';
/**
* An ID that uniquely identifies this device tracker.
* If two device trackers have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic subscribed to receive device tracker state changes. * The MQTT topic subscribed to receive device tracker state changes.
* The states defined in `state_topic` override the location states defined by the `json_attributes_topic`. * The states defined in `state_topic` override the location states defined by the `json_attributes_topic`.
@ -75,17 +60,6 @@ export interface DeviceTrackerComponent {
*/ */
name?: string; name?: string;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/** /**
* Attribute of a device tracker that affects state when being used to track a [person](https://www.home-assistant.io/integrations/person/). * Attribute of a device tracker that affects state when being used to track a [person](https://www.home-assistant.io/integrations/person/).
* Valid options are `gps`, `router`, `bluetooth`, or `bluetooth_le`. * Valid options are `gps`, `router`, `bluetooth`, or `bluetooth_le`.
@ -121,15 +95,4 @@ export interface DeviceTrackerComponent {
* Default: "offline" * Default: "offline"
*/ */
payload_not_available?: string; payload_not_available?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
} }

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Event component for Home Assistant MQTT Discovery. * Represents a MQTT Event component for Home Assistant MQTT Discovery.
* *
@ -9,30 +11,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/event.mqtt/ * https://www.home-assistant.io/integrations/event.mqtt/
*/ */
export interface EventComponent { export interface EventComponent extends BaseComponent {
/** /**
* Must be `event`. * Must be `event`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'event'; platform: 'event';
/**
* An ID that uniquely identifies this event entity.
* If two events have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic subscribed to receive JSON event payloads. * The MQTT topic subscribed to receive JSON event payloads.
* The JSON payload should contain the `event_type` element. * The JSON payload should contain the `event_type` element.
@ -52,18 +37,6 @@ export interface EventComponent {
*/ */
device_class?: string | null; device_class?: string | null;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the published messages.
* Default: "utf-8"
*/
encoding?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.
@ -83,11 +56,6 @@ export interface EventComponent {
*/ */
name?: string; name?: string;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/** /**
* The payload that represents the available state. * The payload that represents the available state.
* Default: "online" * Default: "online"
@ -100,12 +68,6 @@ export interface EventComponent {
*/ */
payload_not_available?: string; payload_not_available?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the value and render it to a valid JSON event payload. * to extract the value and render it to a valid JSON event payload.

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Fan component for Home Assistant MQTT Discovery. * Represents a MQTT Fan component for Home Assistant MQTT Discovery.
* *
@ -6,30 +8,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/fan.mqtt/ * https://www.home-assistant.io/integrations/fan.mqtt/
*/ */
export interface FanComponent { export interface FanComponent extends BaseComponent {
/** /**
* Must be `fan`. * Must be `fan`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'fan'; platform: 'fan';
/**
* An ID that uniquely identifies this fan.
* If two fans have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic to publish commands to change the fan state. * The MQTT topic to publish commands to change the fan state.
*/ */
@ -150,63 +135,12 @@ export interface FanComponent {
*/ */
preset_modes?: string[]; preset_modes?: string[];
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* The name of the fan.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: "MQTT Fan"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/** /**
* Flag that defines if fan works in optimistic mode (not waiting for state update before showing the change in Home Assistant). * Flag that defines if fan works in optimistic mode (not waiting for state update before showing the change in Home Assistant).
* Default: `true` if no state topic defined, else `false`. * Default: `true` if no state topic defined, else `false`.
*/ */
optimistic?: boolean; optimistic?: boolean;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* If the published message should have the retain flag on or not.
* Default: true
*/
retain?: boolean;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Humidifier component for Home Assistant MQTT Discovery. * Represents a MQTT Humidifier component for Home Assistant MQTT Discovery.
* *
@ -6,30 +8,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/humidifier.mqtt/ * https://www.home-assistant.io/integrations/humidifier.mqtt/
*/ */
export interface HumidifierComponent { export interface HumidifierComponent extends BaseComponent {
/** /**
* Must be `humidifier`. * Must be `humidifier`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'humidifier'; platform: 'humidifier';
/**
* An ID that uniquely identifies this humidifier.
* If two humidifiers have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic to publish commands to change the humidifier state. * The MQTT topic to publish commands to change the humidifier state.
*/ */
@ -188,45 +173,6 @@ export interface HumidifierComponent {
*/ */
payload_not_available?: string; payload_not_available?: string;
/**
* The name of the humidifier.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: `"MQTT humidifier"`
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: `"utf-8"`
*/
encoding?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.
@ -239,16 +185,4 @@ export interface HumidifierComponent {
* Usage example can be found in [MQTT sensor](https://www.home-assistant.io/integrations/sensor.mqtt/#json-attributes-topic-configuration) documentation. * Usage example can be found in [MQTT sensor](https://www.home-assistant.io/integrations/sensor.mqtt/#json-attributes-topic-configuration) documentation.
*/ */
json_attributes_topic?: string; json_attributes_topic?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* If the published message should have the retain flag on or not.
* Default: true
*/
retain?: boolean;
} }

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents an MQTT Image component for Home Assistant MQTT Discovery. * Represents an MQTT Image component for Home Assistant MQTT Discovery.
* *
@ -11,30 +13,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/image.mqtt/ * https://www.home-assistant.io/integrations/image.mqtt/
*/ */
export interface ImageComponent { export interface ImageComponent extends BaseComponent {
/** /**
* Must be `image`. * Must be `image`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'image'; platform: 'image';
/**
* An ID that uniquely identifies this image.
* If two images have the same unique ID Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic to subscribe to receive the image payload of the image to be downloaded. * The MQTT topic to subscribe to receive the image payload of the image to be downloaded.
* Ensure the `content_type` type option is set to the corresponding content type. * Ensure the `content_type` type option is set to the corresponding content type.
@ -72,34 +57,6 @@ export interface ImageComponent {
*/ */
image_encoding?: string; image_encoding?: string;
/**
* The encoding of the payloads received.
* Set to `""` to disable decoding of incoming payload.
* Use `image_encoding` to enable `Base64` decoding on `image_topic`.
* Default: "utf-8"
*/
encoding?: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The name of the image.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/** /**
* The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes. * The MQTT topic subscribed to receive a JSON dictionary payload and then set as sensor attributes.
* Implies `force_update` of the current sensor state when a message is received on this topic. * Implies `force_update` of the current sensor state when a message is received on this topic.
@ -111,15 +68,4 @@ export interface ImageComponent {
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.
*/ */
json_attributes_template?: string; json_attributes_template?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
} }

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Lawn Mower component for Home Assistant MQTT Discovery. * Represents a MQTT Lawn Mower component for Home Assistant MQTT Discovery.
* *
@ -6,30 +8,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/lawn_mower.mqtt/ * https://www.home-assistant.io/integrations/lawn_mower.mqtt/
*/ */
export interface LawnMowerComponent { export interface LawnMowerComponent extends BaseComponent {
/** /**
* Must be `lawn_mower`. * Must be `lawn_mower`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'lawn_mower'; platform: 'lawn_mower';
/**
* An ID that uniquely identifies this lawn mower.
* If two lawn mowers have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic subscribed to receive an update of the activity. * The MQTT topic subscribed to receive an update of the activity.
* Valid activities are `mowing`, `paused`, `docked`, and `error`. * Valid activities are `mowing`, `paused`, `docked`, and `error`.
@ -57,30 +42,6 @@ export interface LawnMowerComponent {
*/ */
dock_command_topic?: string; dock_command_topic?: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of the incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.
@ -93,20 +54,6 @@ export interface LawnMowerComponent {
*/ */
json_attributes_topic?: string; json_attributes_topic?: string;
/**
* The name of the lawn mower.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/** /**
* Flag that defines if the lawn mower works in optimistic mode (not waiting for state update before showing the change in Home Assistant). * Flag that defines if the lawn mower works in optimistic mode (not waiting for state update before showing the change in Home Assistant).
* Default: `true` if no `activity_state_topic` defined, else `false`. * Default: `true` if no `activity_state_topic` defined, else `false`.
@ -127,12 +74,6 @@ export interface LawnMowerComponent {
*/ */
pause_command_topic?: string; pause_command_topic?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-command-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-command-templates-with-mqtt)
* to generate the payload to send to `start_mowing_command_topic`. * to generate the payload to send to `start_mowing_command_topic`.
@ -146,10 +87,4 @@ export interface LawnMowerComponent {
* Use a `start_mowing_command_template` to publish a custom format. * Use a `start_mowing_command_template` to publish a custom format.
*/ */
start_mowing_command_topic?: string; start_mowing_command_topic?: string;
/**
* If the published message should have the retain flag on or not.
* Default: false
*/
retain?: boolean;
} }

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Light component for Home Assistant MQTT Discovery. * Represents a MQTT Light component for Home Assistant MQTT Discovery.
* *
@ -7,30 +9,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/light.mqtt/ * https://www.home-assistant.io/integrations/light.mqtt/
*/ */
export interface LightComponent { export interface LightComponent extends BaseComponent {
/** /**
* Must be `light`. * Must be `light`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'light'; platform: 'light';
/**
* An ID that uniquely identifies this light.
* If two lights have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* Flag that defines if light supports brightness when the `rgb`, `rgbw`, or `rgbww` color mode is supported. * Flag that defines if light supports brightness when the `rgb`, `rgbw`, or `rgbww` color mode is supported.
* Only for JSON schema. * Only for JSON schema.
@ -322,41 +307,6 @@ export interface LightComponent {
*/ */
command_topic: string; command_topic: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* Flag to indicate if the published messages should have the retain flag set.
* Default: false
*/
retain?: boolean;
/**
* The name of the light.
* Can be set to null if only the device name is relevant.
* Default: "MQTT Light" or "MQTT JSON Light" or "MQTT Template Light" depending on schema.
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Lock component for Home Assistant MQTT Discovery. * Represents a MQTT Lock component for Home Assistant MQTT Discovery.
* *
@ -6,30 +8,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/lock.mqtt/ * https://www.home-assistant.io/integrations/lock.mqtt/
*/ */
export interface LockComponent { export interface LockComponent extends BaseComponent {
/** /**
* Must be `lock`. * Must be `lock`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'lock'; platform: 'lock';
/**
* An ID that uniquely identifies this lock.
* If two locks have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic to publish commands to change the lock state. * The MQTT topic to publish commands to change the lock state.
*/ */
@ -57,30 +42,6 @@ export interface LockComponent {
*/ */
command_template?: string; command_template?: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.
@ -94,21 +55,6 @@ export interface LockComponent {
*/ */
json_attributes_topic?: string; json_attributes_topic?: string;
/**
* The name of the lock.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: "MQTT Lock"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/** /**
* Flag that defines if lock works in optimistic mode (not waiting for state update before showing the change in Home Assistant). * Flag that defines if lock works in optimistic mode (not waiting for state update before showing the change in Home Assistant).
* Default: `true` if no `state_topic` defined, else `false`. * Default: `true` if no `state_topic` defined, else `false`.
@ -150,18 +96,6 @@ export interface LockComponent {
*/ */
payload_reset?: string; payload_reset?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* If the published message should have the retain flag on or not.
* Default: false
*/
retain?: boolean;
/** /**
* The payload sent to `state_topic` by the lock when it's jammed. * The payload sent to `state_topic` by the lock when it's jammed.
* Default: "JAMMED" * Default: "JAMMED"

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT manual alarm control panel component for Home Assistant MQTT Discovery. * Represents a MQTT manual alarm control panel component for Home Assistant MQTT Discovery.
* *
@ -11,30 +13,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/manual_mqtt.mqtt/ * https://www.home-assistant.io/integrations/manual_mqtt.mqtt/
*/ */
export interface ManualMqttComponent { export interface ManualMqttComponent extends BaseComponent {
/** /**
* Must be `button`. * Must be `button`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'manual_mqtt'; platform: 'manual_mqtt';
/**
* An ID that uniquely identifies this manual alarm control panel.
* If two manual alarm control panels have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic Home Assistant will publish state updates to. * The MQTT topic Home Assistant will publish state updates to.
* This topic is where Home Assistant will publish the current state of the alarm. * This topic is where Home Assistant will publish the current state of the alarm.
@ -107,12 +92,6 @@ export interface ManualMqttComponent {
*/ */
disarm_after_trigger?: boolean; disarm_after_trigger?: boolean;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/** /**
* The payload to disarm this Alarm Panel. * The payload to disarm this Alarm Panel.
* Default: "DISARM" * Default: "DISARM"

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents an MQTT Notify component for Home Assistant MQTT Discovery. * Represents an MQTT Notify component for Home Assistant MQTT Discovery.
* *
@ -8,30 +10,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/notify.mqtt/ * https://www.home-assistant.io/integrations/notify.mqtt/
*/ */
export interface NotifyComponent { export interface NotifyComponent extends BaseComponent {
/** /**
* Must be `notify`. * Must be `notify`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'notify'; platform: 'notify';
/**
* An ID that uniquely identifies this notify entity.
* If two notify entities have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic to publish send message commands at. * The MQTT topic to publish send message commands at.
*/ */
@ -43,23 +28,6 @@ export interface NotifyComponent {
*/ */
command_template?: string; command_template?: string;
/**
* The encoding of the published messages.
* Default: "utf-8"
*/
encoding?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.
@ -73,39 +41,6 @@ export interface NotifyComponent {
*/ */
json_attributes_topic?: string; json_attributes_topic?: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* If the published message should have the retain flag on or not.
* Default: false
*/
retain?: boolean;
/**
* The name to use when displaying this notify entity.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: "MQTT notify"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/** /**
* The payload that represents the available state. * The payload that represents the available state.
* Default: "online" * Default: "online"

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Number component for Home Assistant MQTT Discovery. * Represents a MQTT Number component for Home Assistant MQTT Discovery.
* *
@ -9,30 +11,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/number.mqtt/ * https://www.home-assistant.io/integrations/number.mqtt/
*/ */
export interface NumberComponent { export interface NumberComponent extends BaseComponent {
/** /**
* Must be `number`. * Must be `number`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'number'; platform: 'number';
/**
* An ID that uniquely identifies this number entity.
* If two number entities have the same unique ID Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic to publish commands to change the number. * The MQTT topic to publish commands to change the number.
*/ */
@ -144,30 +129,6 @@ export interface NumberComponent {
| 'wind_speed' | 'wind_speed'
| null; | null;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.
@ -191,27 +152,4 @@ export interface NumberComponent {
* Default: "None" * Default: "None"
*/ */
payload_reset?: string; payload_reset?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* If the published message should have the retain flag on or not.
* Default: false
*/
retain?: boolean;
/**
* The name of the Number. Can be set to `null` if only the device name is relevant.
* Default: "MQTT Number"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
} }

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Scene component for Home Assistant MQTT Discovery. * Represents a MQTT Scene component for Home Assistant MQTT Discovery.
* *
@ -6,29 +8,12 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/scene.mqtt/ * https://www.home-assistant.io/integrations/scene.mqtt/
*/ */
export interface SceneComponent { export interface SceneComponent extends BaseComponent {
/** /**
* Must be `scene`. Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Must be `scene`. Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'scene'; platform: 'scene';
/**
* An ID that uniquely identifies this scene entity.
* If two scenes have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic to publish `payload_on` to activate the scene. * The MQTT topic to publish `payload_on` to activate the scene.
*/ */
@ -52,23 +37,6 @@ export interface SceneComponent {
*/ */
payload_not_available?: string; payload_not_available?: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the published messages.
* Default: "utf-8"
*/
encoding?: string;
/**
* Icon for the scene.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.
@ -87,21 +55,4 @@ export interface SceneComponent {
* Default: "MQTT Scene" * Default: "MQTT Scene"
*/ */
name?: string; name?: string;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* If the published message should have the retain flag on or not.
* Default: false
*/
retain?: boolean;
} }

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Select component for Home Assistant MQTT Discovery. * Represents a MQTT Select component for Home Assistant MQTT Discovery.
* *
@ -9,30 +11,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/select.mqtt/ * https://www.home-assistant.io/integrations/select.mqtt/
*/ */
export interface SelectComponent { export interface SelectComponent extends BaseComponent {
/** /**
* Must be `select`. * Must be `select`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'select'; platform: 'select';
/**
* An ID that uniquely identifies this select.
* If two selects have the same unique ID Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic subscribed to receive update of the selected option. * The MQTT topic subscribed to receive update of the selected option.
* A "None" payload resets to an `unknown` state. An empty payload is ignored. * A "None" payload resets to an `unknown` state. An empty payload is ignored.
@ -67,42 +52,6 @@ export interface SelectComponent {
*/ */
command_template?: string; command_template?: string;
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* If the published message should have the retain flag on or not.
* Default: false
*/
retain?: boolean;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.
@ -114,14 +63,4 @@ export interface SelectComponent {
* Implies `force_update` of the current select state when a message is received on this topic. * Implies `force_update` of the current select state when a message is received on this topic.
*/ */
json_attributes_topic?: string; json_attributes_topic?: string;
/**
* The name of the Select. Can be set to `null` if only the device name is relevant.
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
} }

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents an MQTT Sensor component for Home Assistant MQTT Discovery. * Represents an MQTT Sensor component for Home Assistant MQTT Discovery.
* *
@ -9,31 +11,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/sensor.mqtt/ * https://www.home-assistant.io/integrations/sensor.mqtt/
*/ */
export interface SensorComponent { export interface SensorComponent extends BaseComponent {
/** /**
* Must be `sensor`. * Must be `sensor`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'sensor'; platform: 'sensor';
/**
* An ID that uniquely identifies this sensor.
* If two sensors have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
* When set, the entity category must be `diagnostic` for sensors.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic subscribed to receive sensor values. * The MQTT topic subscribed to receive sensor values.
* If `device_class`, `state_class`, `unit_of_measurement` or `suggested_display_precision` is set, * If `device_class`, `state_class`, `unit_of_measurement` or `suggested_display_precision` is set,
@ -141,51 +125,6 @@ export interface SensorComponent {
*/ */
value_template?: string; value_template?: string;
/**
* The name of the MQTT sensor.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: "MQTT Sensor"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the payloads received.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) to extract the JSON dictionary from messages received on the `json_attributes_topic`. * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) to extract the JSON dictionary from messages received on the `json_attributes_topic`.
*/ */

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Siren component for Home Assistant MQTT Discovery. * Represents a MQTT Siren component for Home Assistant MQTT Discovery.
* *
@ -6,29 +8,12 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/siren.mqtt/ * https://www.home-assistant.io/integrations/siren.mqtt/
*/ */
export interface SirenComponent { export interface SirenComponent extends BaseComponent {
/** /**
* Must be `siren`. Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Must be `siren`. Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'siren'; platform: 'siren';
/**
* An ID that uniquely identifies this siren.
* If two sirens have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* List of available tones the siren supports. When configured, this enables the support for setting a `tone` and enables the `tone` state attribute. * List of available tones the siren supports. When configured, this enables the support for setting a `tone` and enables the `tone` state attribute.
*/ */
@ -49,29 +34,6 @@ export interface SirenComponent {
*/ */
command_topic?: string; command_topic?: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the payloads received and published messages. Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) to extract the JSON dictionary from messages received on the `json_attributes_topic`. Usage example can be found in [MQTT sensor](https://www.home-assistant.io/integrations/sensor.mqtt/#json-attributes-template-configuration) documentation. * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) to extract the JSON dictionary from messages received on the `json_attributes_topic`. Usage example can be found in [MQTT sensor](https://www.home-assistant.io/integrations/sensor.mqtt/#json-attributes-template-configuration) documentation.
*/ */
@ -82,17 +44,6 @@ export interface SirenComponent {
*/ */
json_attributes_topic?: string; json_attributes_topic?: string;
/**
* The name to use when displaying this siren. Can be set to `null` if only the device name is relevant.
* Default: "MQTT Siren"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/** /**
* Flag that defines if siren works in optimistic mode (not waiting for state update before showing the change in Home Assistant). * Flag that defines if siren works in optimistic mode (not waiting for state update before showing the change in Home Assistant).
* Default: `true` if no `state_topic` defined, else `false`. * Default: `true` if no `state_topic` defined, else `false`.
@ -123,18 +74,6 @@ export interface SirenComponent {
*/ */
payload_on?: string; payload_on?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* If the published message should have the retain flag on or not.
* Default: false
*/
retain?: boolean;
/** /**
* The payload that represents the `off` state. Used when value that represents `off` state in the `state_topic` is different from value that should be sent to the `command_topic` to turn the device `off`. * The payload that represents the `off` state. Used when value that represents `off` state in the `state_topic` is different from value that should be sent to the `command_topic` to turn the device `off`.
* Default: "`payload_off` if defined, else `'OFF'`" * Default: "`payload_off` if defined, else `'OFF'`"

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Switch component for Home Assistant MQTT Discovery. * Represents a MQTT Switch component for Home Assistant MQTT Discovery.
* *
@ -6,30 +8,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/switch.mqtt/ * https://www.home-assistant.io/integrations/switch.mqtt/
*/ */
export interface SwitchComponent { export interface SwitchComponent extends BaseComponent {
/** /**
* Must be `switch`. * Must be `switch`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'switch'; platform: 'switch';
/**
* An ID that uniquely identifies this switch.
* If two switches have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic to publish commands to change the switch state. * The MQTT topic to publish commands to change the switch state.
*/ */
@ -49,30 +34,6 @@ export interface SwitchComponent {
*/ */
device_class?: 'outlet' | 'switch' | null; device_class?: 'outlet' | 'switch' | null;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) to extract the JSON dictionary from messages received on the `json_attributes_topic`. * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) to extract the JSON dictionary from messages received on the `json_attributes_topic`.
* Usage example can be found in [MQTT sensor](https://www.home-assistant.io/integrations/sensor.mqtt/#json-attributes-template-configuration) documentation. * Usage example can be found in [MQTT sensor](https://www.home-assistant.io/integrations/sensor.mqtt/#json-attributes-template-configuration) documentation.
@ -85,21 +46,6 @@ export interface SwitchComponent {
*/ */
json_attributes_topic?: string; json_attributes_topic?: string;
/**
* The name to use when displaying this switch.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: "MQTT Switch"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/** /**
* Flag that defines if switch works in optimistic mode (not waiting for state update before showing the change in Home Assistant). * Flag that defines if switch works in optimistic mode (not waiting for state update before showing the change in Home Assistant).
* Default: `true` if no `state_topic` defined, else `false`. * Default: `true` if no `state_topic` defined, else `false`.
@ -134,18 +80,6 @@ export interface SwitchComponent {
*/ */
payload_on?: string; payload_on?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* If the published message should have the retain flag on or not.
* Default: false
*/
retain?: boolean;
/** /**
* The payload that represents the `off` state. * The payload that represents the `off` state.
* Used when value that represents `off` state in the `state_topic` is different from value that should be sent to the `command_topic` to turn the device `off`. * Used when value that represents `off` state in the `state_topic` is different from value that should be sent to the `command_topic` to turn the device `off`.

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Tag Scanner component for Home Assistant MQTT Discovery. * Represents a MQTT Tag Scanner component for Home Assistant MQTT Discovery.
* *
@ -6,30 +8,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/tag.mqtt/ * https://www.home-assistant.io/integrations/tag.mqtt/
*/ */
export interface TagComponent { export interface TagComponent extends BaseComponent {
/** /**
* Must be `tag`. * Must be `tag`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'tag'; platform: 'tag';
/**
* An ID that uniquely identifies this tag.
* If two tags have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic subscribed to receive tag scanned events. * The MQTT topic subscribed to receive tag scanned events.
*/ */

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Text component for Home Assistant MQTT Discovery. * Represents a MQTT Text component for Home Assistant MQTT Discovery.
* *
@ -7,30 +9,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/text.mqtt/ * https://www.home-assistant.io/integrations/text.mqtt/
*/ */
export interface TextComponent { export interface TextComponent extends BaseComponent {
/** /**
* Must be `text`. * Must be `text`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'text'; platform: 'text';
/**
* An ID that uniquely identifies this text entity.
* If two text entities have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic to publish the text value that is set. * The MQTT topic to publish the text value that is set.
*/ */
@ -55,21 +40,6 @@ export interface TextComponent {
*/ */
value_template?: string; value_template?: string;
/**
* The name of the text entity.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: "MQTT Text"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/** /**
* The maximum size of a text being set or received (maximum is 255). * The maximum size of a text being set or received (maximum is 255).
* Default: 255 * Default: 255
@ -94,19 +64,6 @@ export interface TextComponent {
*/ */
pattern?: string; pattern?: string;
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt)
* to extract the JSON dictionary from messages received on the `json_attributes_topic`. * to extract the JSON dictionary from messages received on the `json_attributes_topic`.
@ -130,16 +87,4 @@ export interface TextComponent {
* Default: "offline" * Default: "offline"
*/ */
payload_not_available?: string; payload_not_available?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* If the published message should have the retain flag on or not.
* Default: false
*/
retain?: boolean;
} }

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents an MQTT Update component for Home Assistant MQTT Discovery. * Represents an MQTT Update component for Home Assistant MQTT Discovery.
* *
@ -7,29 +9,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/update.mqtt/ * https://www.home-assistant.io/integrations/update.mqtt/
*/ */
export interface UpdateComponent { export interface UpdateComponent extends BaseComponent {
/** /**
* Must be `update`. * Must be `update`.
* Required and only allowed in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Required and only allowed in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'update'; platform: 'update';
/**
* An ID that uniquely identifies this update entity.
* If two update entities have the same unique ID, Home Assistant will raise an exception.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic subscribed to receive state updates. * The MQTT topic subscribed to receive state updates.
* The payload may be JSON or a simple string with `installed_version` value. * The payload may be JSON or a simple string with `installed_version` value.
@ -77,30 +63,6 @@ export interface UpdateComponent {
*/ */
display_precision?: number; display_precision?: number;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) to extract the JSON dictionary from messages received on the `json_attributes_topic`. * Defines a [template](https://www.home-assistant.io/docs/configuration/templating/#using-value-templates-with-mqtt) to extract the JSON dictionary from messages received on the `json_attributes_topic`.
*/ */
@ -112,16 +74,6 @@ export interface UpdateComponent {
*/ */
json_attributes_topic?: string; json_attributes_topic?: string;
/**
* The name of the Update. Can be set to `null` if only the device name is relevant.
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/** /**
* A summary of the release notes or changelog. * A summary of the release notes or changelog.
* Suitable for a brief update description (max 255 characters). * Suitable for a brief update description (max 255 characters).
@ -133,24 +85,12 @@ export interface UpdateComponent {
*/ */
release_url?: string; release_url?: string;
/**
* Flag if the published message should have the retain flag on or not.
* Default: false
*/
retain?: boolean;
/** /**
* Title of the software or firmware update. * Title of the software or firmware update.
* Helps differentiate between device/entity name and the update software title. * Helps differentiate between device/entity name and the update software title.
*/ */
title?: string; title?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/** /**
* The string that represents the `online` state. * The string that represents the `online` state.
* Default: "online" * Default: "online"

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Vacuum component for Home Assistant MQTT Discovery. * Represents a MQTT Vacuum component for Home Assistant MQTT Discovery.
* *
@ -7,42 +9,18 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/vacuum.mqtt/ * https://www.home-assistant.io/integrations/vacuum.mqtt/
*/ */
export interface VacuumComponent { export interface VacuumComponent extends BaseComponent {
/** /**
* Must be `vacuum`. * Must be `vacuum`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'vacuum'; platform: 'vacuum';
/**
* An ID that uniquely identifies this vacuum.
* If two vacuums have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic to publish commands to control the vacuum. * The MQTT topic to publish commands to control the vacuum.
*/ */
command_topic?: string; command_topic?: string;
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/** /**
* List of possible fan speeds for the vacuum. * List of possible fan speeds for the vacuum.
*/ */
@ -61,21 +39,6 @@ export interface VacuumComponent {
*/ */
json_attributes_topic?: string; json_attributes_topic?: string;
/**
* The name of the vacuum.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: "MQTT Vacuum"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/** /**
* The payload that represents the available state. * The payload that represents the available state.
* Default: "online" * Default: "online"
@ -124,18 +87,6 @@ export interface VacuumComponent {
*/ */
payload_stop?: string; payload_stop?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* If the published message should have the retain flag on or not.
* Default: false
*/
retain?: boolean;
/** /**
* The MQTT topic to publish custom commands to the vacuum. * The MQTT topic to publish custom commands to the vacuum.
*/ */

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Valve component for Home Assistant MQTT Discovery. * Represents a MQTT Valve component for Home Assistant MQTT Discovery.
* *
@ -8,30 +10,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/valve.mqtt/ * https://www.home-assistant.io/integrations/valve.mqtt/
*/ */
export interface ValveComponent { export interface ValveComponent extends BaseComponent {
/** /**
* Must be `valve`. * Must be `valve`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'valve'; platform: 'valve';
/**
* An ID that uniquely identifies this valve.
* If two valves have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/** /**
* The MQTT topic to publish commands to control the valve. * The MQTT topic to publish commands to control the valve.
* The value sent can be a value defined by `payload_open`, `payload_close`, or `payload_stop`. * The value sent can be a value defined by `payload_open`, `payload_close`, or `payload_stop`.
@ -167,57 +152,6 @@ export interface ValveComponent {
*/ */
payload_not_available?: string; payload_not_available?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* Defines if published messages should have the retain flag set.
* Default: false
*/
retain?: boolean;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/**
* The name of the valve.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: "MQTT valve"
*/
name?: string | null;
/**
* Used instead of `name` to have the `entity_id` generated automatically.
*/
object_id?: string;
/** /**
* Sets the [class of the device](https://www.home-assistant.io/integrations/valve/#device_class), * Sets the [class of the device](https://www.home-assistant.io/integrations/valve/#device_class),
* changing the device state and icon that is displayed on the frontend. * changing the device state and icon that is displayed on the frontend.

View File

@ -1,3 +1,5 @@
import { BaseComponent } from './_base_component';
/** /**
* Represents a MQTT Water Heater component for Home Assistant MQTT Discovery. * Represents a MQTT Water Heater component for Home Assistant MQTT Discovery.
* *
@ -6,69 +8,13 @@
* For detailed documentation see: * For detailed documentation see:
* https://www.home-assistant.io/integrations/water_heater.mqtt/ * https://www.home-assistant.io/integrations/water_heater.mqtt/
*/ */
export interface WaterHeaterComponent { export interface WaterHeaterComponent extends BaseComponent {
/** /**
* Must be `water_heater`. * Must be `water_heater`.
* Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload). * Only allowed and required in [MQTT auto discovery device messages](https://www.home-assistant.io/integrations/mqtt/#device-discovery-payload).
*/ */
platform: 'water_heater'; platform: 'water_heater';
/**
* An ID that uniquely identifies this water heater.
* If two water heaters have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery.
*/
unique_id: string;
/**
* The [category](https://developers.home-assistant.io/docs/core/entity#generic-properties) of the entity.
*/
entity_category?: string;
/**
* Picture URL for the entity.
*/
entity_picture?: string;
/**
* The name of the water heater.
*
* It is recommended to set the name when entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity, to avoid showing the default 'MQTT' name.
*
* Default: "MQTT water heater"
*/
name?: string | null;
/**
* Used instead of `name` for automatic generation of `entity_id`.
*/
object_id?: string;
/**
* Flag which defines if the entity should be enabled when first added.
* Default: true
*/
enabled_by_default?: boolean;
/**
* The encoding of the payloads received and published messages.
* Set to `""` to disable decoding of incoming payload.
* Default: "utf-8"
*/
encoding?: string;
/**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*
* The icon must be a Material Design Icons (MDI) string identifier, for example: `mdi:thermometer`, `mdi:battery`, or `mdi:water`.
*
* It is recommended to set the icon when the default icon or other entity identifiers (such as `device_class` or `state_class`)
* do not accurately represent the purpose of the entity. In most cases, relying on the automatic icon selection ensures better consistency
* and compatibility with future updates.
*/
icon?: string;
/** /**
* The payload that represents the available state. * The payload that represents the available state.
* Default: "online" * Default: "online"
@ -224,18 +170,6 @@ export interface WaterHeaterComponent {
*/ */
json_attributes_topic?: string; json_attributes_topic?: string;
/**
* The maximum QoS level to be used when receiving and publishing messages.
* Default: 0
*/
qos?: number;
/**
* Defines if published messages should have the retain flag set.
* Default: false
*/
retain?: boolean;
/** /**
* Default template to render the payloads on *all* `*_state_topic`s with. * Default template to render the payloads on *all* `*_state_topic`s with.
*/ */

View File

@ -13,6 +13,7 @@ import {
CommandHandlers, CommandHandlers,
ServiceComponentsCreationResult, ServiceComponentsCreationResult,
} from '../ha/publish_device'; } from '../ha/publish_device';
import { MaterialDesignIcon } from '../ha/mqtt_components/_material_design_icon';
export function media_player__components( export function media_player__components(
topicPrefix: string, topicPrefix: string,
@ -203,8 +204,8 @@ export function media_player__components(
/** /**
* Get appropriate icon for playback mode * Get appropriate icon for playback mode
*/ */
function getPlaybackModeIcon(mode: string): string { function getPlaybackModeIcon(mode: string): MaterialDesignIcon {
const iconMap: Record<string, string> = { const iconMap: Record<string, MaterialDesignIcon> = {
repeat: 'mdi:repeat', repeat: 'mdi:repeat',
repeat_one: 'mdi:repeat-once', repeat_one: 'mdi:repeat-once',
shuffle: 'mdi:shuffle', shuffle: 'mdi:shuffle',
@ -216,8 +217,8 @@ function getPlaybackModeIcon(mode: string): string {
/** /**
* Get appropriate icon for metadata type * Get appropriate icon for metadata type
*/ */
function getMetadataIcon(metadata: string): string { function getMetadataIcon(metadata: string): MaterialDesignIcon {
const iconMap: Record<string, string> = { const iconMap: Record<string, MaterialDesignIcon> = {
album: 'mdi:album', album: 'mdi:album',
track: 'mdi:music-note', track: 'mdi:music-note',
artist: 'mdi:account-music', artist: 'mdi:account-music',