-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Add modern style configuration for template cover #38744
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
Add modern style configuration for template cover #38744
Conversation
❌ Deploy Preview for home-assistant-docs failed.
|
📝 WalkthroughWalkthroughThe documentation for the Template integration in Home Assistant was updated to add support for the "cover" entity type. This involved expanding the lists of supported categories and platforms to include "cover", updating relevant section headers, and adding a detailed configuration reference for template covers. The new section describes the schema, required and optional keys, accepted value types, and behavioral flags for cover entities. Additionally, the documentation now lists "cover" among the entity types that share common configuration fields. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant HomeAssistantDocs
User ->> HomeAssistantDocs: Reads Template integration documentation
HomeAssistantDocs -->> User: Presents updated entity types (including "cover")
User ->> HomeAssistantDocs: Views configuration reference for "cover"
HomeAssistantDocs -->> User: Shows cover schema, keys, and usage details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
source/_integrations/template.markdown (1)
79-79
: Nitpick: normalize “weathers” to “weather”.In the heading, “weathers” is nonstandard; it’s preferable to use the uncountable form “weather”.
Suggested change:-### State-based template binary sensors, buttons, covers, images, numbers, selects, sensors, and weathers +### State-based template binary sensors, buttons, covers, images, numbers, selects, sensors, and weather
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
source/_integrations/template.markdown
(4 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/template.markdown
[uncategorized] ~342-~342: A comma might be missing here.
Context: ...en). If the template produces a None
value the current tilt state will be set to `...
(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
🪛 markdownlint-cli2 (0.17.2)
source/_integrations/template.markdown
300-300: Link fragments should be valid
null
(MD051, link-fragments)
312-312: Link fragments should be valid
null
(MD051, link-fragments)
312-312: Link fragments should be valid
null
(MD051, link-fragments)
312-312: Link fragments should be valid
null
(MD051, link-fragments)
312-312: Link fragments should be valid
null
(MD051, link-fragments)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules - home-assistant-docs
- GitHub Check: Header rules - home-assistant-docs
- GitHub Check: Pages changed - home-assistant-docs
🔇 Additional comments (3)
source/_integrations/template.markdown (3)
7-7
: Approve addition ofCover
toha_category
.Including
Cover
in theha_category
list aligns with the new template cover feature.
10-10
: Approve addition ofLight
toha_category
.The
Light
entry follows the existing pattern and ensures consistency in category listings.
14-14
: Approve addition ofSwitch
toha_category
.Adding
Switch
here keeps the category list up to date with supported template entities.
@@ -391,7 +441,7 @@ weather: | |||
description: Unit for precipitation output. Valid options are km, mi, ft, m, cm, mm, in, yd. | |||
required: false | |||
type: string | |||
"[all sensor, binary sensor, button, image, number, select, weather entities]": | |||
"[all sensor, binary sensor, button, cover, image, number, select, weather entities]": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Correct the map description to include all listed entities.
The header includes cover
, image
, and weather
, but the description omits them. This inconsistency can confuse readers.
Proposed fix:
- description: Fields that can be used above for sensors, binary sensors, buttons, numbers, and selects.
+ description: Fields that can be used above for sensors, binary sensors, buttons, covers, images, numbers, selects, and weather entities.
📝 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.
"[all sensor, binary sensor, button, cover, image, number, select, weather entities]": | |
"[all sensor, binary sensor, button, cover, image, number, select, weather entities]": | |
description: Fields that can be used above for sensors, binary sensors, buttons, covers, images, numbers, selects, and weather entities. |
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Fix broken link fragment and add missing comma in cover config.
- The link to
#combining-value_template-and-position_template
does not resolve—remove or replace it. - Add a comma after “None value” for readability.
Proposed diff:
@@ 299,307
- 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`.
+ 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` 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`.
@@ 340,345
- 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`.
+ 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`.
🧰 Tools
🪛 LanguageTool
[uncategorized] ~342-~342: A comma might be missing here.
Context: ...en). If the template produces a None
value the current tilt state will be set to `...
(AI_EN_LECTOR_MISSING_PUNCTUATION_COMMA)
🪛 markdownlint-cli2 (0.17.2)
300-300: Link fragments should be valid
null
(MD051, link-fragments)
312-312: Link fragments should be valid
null
(MD051, link-fragments)
312-312: Link fragments should be valid
null
(MD051, link-fragments)
312-312: Link fragments should be valid
null
(MD051, link-fragments)
312-312: Link fragments should be valid
null
(MD051, link-fragments)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (1)
source/_integrations/template.markdown (1)
445-445
:⚠️ Potential issueInclude all entity types in common-fields description.
The description under
"[all sensor, binary sensor, button, cover, image, number, select, weather entities]"
omitscover
,image
, andweather
. Update it to match the heading:- description: Fields that can be used above for sensors, binary sensors, buttons, numbers, and selects. + description: Fields that can be used above for sensors, binary sensors, buttons, covers, images, numbers, selects, and weather entities.
🧹 Nitpick comments (2)
source/_integrations/template.markdown (2)
304-304
: Add missing comma in position description.For clarity, insert a comma after “value”:
- If the template produces a `None` value the current position will be set to `unknown`. + If the template produces a `None` value, the current position will be set to `unknown`.🧰 Tools
🪛 LanguageTool
[uncategorized] ~304-~304: Possible missing comma found.
Context: ...pen). If the template produces aNone
value the current position will be set to `un...(AI_HYDRA_LEO_MISSING_COMMA)
342-342
: Remove extra space before sentence.There are two spaces after the period—reduce to one for consistency:
- 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`. + 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`.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
source/_integrations/template.markdown
(4 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/template.markdown
[uncategorized] ~304-~304: Possible missing comma found.
Context: ...pen). If the template produces a None
value the current position will be set to `un...
(AI_HYDRA_LEO_MISSING_COMMA)
🪛 markdownlint-cli2 (0.17.2)
source/_integrations/template.markdown
300-300: Link fragments should be valid
null
(MD051, link-fragments)
312-312: Link fragments should be valid
null
(MD051, link-fragments)
312-312: Link fragments should be valid
null
(MD051, link-fragments)
312-312: Link fragments should be valid
null
(MD051, link-fragments)
312-312: Link fragments should be valid
null
(MD051, link-fragments)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Redirect rules - home-assistant-docs
- GitHub Check: Header rules - home-assistant-docs
- GitHub Check: Pages changed - home-assistant-docs
🔇 Additional comments (1)
source/_integrations/template.markdown (1)
4-14
: Add support forcover
inha_category
and maintain alphabetical ordering.The
ha_category
frontmatter now includesCover
, and the list remains alphabetically ordered. This helps users discover the new template cover option alongside existing categories.
@@ -73,7 +76,7 @@ Entities (sensors, binary sensors, buttons, images, numbers, and selections) are | |||
|
|||
_For old sensor/binary sensor configuration format, [see below](#legacy-binary-sensor-configuration-format)._ | |||
|
|||
### State-based template binary sensors, buttons, images, numbers, selects, sensors, and weathers | |||
### State-based template binary sensors, buttons, covers, images, numbers, selects, sensors, and weathers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix pluralization and naming in heading.
The heading reads “weathers” (plural), but the integration uses the singular weather
entity type. Please update it as follows for consistency:
- ### State-based template binary sensors, buttons, covers, images, numbers, selects, sensors, and weathers
+ ### State-based template binary sensors, buttons, covers, images, numbers, selects, sensors, and weather
📝 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.
### State-based template binary sensors, buttons, covers, images, numbers, selects, sensors, and weathers | |
### State-based template binary sensors, buttons, covers, images, numbers, selects, sensors, and weather |
@@ -292,6 +295,53 @@ button: | |||
description: Defines actions to run to press the 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`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolve broken link to combining templates.
The inline link to #combining-value_template-and-position_template
does not point to any anchor. Simplify or correct it, for example:
- If [both a `value_template` and a `position_template`](#combining-value_template-and-position_template) are specified...
+ If both a `value_template` and a `position_template` are specified...
📝 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.
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`. | |
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` 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`. |
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
300-300: Link fragments should be valid
null
(MD051, link-fragments)
Proposed change
Adds modern style template configuration to cover platform.
e.g.
Type of change
current
branch).current
branch).next
branch).next
branch).Additional information
Checklist
current
branch.next
branch.Summary by CodeRabbit