Skip to content

Template: cover: add description and type #38785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 49 additions & 46 deletions source/_integrations/template.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -296,52 +296,55 @@ button:
required: true
type: action
cover:
state:
description: Defines a template to get the state of the cover. Valid output values from the template are `open`, `opening`, `closing` and `closed` which are directly mapped to the corresponding states. In addition, `true` is valid as a synonym to `open` and `false` as a synonym to `closed`. If [both a `value_template` and a `position_template`](#combining-value_template-and-position_template) are specified, only `opening` and `closing` are set from the `value_template`. If the template produces a `None` value the state will be set to `unknown`.
required: false
type: template
position:
description: Defines a template to get the position of the cover. Legal values are numbers between `0` (closed) and `100` (open). If the template produces a `None` value the current position will be set to `unknown`.
required: false
type: template
device_class:
description: Sets the [class of the device](/integrations/cover/), changing the device state and icon that is displayed on the frontend.
required: false
type: string
open_cover:
description: Defines an action to open the cover. If [`open_cover`](#open_cover) is specified, [`close_cover`](#close_cover) must also be specified. At least one of [`open_cover`](#open_cover) and [`set_cover_position`](#set_cover_position) must be specified.
required: inclusive
type: action
close_cover:
description: Defines an action to close the cover.
required: inclusive
type: action
stop_cover:
description: Defines an action to stop the cover.
required: false
type: action
set_cover_position:
description: Defines an action to set to a cover position (between `0` and `100`). The variable `position` will contain the entity's set position.
required: false
type: action
set_cover_tilt_position:
description: Defines an action to set the tilt of a cover (between `0` and `100`). The variable `tilt` will contain the entity's set tilt position.
required: false
type: action
optimistic:
description: Force cover position to use [optimistic mode](#optimistic-mode).
required: false
type: boolean
default: false
tilt_optimistic:
description: Force cover tilt position to use [optimistic mode](#optimistic-mode).
required: false
type: boolean
default: false
tilt:
description: Defines a template to get the tilt state of the cover. Legal values are numbers between `0` (closed) and `100` (open). If the template produces a `None` value, the current tilt state will be set to `unknown`.
required: false
type: template
description: Characteristics of a cover
type: map
Comment on lines +299 to +300
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add required: true to the cover section for consistency
The cover block should declare whether it’s required, mirroring other entity sections (e.g., image, button, number) which all include required: true. Without this key, the schema may be unclear.

Proposed diff:

 cover:
   description: Characteristics of a cover
-  type: map
+  required: true
+  type: map

If desired, you might also align the description with other sections (e.g., "List of covers") to maintain uniformity.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
description: Characteristics of a cover
type: map
cover:
description: Characteristics of a cover
required: true
type: map

keys:
state:
description: Defines a template to get the state of the cover. Valid output values from the template are `open`, `opening`, `closing` and `closed` which are directly mapped to the corresponding states. In addition, `true` is valid as a synonym to `open` and `false` as a synonym to `closed`. If [both a `value_template` and a `position_template`](#combining-value_template-and-position_template) are specified, only `opening` and `closing` are set from the `value_template`. If the template produces a `None` value the state will be set to `unknown`.
required: false
type: template
position:
description: Defines a template to get the position of the cover. Legal values are numbers between `0` (closed) and `100` (open). If the template produces a `None` value the current position will be set to `unknown`.
required: false
type: template
device_class:
description: Sets the [class of the device](/integrations/cover/), changing the device state and icon that is displayed on the frontend.
required: false
type: string
open_cover:
description: Defines an action to open the cover. If [`open_cover`](#open_cover) is specified, [`close_cover`](#close_cover) must also be specified. At least one of [`open_cover`](#open_cover) and [`set_cover_position`](#set_cover_position) must be specified.
required: inclusive
type: action
close_cover:
description: Defines an action to close the cover.
required: inclusive
type: action
stop_cover:
description: Defines an action to stop the cover.
required: false
type: action
set_cover_position:
description: Defines an action to set to a cover position (between `0` and `100`). The variable `position` will contain the entity's set position.
required: false
type: action
set_cover_tilt_position:
description: Defines an action to set the tilt of a cover (between `0` and `100`). The variable `tilt` will contain the entity's set tilt position.
required: false
type: action
optimistic:
description: Force cover position to use [optimistic mode](#optimistic-mode).
required: false
type: boolean
default: false
tilt_optimistic:
description: Force cover tilt position to use [optimistic mode](#optimistic-mode).
required: false
type: boolean
default: false
tilt:
description: Defines a template to get the tilt state of the cover. Legal values are numbers between `0` (closed) and `100` (open). If the template produces a `None` value, the current tilt state will be set to `unknown`.
required: false
type: template
image:
description: List of images
required: true
Expand Down