-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Add Sleep as Android integration #38465
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
base: next
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for home-assistant-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
d422539
to
999224c
Compare
📝 WalkthroughWalkthroughA new documentation file has been introduced for the "Sleep as Android" integration in Home Assistant. This document outlines how to connect the Sleep as Android app with Home Assistant using webhooks, enabling automation based on various sleep and alarm-related events. The documentation provides setup instructions, describes configuration parameters, enumerates supported event types, and includes guidance on integration management and removal. Metadata such as integration category, domain, and release version are also specified. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant SleepAsAndroidApp
participant HomeAssistant
User->>SleepAsAndroidApp: Enable webhook integration
SleepAsAndroidApp->>HomeAssistant: Send webhook event (e.g., alarm start, sleep phase)
HomeAssistant->>HomeAssistant: Trigger automation based on received event
Tip ⚡💬 Agentic Chat (Pro Plan, General Availability)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (3)
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: 0
🧹 Nitpick comments (6)
source/_integrations/sleep_as_android.markdown (6)
28-31
: Prerequisites Section is Clear
The prerequisites are well stated, outlining how webhooks are used and noting the requirement for remote access if needed. Consider rephrasing "you have to enable remote access" to something slightly more formal (e.g., "must be enabled") to improve tone.🧰 Tools
🪛 LanguageTool
[style] ~30-~30: Consider using a more polite wording.
Context: ... same network as Home Assistant. If you want to receive events while away from your ...(IF_YOU_WANT)
32-39
: Setup Steps are Well-Laid Out
The step-by-step instructions for setup are clear and easy to follow.
Note: There appears to be a trailing whitespace on line 34. Please ensure that this is removed to comply with markdown linting standards.🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
34-34: Trailing spaces
Expected: 0 or 2; Actual: 1(MD009, no-trailing-spaces)
48-56
: Configuration Parameters Section: Typo Detected
Within the "Cloudhook" parameter description, "Wether a Nabu Casa Cloudhook is used" should be corrected to "Whether a Nabu Casa Cloudhook is used" for proper spelling.
90-102
: Lullaby Events: Typographical Error
The description for thelullaby_start
event contains a typo ("Lullbay" instead of "Lullaby"). Please update it to "Lullaby started playing" for accuracy.
104-117
: Sleep Phase Events: Minor Typo in Table
Within the sleep phase table, the description forlight_sleep
is written as "ight sleep." It appears the initial "L" is missing. Please correct it to "Light sleep."
170-170
: Ensure Single Trailing Newline
Please confirm that the file ends with a single newline character to comply with markdown linting guidelines (MD047).🧰 Tools
🪛 markdownlint-cli2 (0.17.2)
170-170: Files should end with a single newline character
null(MD047, single-trailing-newline)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
source/_integrations/sleep_as_android.markdown
(1 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/sleep_as_android.markdown
[style] ~30-~30: Consider using a more polite wording.
Context: ... same network as Home Assistant. If you want to receive events while away from your ...
(IF_YOU_WANT)
🪛 markdownlint-cli2 (0.17.2)
source/_integrations/sleep_as_android.markdown
34-34: Trailing spaces
Expected: 0 or 2; Actual: 1
(MD009, no-trailing-spaces)
170-170: Files should end with a single newline character
null
(MD047, single-trailing-newline)
🔇 Additional comments (13)
source/_integrations/sleep_as_android.markdown (13)
1-16
: YAML Front Matter is Correct
The YAML header correctly defines the integration metadata for Sleep as Android (including title, description, category, config flow, etc.), which is essential for proper indexing and display in Home Assistant.
18-19
: Integration Introduction is Clear
The introductory paragraph clearly explains the purpose of the integration and what the user can expect.
20-23
: About Section is Informative
The "About Sleep as Android" section provides a concise overview of the app along with a useful download link to Google Play.
24-27
: Usage Section is Detailed and Informative
This section explains how automations can be triggered based on sleep tracking events. The examples provided (like dimming lights or adjusting thermostat settings) are practical and help illustrate the integration's benefits.
40-44
: Tip Block is Helpful
The tip provides additional guidance by informing users that events can be selectively enabled or disabled, enhancing usability.
46-47
: Config Flow Inclusion is Correct
Including the standard config flow snippet (via{% include integrations/config_flow.md %}
) helps maintain consistency with other integrations.
57-60
: Events Overview is Clear
This section succinctly introduces the various event categories provided by the integration.
61-79
: Alarm Clock Events are Well-Documented
The table under the "Alarm clock" section provides a complete and clear listing of event types and their descriptions.
80-89
: Anti-Snoring Events Section is Clear
This section concisely explains the anti-snoring event. The table is simple and effective.
119-131
: Sleep Tracking Events Section is Accurate
The sleep tracking events table clearly lists the available events, making it easy for users to understand the tracking capabilities.
133-146
: Sound Recognition Events Section is Clear
The table outlining the sound recognition events is complete and clearly presented.
148-157
: Sleep Apnea Events are Well-Documented
The sleep apnea section provides a concise description of when this event is triggered and what it signifies, which is helpful.
159-163
: Removing Integration Instructions are Clear
The instructions for removing the integration, along with the included removal snippet, are straightforward and adhere to documentation standards.
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: 0
🧹 Nitpick comments (3)
source/_integrations/sleep_as_android.markdown (3)
24-30
: Usage Instructions and Prerequisites Clarity
The section explaining how to use the integration—including the prerequisite of enabling Webhooks and the potential need for remote access—is well organized. However, consider rephrasing the sentence "By default, Webhook triggers can only be accessed from devices on the same network as Home Assistant." to a slightly more user-friendly or polite tone, such as: "By default, webhook triggers are available only to devices on your local network."🧰 Tools
🪛 LanguageTool
[style] ~30-~30: Consider using a more polite wording.
Context: ... same network as Home Assistant. If you want to receive events while away from your ...(IF_YOU_WANT)
45-54
: Config Flow Integration and Parameter Documentation
The inclusion of{% include integrations/config_flow.md %}
and the subsequent configuration parameters block is an excellent way to maintain consistency with other integrations. The descriptions for "Webhook ID" and "Cloudhook" are concise and clear. In case users need more context on valid entries or common pitfalls, consider adding example values or further documentation later.
56-164
: Comprehensive Event Documentation
The documentation segments covering the various event types (Alarm clock, Anti-snoring, Lullaby, Sleep phase, Sleep tracking, Sound recognition, and Sleep apnea) are detailed and well-organized using tables. This provides clear guidance on what each event type represents.
- In the "Anti-snoring" section (line 82), the sentence "When the Anti-snoring was triggered." could be revised for clarity. For example, "Triggered when anti-snoring is detected" may read better.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
source/_integrations/sleep_as_android.markdown
(1 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/sleep_as_android.markdown
[style] ~30-~30: Consider using a more polite wording.
Context: ... same network as Home Assistant. If you want to receive events while away from your ...
(IF_YOU_WANT)
🔇 Additional comments (5)
source/_integrations/sleep_as_android.markdown (5)
1-16
: YAML Front Matter Validation
The front matter includes all required metadata (title, description, ha_domain, etc.) and is correctly formatted. This ensures that the integration is properly identified and configured within Home Assistant.
18-23
: Clear Introduction and Overview
The introductory section and "About Sleep as Android" segment clearly describe what the integration does and where users can find the Sleep as Android app (with a convenient Google Play link). This makes it easy for users to understand the context and value of the integration.
32-38
: Step-by-Step Setup Instructions
The numbered steps provide a clear, step-by-step guide for users to properly configure the integration, from copying the Home Assistant URL to setting it in the Sleep as Android app. This clarity will help reduce configuration errors for end users.
39-43
: Effective Use of Tips
Including a tip block that explains how to individually select or deselect events adds a nice extra layer of user guidance. The formatting follows Home Assistant standards and helps users navigate the integration settings more intuitively.
165-170
: Removal Instructions Completeness
The section on removing the integration correctly leverages an include directive ({% include integrations/remove_device_service.md %}
) to maintain consistency with other integrations. This ensures that users have clear guidance if they decide to remove the integration later.
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: 0
🧹 Nitpick comments (5)
source/_integrations/sleep_as_android.markdown (5)
24-27
: Detailed Usage ExplanationThe "How you can use this integration" section is well written, describing how to trigger automations based on different sleep events.
Consider including illustrative examples or screenshots in the future to further enhance clarity.
39-43
: Helpful Tip BlockThe tip section offers extra guidance on configuring events.
Consider adding a visual example or a link to a screenshot if available to further aid the user.
80-90
: Anti-snoring Events DocumentationThe anti-snoring section is concise; however, the description ("When the Anti-snoring was triggered.") could be rephrased for clarity—for example, "Triggered when anti-snoring detection is activated."
106-120
: Sleep Phase Events SectionThe sleep phase events are documented effectively. Note that the description for the
not_awake
event (listed as "Fell asleep") might benefit from clarification if the intended meaning differs.
152-163
: Sleep Apnea Event DetailsThe sleep apnea section documents the event accurately. You might consider expanding the description later to include any recommended actions or additional context when this event is triggered.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
source/_integrations/sleep_as_android.markdown
(1 hunks)
⏰ 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 (12)
source/_integrations/sleep_as_android.markdown (12)
1-16
: Well-formed YAML Front MatterThe YAML front matter is correctly formatted and includes all the necessary metadata (title, description, integration details, etc.) as per Home Assistant documentation standards.
18-19
: Clear IntroductionThe introductory line clearly explains what the Sleep as Android integration provides by connecting the app to Home Assistant.
20-23
: Descriptive ‘About Sleep as Android’ SectionThe "About Sleep as Android" section succinctly describes the app’s features and provides a useful link to Google Play. This gives users good background context.
28-38
: Clear Prerequisites and Setup InstructionsThe prerequisites and step-by-step instructions for enabling webhooks are easy to follow and clear. This will help users set up the integration without confusion.
45-45
: Config Flow InclusionIncluding the config flow instructions using
{% include integrations/config_flow.md %}
is a good practice that keeps the documentation modular.
47-55
: Well-Defined Configuration ParametersThe configuration parameters section neatly presents the "Webhook ID" and "Cloudhook" settings. The descriptions are concise and align with documentation standards.
56-59
: Events Overview IntroductionThe brief introduction to the events section sets a good context by informing users that event attributes provide additional details.
60-78
: Comprehensive Alarm Clock Events DetailsThe table lists all the alarm clock events along with clear, descriptive labels. This detailed information will help users understand what triggers are available.
92-104
: Clear Lullaby Event DetailsThe table for the Lullaby feature events is clear and easy to read. The event types and their descriptions are well defined.
122-135
: Sleep Tracking Events DocumentationThe sleep tracking events are clearly listed and the table provides a good overview of the available triggers. The structure is consistent with earlier sections.
136-151
: Clear Sound Recognition EventsThe sound recognition events are documented with a straightforward table. Each event type is clearly described, making it easy for users to understand the triggers.
165-170
: Integration Removal InstructionsThe "Removing the integration" section, which delegates to an included file, is a standard and effective way to present removal instructions. Ensure that the included file remains updated with any procedural changes.
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: 0
🧹 Nitpick comments (3)
source/_integrations/sleep_as_android.markdown (3)
24-26
: Usage Overview Section:
The "How you can use this integration" section concisely outlines how to trigger sleep-related automations. As an optional improvement, consider adding an example automation snippet to further clarify usage for new users.
80-90
: Anti-snoring Events Section:
This section succinctly documents the anti-snoring event. While the current description is sufficient, consider expanding it if additional related metrics or features are introduced in future updates.
137-151
: Sound Recognition Events Section:
The table under "Sound recognition" clearly identifies various sound events (e.g., baby crying, snoring, etc.). As an optional enhancement, consider providing a short example of how one of these events might trigger an automation for better clarity.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
source/_integrations/sleep_as_android.markdown
(1 hunks)
🔇 Additional comments (13)
source/_integrations/sleep_as_android.markdown (13)
1-16
: YAML Metadata Review:
The front matter is well-structured with all required keys (e.g.,title
,ha_category
,ha_codeowners
, etc.). All integration-specific attributes are present and correctly formatted to meet Home Assistant documentation standards.
18-23
: Introduction and "About Sleep as Android" Section:
The introductory text and the "About Sleep as Android" section clearly explain the integration’s purpose and provide a useful link to the Google Play store. This sets a clear context for users as they learn about the integration.
28-30
: Prerequisites Section:
The prerequisites clearly state that the integration relies on webhooks and outline the need for remote access if events are to be received off-network. This information is crucial for troubleshooting connectivity issues.
32-38
: Setup Steps:
The numbered steps offer a straightforward guide for setting up the integration. The instructions are clear and logically ordered, helping users understand how to configure the webhook URL from Home Assistant into the Sleep as Android app.
39-43
: Tip Block Clarity:
The tip that instructs users to scroll to the top and click on Events to manage individual event triggers is a helpful addition. It improves usability by highlighting an interactive aspect of the integration setup.
45-45
: Integration Setup Flow Inclusion:
The use of the{% include integrations/config_flow.md %}
directive aligns with Home Assistant’s documentation practices and keeps the setup instructions modular.
47-55
: Configuration Parameters Block:
The configuration snippet neatly documents the "Webhook ID" and "Cloudhook" parameters. The descriptions are concise and clear, making it easy for users to understand what each parameter does.
60-78
: Alarm Clock Events Section:
The table under the "Alarm clock" heading effectively enumerates various alarm-related event types along with descriptive details. This clarity helps users quickly understand the available events and their implications.
92-104
: Lullaby Events Section:
The "Lullaby" events are well-categorized with clear descriptions. The table provides a straightforward reference that will assist users in configuring automations based on lullaby triggers.
106-120
: Sleep Phase Events Section:
The sleep phase events table clearly lays out the different sleep states with brief descriptions. Note that terms like "not_awake" meaning "fell asleep" are acceptable, but ensure consistency with any related documentation elsewhere in the project.
122-135
: Sleep Tracking Events Section:
The sleep tracking section is comprehensive and accurately describes events such as pause, resume, start, and stop. This detailed coverage supports a robust integration for sleep monitoring.
153-163
: Sleep Apnea Events Section:
The details on sleep apnea provide important context regarding critical health-related notifications. The table format is consistent with the other event sections, ensuring a uniform documentation style.
165-169
: Removing the Integration:
The removal instructions are concise and leverage the standard{% include integrations/remove_device_service.md %}
directive. This ensures that users have a clear, consistent process for uninstalling the integration if needed.
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: 1
🧹 Nitpick comments (4)
source/_integrations/sleep.markdown (4)
9-10
: Remove '@' from codeowners handleThe
ha_codeowners
entry should list the GitHub handle without the leading@
to align with other integration docs.
Diff:10c10 - - '@tr4nt0r' + - tr4nt0r
49-54
: Refactor configuration parameters blockThe
configuration_basic
macro is using quoted keys and inconsistent indentation. Consider using the standard parameters macro withname
anddescription
fields and unquoted keys. For example:49,54c49,56 - {% configuration_basic %} - "Webhook ID": - description: "The ID for the webhook URL." - "Cloudhook": - description: "Whether a Nabu Casa Cloudhook is used." - {% endconfiguration_basic %} + {% configuration %} + webhook_id: + name: Webhook ID + description: ID for the webhook URL. + cloudhook: + name: Cloudhook + description: Whether a Nabu Casa Cloudhook is used. + {% endconfiguration %}
56-59
: Add example usage for event triggersConsider including a YAML automation example under the Events section to show users how to wire up a trigger. For instance:
trigger: - platform: event event_type: apnea_alarmThis provides a concrete starting point for users.
80-83
: Grammar refinement for Anti-snoring sectionThe description "When the Anti-snoring was triggered." could be revised to present tense and lowercase feature name for consistency. For example:
When anti-snoring is triggered.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
source/_integrations/sleep.markdown
(1 hunks)
⏰ 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/sleep.markdown (1)
165-170
: Verify removal macro includeThe removal section references
remove_device_service.md
, which is typically used for device services. Please confirm whetherremove_integration.md
is the correct include for guiding users on completely removing an integration.
ha_category: | ||
- Event | ||
ha_iot_class: Local push |
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
Standardize front matter values to snake_case
The ha_category
and ha_iot_class
values should follow the snake_case convention (e.g., event
and local_push
) to ensure consistency across documentation.
Possible diff:
4,6c4,6
- ha_category:
- - Event
- ha_iot_class: Local push
+ ha_category:
+ - event
+ ha_iot_class: local_push
📝 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.
ha_category: | |
- Event | |
ha_iot_class: Local push | |
ha_category: | |
- event | |
ha_iot_class: local_push |
Proposed change
Adds documentation for Sleep as Android integration
Type of change
current
branch).current
branch).next
branch).next
branch).Additional information
Checklist
current
branch.next
branch.Summary by CodeRabbit