Set battery entity categories to 'diagnostic' to hide them from the main view

This commit is contained in:
Adrian Jagielak 2025-07-24 20:57:05 +02:00
parent 7fb4a35a41
commit 8dfd40a5d7
No known key found for this signature in database
GPG Key ID: 0818CF7AF6C62BFB
33 changed files with 328 additions and 418 deletions

View File

@ -1,6 +1,11 @@
<!-- https://developers.home-assistant.io/docs/add-ons/presentation#keeping-a-changelog --> <!-- https://developers.home-assistant.io/docs/add-ons/presentation#keeping-a-changelog -->
## 0.1.1 (24.07.2025)
- Set 'battery' entity category to 'diagnostic' to hide it from the main HA view.
- Do not expose 'battery' entity twice if it supports both level and low/high binary state.
## 0.1.0 (24.07.2025) ## 0.1.0 (24.07.2025)
**Initial stable release** **Initial stable release**

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.0" version: "0.1.1"
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

@ -0,0 +1 @@
export type EntityCategory = undefined | 'config' | 'diagnostic';

View File

@ -26,6 +26,16 @@ export interface AlarmControlPanelComponent {
*/ */
unique_id: string; 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.
@ -89,16 +99,6 @@ export interface AlarmControlPanelComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -13,6 +13,17 @@ export interface BinarySensorComponent {
*/ */
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. * An ID that uniquely identifies this sensor.
* If two sensors have the same unique ID, Home Assistant will raise an exception. * If two sensors have the same unique ID, Home Assistant will raise an exception.
@ -103,17 +114,6 @@ export interface BinarySensorComponent {
*/ */
qos?: number; qos?: number;
/**
* 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -21,6 +21,16 @@ export interface ButtonComponent {
*/ */
unique_id: string; 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.
*/ */
@ -56,16 +66,6 @@ export interface ButtonComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -22,6 +22,16 @@ export interface CameraComponent {
*/ */
unique_id: string; 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.
*/ */
@ -41,16 +51,6 @@ export interface CameraComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -20,6 +20,16 @@ export interface ClimateComponent {
*/ */
unique_id: string; 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.
*/ */
@ -57,79 +67,6 @@ export interface ClimateComponent {
*/ */
current_temperature_topic?: string; current_temperature_topic?: string;
/**
* Information about the device this HVAC device is a part of to tie it into the [device registry](https://developers.home-assistant.io/docs/en/device_registry_index.html).
* Only works when [`unique_id`](#unique_id) is set.
* At least one of identifiers or connections must be present to identify the device.
*/
device?: {
/**
* A link to the webpage that can manage the configuration of this device.
* Can be either an `http://`, `https://` or an internal `homeassistant://` URL.
*/
configuration_url?: string;
/**
* A list of connections of the device to the outside world as a list of tuples `[connection_type, connection_identifier]`.
* For example the MAC address of a network interface:
* `"connections": [["mac", "02:5b:26:a8:dc:12"]]`.
*/
connections?: Array<[string, string]>;
/**
* The hardware version of the device.
*/
hw_version?: string;
/**
* A list of IDs that uniquely identify the device.
* For example a serial number.
*/
identifiers?: string[];
/**
* The manufacturer of the device.
*/
manufacturer?: string;
/**
* The model of the device.
*/
model?: string;
/**
* The model identifier of the device.
*/
model_id?: string;
/**
* The name of the device.
*/
name?: string;
/**
* The serial number of the device.
*/
serial_number?: string;
/**
* Suggest an area if the device isnt in one yet.
*/
suggested_area?: string;
/**
* The firmware version of the device.
*/
sw_version?: string;
/**
* Identifier of a device that routes messages between this device and Home Assistant.
* Examples of such devices are hubs, or parent devices of a sub-device.
* This is used to show device topology in Home Assistant.
*/
via_device?: string;
};
/** /**
* Flag which defines if the entity should be enabled when first added. * Flag which defines if the entity should be enabled when first added.
* Default: true. * Default: true.
@ -143,16 +80,6 @@ export interface ClimateComponent {
*/ */
encoding?: string; encoding?: 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 sent to the `fan_mode_command_topic` with. * A template to render the value sent to the `fan_mode_command_topic` with.
*/ */

View File

@ -20,6 +20,16 @@ export interface CoverComponent {
*/ */
unique_id: string; 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.
*/ */
@ -45,16 +55,6 @@ export interface CoverComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -25,6 +25,16 @@ export interface DeviceAutomationComponent {
*/ */
unique_id: string; 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'.
*/ */

View File

@ -21,6 +21,16 @@ export interface DeviceTrackerComponent {
*/ */
unique_id: string; 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`.

View File

@ -23,6 +23,16 @@ export interface EventComponent {
*/ */
unique_id: string; 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.
@ -54,16 +64,6 @@ export interface EventComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* 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

@ -18,7 +18,17 @@ export interface FanComponent {
* If two fans have the same unique ID, Home Assistant will raise an exception. * If two fans have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -183,16 +193,6 @@ export interface FanComponent {
*/ */
retain?: boolean; retain?: boolean;
/**
* 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -18,7 +18,17 @@ export interface HumidifierComponent {
* If two humidifiers have the same unique ID, Home Assistant will raise an exception. * If two humidifiers have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -203,16 +213,6 @@ export interface HumidifierComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -23,7 +23,17 @@ export interface ImageComponent {
* If two images have the same unique ID Home Assistant will raise an exception. * If two images have the same unique ID Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -99,91 +109,8 @@ export interface ImageComponent {
*/ */
json_attributes_template?: string; json_attributes_template?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */
icon?: string; icon?: string;
/**
* Information about the device this image is a part of to tie it into the [device registry](https://developers.home-assistant.io/docs/en/device_registry_index.html).
* Only works through [MQTT discovery](https://www.home-assistant.io/integrations/mqtt/#mqtt-discovery) and when [`unique_id`](#unique_id) is set.
* At least one of identifiers or connections must be present to identify the device.
*/
device?: {
/**
* A link to the webpage that can manage the configuration of this device.
* Can be either an `http://`, `https://` or an internal `homeassistant://` URL.
*/
configuration_url?: string;
/**
* A list of connections of the device to the outside world as a list of tuples `[connection_type, connection_identifier]`.
* For example the MAC address of a network interface:
* `"connections": [["mac", "02:5b:26:a8:dc:12"]]`.
*/
connections?: Array<[string, string]>;
/**
* The hardware version of the device.
*/
hw_version?: string;
/**
* A list of IDs that uniquely identify the device.
* For example a serial number.
*/
identifiers?: string[];
/**
* The manufacturer of the device.
*/
manufacturer?: string;
/**
* The model of the device.
*/
model?: string;
/**
* The model identifier of the device.
*/
model_id?: string;
/**
* The name of the device.
*/
name?: string;
/**
* The serial number of the device.
*/
serial_number?: string;
/**
* Suggest an area if the device isnt in one yet.
*/
suggested_area?: string;
/**
* The firmware version of the device.
*/
sw_version?: string;
/**
* Identifier of a device that routes messages between this device and Home Assistant.
* Examples of such devices are hubs, or parent devices of a sub-device.
* This is used to show device topology in Home Assistant.
*/
via_device?: string;
};
} }

View File

@ -18,7 +18,17 @@ export interface LawnMowerComponent {
* If two lawn mowers have the same unique ID, Home Assistant will raise an exception. * If two lawn mowers have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -60,16 +70,6 @@ export interface LawnMowerComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -19,7 +19,17 @@ export interface LightComponent {
* If two lights have the same unique ID, Home Assistant will raise an exception. * If two lights have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -336,16 +346,6 @@ export interface LightComponent {
*/ */
object_id?: string; object_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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -18,7 +18,17 @@ export interface LockComponent {
* If two locks have the same unique ID, Home Assistant will raise an exception. * If two locks have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -60,16 +70,6 @@ export interface LockComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -23,7 +23,17 @@ export interface ManualMqttComponent {
* If two manual alarm control panels have the same unique ID, Home Assistant will raise an exception. * If two manual alarm control panels have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.

View File

@ -20,7 +20,17 @@ export interface NotifyComponent {
* If two notify entities have the same unique ID, Home Assistant will raise an exception. * If two notify entities have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -39,16 +49,6 @@ export interface NotifyComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -21,7 +21,17 @@ export interface NumberComponent {
* If two number entities have the same unique ID Home Assistant will raise an exception. * If two number entities have the same unique ID Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -92,16 +102,6 @@ export interface NumberComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -17,7 +17,17 @@ export interface SceneComponent {
* If two scenes have the same unique ID, Home Assistant will raise an exception. * If two scenes have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -48,16 +58,6 @@ export interface SceneComponent {
*/ */
enabled_by_default?: boolean; enabled_by_default?: boolean;
/**
* 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 encoding of the published messages. * The encoding of the published messages.
* Default: "utf-8" * Default: "utf-8"

View File

@ -21,7 +21,17 @@ export interface SelectComponent {
* If two selects have the same unique ID Home Assistant will raise an exception. * If two selects have the same unique ID Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -82,16 +92,6 @@ export interface SelectComponent {
*/ */
enabled_by_default?: boolean; enabled_by_default?: boolean;
/**
* 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -21,7 +21,18 @@ export interface SensorComponent {
* If two sensors have the same unique ID, Home Assistant will raise an exception. * If two sensors have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -94,17 +105,6 @@ export interface SensorComponent {
*/ */
qos?: number; qos?: number;
/**
* 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -17,7 +17,17 @@ export interface SirenComponent {
* If two sirens have the same unique ID, Home Assistant will raise an exception. * If two sirens have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -51,16 +61,6 @@ export interface SirenComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -18,7 +18,17 @@ export interface SwitchComponent {
* If two switches have the same unique ID, Home Assistant will raise an exception. * If two switches have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -51,16 +61,6 @@ export interface SwitchComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -18,7 +18,17 @@ export interface TagComponent {
* If two tags have the same unique ID, Home Assistant will raise an exception. * If two tags have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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

@ -19,7 +19,17 @@ export interface TextComponent {
* If two text entities have the same unique ID, Home Assistant will raise an exception. * If two text entities have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -94,16 +104,6 @@ export interface TextComponent {
*/ */
enabled_by_default?: boolean; enabled_by_default?: boolean;
/**
* 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;
/** /**
* 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

@ -18,7 +18,17 @@ export interface UpdateComponent {
* An ID that uniquely identifies this update entity. * An ID that uniquely identifies this update entity.
* If two update entities have the same unique ID, Home Assistant will raise an exception. * If two update entities have the same unique ID, Home Assistant will raise an exception.
*/ */
unique_id?: string; 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.
@ -80,16 +90,6 @@ export interface UpdateComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -19,7 +19,17 @@ export interface VacuumComponent {
* If two vacuums have the same unique ID, Home Assistant will raise an exception. * If two vacuums have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.

View File

@ -20,7 +20,17 @@ export interface ValveComponent {
* If two valves have the same unique ID, Home Assistant will raise an exception. * If two valves have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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.
@ -182,16 +192,6 @@ export interface ValveComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -18,7 +18,17 @@ export interface WaterHeaterComponent {
* If two water heaters have the same unique ID, Home Assistant will raise an exception. * If two water heaters have the same unique ID, Home Assistant will raise an exception.
* Required when used with device-based discovery. * Required when used with device-based discovery.
*/ */
unique_id?: string; 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. * The name of the water heater.
@ -45,16 +55,6 @@ export interface WaterHeaterComponent {
*/ */
encoding?: string; encoding?: 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;
/** /**
* [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity. * [Icon](https://www.home-assistant.io/docs/configuration/customizing-devices/#icon) for the entity.
*/ */

View File

@ -12,23 +12,23 @@ export function battery__components(
): ServiceComponentsCreationResult | undefined { ): ServiceComponentsCreationResult | undefined {
const components: Record<string, HaMqttComponent> = {}; const components: Record<string, HaMqttComponent> = {};
if (svc.intf?.includes('evt.alarm.report')) {
components[`${svc.addr}_alarm`] = {
unique_id: `${svc.addr}_alarm`,
platform: 'binary_sensor',
device_class: 'battery',
value_template: `{{ (value_json['${svc.addr}'].alarm.status == 'activ') | iif('ON', 'OFF') }}`,
};
}
if (svc.intf?.includes('evt.lvl.report')) { if (svc.intf?.includes('evt.lvl.report')) {
components[`${svc.addr}_lvl`] = { components[`${svc.addr}_lvl`] = {
unique_id: `${svc.addr}_lvl`, unique_id: `${svc.addr}_lvl`,
platform: 'sensor', platform: 'sensor',
entity_category: 'diagnostic',
device_class: 'battery', device_class: 'battery',
unit_of_measurement: svc.props?.sup_units?.[0] ?? '%', unit_of_measurement: svc.props?.sup_units?.[0] ?? '%',
value_template: `{{ value_json['${svc.addr}'].lvl }}`, value_template: `{{ value_json['${svc.addr}'].lvl }}`,
}; };
} else if (svc.intf?.includes('evt.alarm.report')) {
components[`${svc.addr}_alarm`] = {
unique_id: `${svc.addr}_alarm`,
platform: 'binary_sensor',
entity_category: 'diagnostic',
device_class: 'battery',
value_template: `{{ (value_json['${svc.addr}'].alarm.status == 'activ') | iif('ON', 'OFF') }}`,
};
} }
return { return {