From 999224c984c93e6bcb38098255b011f598711891 Mon Sep 17 00:00:00 2001 From: tr4nt0r <4445816+tr4nt0r@users.noreply.github.com> Date: Wed, 9 Apr 2025 19:23:29 +0200 Subject: [PATCH 1/9] Add Sleep as Android integration --- .../_integrations/sleep_as_android.markdown | 170 ++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 source/_integrations/sleep_as_android.markdown diff --git a/source/_integrations/sleep_as_android.markdown b/source/_integrations/sleep_as_android.markdown new file mode 100644 index 000000000000..5c5866bdb82f --- /dev/null +++ b/source/_integrations/sleep_as_android.markdown @@ -0,0 +1,170 @@ +--- +title: Sleep as Android +description: Instructions on how to integrate Sleep as Android with Home Assistant. +ha_category: + - Event +ha_iot_class: Cloud push +ha_release: 2025.5 +ha_config_flow: true +ha_codeowners: + - '@tr4nt0r' +ha_domain: sleep_as_android +ha_integration_type: integration +ha_platforms: + - event +ha_quality_scale: silver +--- + +The **Sleep as Android** {% term integration %} connects the Sleep as Android app to Home Assistant, allowing you to trigger automations based on alarm clock or sleep cycle events. + +## About Sleep as Android + +**Sleep as Android** is a smart alarm clock with sleep cycle tracking capabilities and numerous other features to analyze and improve sleeping habits. It is available exclusively for Android devices and can be downloaded from [Google Play](https://play.google.com/store/apps/details?id=com.urbandroid.sleep). + +## How you can use this integration + +The Sleep as Android integration allows you to trigger sleep-related automations. You can trigger actions when sleep tracking starts or stops, such as dimming the lights or adjusting thermostat settings. Alarm events allow you to respond to snoozing or dismissing alarms — like starting a morning routine or sending a notification if the alarm was skipped. Additionally, you can react to specific sleep phases or sound detections (for example, snoring or baby crying), or monitor critical conditions such as sleep apnea. + +## Prerequisites + +This integration uses Webhooks to receive events from Sleep as Android. By default, Webhook triggers can only be accessed from devices on the same network as Home Assistant. If you want to receive events while away from your home network you have to enable remote access, either by adding a [remote URL](/docs/configuration/remote/) or via [Nabu Casa Cloud](https://www.nabucasa.com/config/webhooks/). + +Steps to set up the integration: + +1. Preferably, open Home Assistant on the device you want to connect to the Sleep as Android integration and initiate the setup. + +2. You will be presented a URL during the setup process. Mark the URL and copy it to the clipboard. +3. Open the Sleep as Android app and navigate to *⚙️ Settings → Services → Automation → Webhooks*. +4. Turn on the switch to enable Webhooks and paste the Webhook URL from your clipboard into the URL field. + +{% tip %} + +If you scroll to the top and click on *Events* you can individually select and deselect on which events the Sleep as Android app should trigger. + +{% endtip %} + +{% include integrations/config_flow.md %} + +### Configuration parameters + +{% configuration_basic %} +"Webhook ID": + description: "The Webhook ID for the Webhook URL." +"Cloudhook": + description: "Wether a Nabu Casa Cloudhook is used." +{% endconfiguration_basic %} + +## Events + +The integration offers various event entities that will display the most recent events from Sleep as Android. The event attributes provide additional details depending on the event type. + +### Alarm clock + +Events related to the alarm clock feature. + +{% details "Available event types" %} + +| Event type | Description | +| ------------------------- | -------------------------- | +| `alarm_alert_dismiss` | Alarm stopped | +| `alarm_alert_start` | Alarm started | +| `alarm_rescheduled` | Alarm rescheduled | +| `alarm_skip_next` | Snoozing | +| `alarm_wake_up_check` | Wake-up check notification | +| `before_smart_period` | 45m before smart wakeup | +| `show_skip_next_alarm` | 1h before alarm | +| `smart_period` | Smart wakeup started | +| `time_to_bed_alarm_alert` | Time to bed | + +{% enddetails %} + +### Anti-snoring + +When the Anti-snoring was triggered. + +{% details "Available event types" %} + +| Event type | Description | +| ------------- | ---------------------- | +| `antisnoring` | Anti-snoring triggered | + +{% enddetails %} + +### Lullaby + +Events related to the Lullaby feature. + +{% details "Available event types" %} + +| Event type | Description | +| --------------------- | ------------------------------- | +| `lullaby_start` | Lullbay started playing | +| `lullaby_stop` | Lullaby stopped playing | +| `lullaby_volume_down` | Lullaby started lowering volume | + +{% enddetails %} + +### Sleep phase + +Events when entering a new sleep phase. + +{% details "Available event types" %} + +| Event type | Description | +| ------------- | ----------- | +| `awake` | Woke up | +| `deep_sleep` | Deep sleep | +| `light_sleep` | ight sleep | +| `not_awake` | Fell asleep | +| `rem` | REM sleep | + +{% enddetails %} + +### Sleep tracking + +Events related to the sleep tracking feature. + +{% details "Available event types" %} + +| Event type | Description | +| ------------------------ | ---------------- | +| `sleep_tracking_paused` | Tracking paused | +| `sleep_tracking_resumed` | Tracking resumed | +| `sleep_tracking_started` | Tracking started | +| `sleep_tracking_stopped` | Tracking stopped | + +{% enddetails %} + +### Sound recognition + +Events triggered when a specific sound is detected during sleep tracking. + +{% details "Available event types" %} + +| Event type | Description | +| ------------------- | -------------------- | +| `sound_event_baby` | Baby crying | +| `sound_event_cough` | Coughing or sneezing | +| `sound_event_laugh` | Laughter | +| `sound_event_snore` | Snoring | +| `sound_event_talk` | Talking | + +{% enddetails %} + +### Sleep apnea + +When a significant dip in oxygen saturation level is detected. + +{% details "Available event types" %} + +| Event type | Description | +| ------------- | -------------------- | +| `apnea_alarm` | Sleep apnea detected | + +{% enddetails %} + +## Removing the integration + +This integration can be removed by following these steps: + +{% include integrations/remove_device_service.md %} \ No newline at end of file From 7ea54fd8f5f0903475a35323935930f6bdf44695 Mon Sep 17 00:00:00 2001 From: tr4nt0r <4445816+tr4nt0r@users.noreply.github.com> Date: Wed, 9 Apr 2025 19:42:51 +0200 Subject: [PATCH 2/9] fixes --- source/_integrations/sleep_as_android.markdown | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/source/_integrations/sleep_as_android.markdown b/source/_integrations/sleep_as_android.markdown index 5c5866bdb82f..d3e85739557c 100644 --- a/source/_integrations/sleep_as_android.markdown +++ b/source/_integrations/sleep_as_android.markdown @@ -27,12 +27,11 @@ The Sleep as Android integration allows you to trigger sleep-related automations ## Prerequisites -This integration uses Webhooks to receive events from Sleep as Android. By default, Webhook triggers can only be accessed from devices on the same network as Home Assistant. If you want to receive events while away from your home network you have to enable remote access, either by adding a [remote URL](/docs/configuration/remote/) or via [Nabu Casa Cloud](https://www.nabucasa.com/config/webhooks/). +This integration uses Webhooks to receive events from Sleep as Android. By default, Webhook triggers can only be accessed from devices on the same network as Home Assistant. If you want to receive events while away from your home network, remote access must be enabled, either by adding a [remote URL](/docs/configuration/remote/) or via [Nabu Casa Cloud](https://www.nabucasa.com/config/webhooks/). Steps to set up the integration: -1. Preferably, open Home Assistant on the device you want to connect to the Sleep as Android integration and initiate the setup. - +1. Preferably, open Home Assistant on the device you want to connect to the Sleep as Android integration and initiate the setup. 2. You will be presented a URL during the setup process. Mark the URL and copy it to the clipboard. 3. Open the Sleep as Android app and navigate to *⚙️ Settings → Services → Automation → Webhooks*. 4. Turn on the switch to enable Webhooks and paste the Webhook URL from your clipboard into the URL field. @@ -51,7 +50,7 @@ If you scroll to the top and click on *Events* you can individually select and d "Webhook ID": description: "The Webhook ID for the Webhook URL." "Cloudhook": - description: "Wether a Nabu Casa Cloudhook is used." + description: "Whether a Nabu Casa Cloudhook is used." {% endconfiguration_basic %} ## Events @@ -98,7 +97,7 @@ Events related to the Lullaby feature. | Event type | Description | | --------------------- | ------------------------------- | -| `lullaby_start` | Lullbay started playing | +| `lullaby_start` | Lullaby started playing | | `lullaby_stop` | Lullaby stopped playing | | `lullaby_volume_down` | Lullaby started lowering volume | @@ -114,7 +113,7 @@ Events when entering a new sleep phase. | ------------- | ----------- | | `awake` | Woke up | | `deep_sleep` | Deep sleep | -| `light_sleep` | ight sleep | +| `light_sleep` | Light sleep | | `not_awake` | Fell asleep | | `rem` | REM sleep | @@ -167,4 +166,4 @@ When a significant dip in oxygen saturation level is detected. This integration can be removed by following these steps: -{% include integrations/remove_device_service.md %} \ No newline at end of file +{% include integrations/remove_device_service.md %} From 6996d64dd75b836e4e1e1ca21dc271cc7a9d6ffb Mon Sep 17 00:00:00 2001 From: tr4nt0r <4445816+tr4nt0r@users.noreply.github.com> Date: Fri, 11 Apr 2025 22:48:27 +0200 Subject: [PATCH 3/9] typos and changes --- source/_integrations/sleep_as_android.markdown | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/_integrations/sleep_as_android.markdown b/source/_integrations/sleep_as_android.markdown index d3e85739557c..4a848f081fea 100644 --- a/source/_integrations/sleep_as_android.markdown +++ b/source/_integrations/sleep_as_android.markdown @@ -3,7 +3,7 @@ title: Sleep as Android description: Instructions on how to integrate Sleep as Android with Home Assistant. ha_category: - Event -ha_iot_class: Cloud push +ha_iot_class: Local push ha_release: 2025.5 ha_config_flow: true ha_codeowners: @@ -27,14 +27,14 @@ The Sleep as Android integration allows you to trigger sleep-related automations ## Prerequisites -This integration uses Webhooks to receive events from Sleep as Android. By default, Webhook triggers can only be accessed from devices on the same network as Home Assistant. If you want to receive events while away from your home network, remote access must be enabled, either by adding a [remote URL](/docs/configuration/remote/) or via [Nabu Casa Cloud](https://www.nabucasa.com/config/webhooks/). +This integration uses webhooks to receive events from Sleep as Android. By default, webhook triggers can only be accessed from devices on the same network as Home Assistant. If you want to receive events while away from your home network, remote access must be enabled, either by adding a [remote URL](/docs/configuration/remote/) or via [Nabu Casa Cloud](https://www.nabucasa.com/config/webhooks/). Steps to set up the integration: 1. Preferably, open Home Assistant on the device you want to connect to the Sleep as Android integration and initiate the setup. 2. You will be presented a URL during the setup process. Mark the URL and copy it to the clipboard. 3. Open the Sleep as Android app and navigate to *⚙️ Settings → Services → Automation → Webhooks*. -4. Turn on the switch to enable Webhooks and paste the Webhook URL from your clipboard into the URL field. +4. Turn on the switch to enable webhooks and paste the webhook URL from your clipboard into the URL field. {% tip %} @@ -48,7 +48,7 @@ If you scroll to the top and click on *Events* you can individually select and d {% configuration_basic %} "Webhook ID": - description: "The Webhook ID for the Webhook URL." + description: "The ID for the webhook URL." "Cloudhook": description: "Whether a Nabu Casa Cloudhook is used." {% endconfiguration_basic %} @@ -70,9 +70,9 @@ Events related to the alarm clock feature. | `alarm_rescheduled` | Alarm rescheduled | | `alarm_skip_next` | Snoozing | | `alarm_wake_up_check` | Wake-up check notification | -| `before_smart_period` | 45m before smart wakeup | +| `before_smart_period` | 45min before smart wake-up | | `show_skip_next_alarm` | 1h before alarm | -| `smart_period` | Smart wakeup started | +| `smart_period` | Smart wake-up started | | `time_to_bed_alarm_alert` | Time to bed | {% enddetails %} @@ -113,7 +113,7 @@ Events when entering a new sleep phase. | ------------- | ----------- | | `awake` | Woke up | | `deep_sleep` | Deep sleep | -| `light_sleep` | Light sleep | +| `light_sleep` | Light sleep | | `not_awake` | Fell asleep | | `rem` | REM sleep | From edbaf4861d40e3276e74fef05ff6ba854c3ec18b Mon Sep 17 00:00:00 2001 From: tr4nt0r <4445816+tr4nt0r@users.noreply.github.com> Date: Sun, 13 Apr 2025 13:16:19 +0200 Subject: [PATCH 4/9] mdi icon --- source/_integrations/sleep_as_android.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/sleep_as_android.markdown b/source/_integrations/sleep_as_android.markdown index 4a848f081fea..c5fa7b4d2ea7 100644 --- a/source/_integrations/sleep_as_android.markdown +++ b/source/_integrations/sleep_as_android.markdown @@ -33,7 +33,7 @@ Steps to set up the integration: 1. Preferably, open Home Assistant on the device you want to connect to the Sleep as Android integration and initiate the setup. 2. You will be presented a URL during the setup process. Mark the URL and copy it to the clipboard. -3. Open the Sleep as Android app and navigate to *⚙️ Settings → Services → Automation → Webhooks*. +3. Open the Sleep as Android app and navigate to *{% icon "mdi:cog" %} Settings → Services → Automation → Webhooks*. 4. Turn on the switch to enable webhooks and paste the webhook URL from your clipboard into the URL field. {% tip %} From 1bd513626feee1713c11bb27bdf32b5d1ef51dc1 Mon Sep 17 00:00:00 2001 From: tr4nt0r <4445816+tr4nt0r@users.noreply.github.com> Date: Sun, 20 Apr 2025 15:07:07 +0200 Subject: [PATCH 5/9] change domain to sleep --- .../_integrations/{sleep_as_android.markdown => sleep.markdown} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename source/_integrations/{sleep_as_android.markdown => sleep.markdown} (99%) diff --git a/source/_integrations/sleep_as_android.markdown b/source/_integrations/sleep.markdown similarity index 99% rename from source/_integrations/sleep_as_android.markdown rename to source/_integrations/sleep.markdown index c5fa7b4d2ea7..b1528af5d0ca 100644 --- a/source/_integrations/sleep_as_android.markdown +++ b/source/_integrations/sleep.markdown @@ -8,7 +8,7 @@ ha_release: 2025.5 ha_config_flow: true ha_codeowners: - '@tr4nt0r' -ha_domain: sleep_as_android +ha_domain: sleep ha_integration_type: integration ha_platforms: - event From 5ffb0143eb01a06272506cc98f917800688e00bf Mon Sep 17 00:00:00 2001 From: tr4nt0r <4445816+tr4nt0r@users.noreply.github.com> Date: Sun, 20 Apr 2025 15:22:22 +0200 Subject: [PATCH 6/9] typos --- source/_integrations/sleep.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/_integrations/sleep.markdown b/source/_integrations/sleep.markdown index b1528af5d0ca..132550999b09 100644 --- a/source/_integrations/sleep.markdown +++ b/source/_integrations/sleep.markdown @@ -79,7 +79,7 @@ Events related to the alarm clock feature. ### Anti-snoring -When the Anti-snoring was triggered. +When the anti-snoring is triggered. {% details "Available event types" %} From b88b5022c8fe4265e28a14192f47747ab6ba2488 Mon Sep 17 00:00:00 2001 From: tr4nt0r <4445816+tr4nt0r@users.noreply.github.com> Date: Wed, 4 Jun 2025 03:49:12 +0200 Subject: [PATCH 7/9] some changes --- source/_integrations/sleep.markdown | 71 ++++++++++++----------------- 1 file changed, 29 insertions(+), 42 deletions(-) diff --git a/source/_integrations/sleep.markdown b/source/_integrations/sleep.markdown index 132550999b09..bf0a4acc4bec 100644 --- a/source/_integrations/sleep.markdown +++ b/source/_integrations/sleep.markdown @@ -4,7 +4,7 @@ description: Instructions on how to integrate Sleep as Android with Home Assista ha_category: - Event ha_iot_class: Local push -ha_release: 2025.5 +ha_release: 2025.7 ha_config_flow: true ha_codeowners: - '@tr4nt0r' @@ -19,7 +19,7 @@ The **Sleep as Android** {% term integration %} connects the Sleep as Android ap ## About Sleep as Android -**Sleep as Android** is a smart alarm clock with sleep cycle tracking capabilities and numerous other features to analyze and improve sleeping habits. It is available exclusively for Android devices and can be downloaded from [Google Play](https://play.google.com/store/apps/details?id=com.urbandroid.sleep). +[**Sleep as Android**](https://sleep.urbandroid.org/) is a smart alarm clock with sleep cycle tracking capabilities and numerous other features to analyze and improve sleeping habits. It is available exclusively for Android devices and can be downloaded from [Google Play](https://play.google.com/store/apps/details?id=com.urbandroid.sleep). ## How you can use this integration @@ -61,54 +61,57 @@ The integration offers various event entities that will display the most recent Events related to the alarm clock feature. -{% details "Available event types" %} - | Event type | Description | | ------------------------- | -------------------------- | -| `alarm_alert_dismiss` | Alarm stopped | +| `alarm_alert_dismiss` | Alarm dismissed | | `alarm_alert_start` | Alarm started | | `alarm_rescheduled` | Alarm rescheduled | -| `alarm_skip_next` | Snoozing | -| `alarm_wake_up_check` | Wake-up check notification | +| `alarm_skip_next` | Alarm skipped | +| `alarm_snooze_clicked` | Snoozing | +| `alarm_snooze_canceled` | Snoozing canceled | + +### Smart wake-up + +Events related to the smart wake-up feature. + +| Event type | Description | +| ------------------------- | -------------------------- | | `before_smart_period` | 45min before smart wake-up | -| `show_skip_next_alarm` | 1h before alarm | | `smart_period` | Smart wake-up started | -| `time_to_bed_alarm_alert` | Time to bed | -{% enddetails %} +### User notifications -### Anti-snoring +Events related to user notifications. -When the anti-snoring is triggered. +| Event type | Description | +| ------------------------- | --------------- | +| `alarm_wake_up_check` | Wake-up check | +| `show_skip_next_alarm` | Skip next alarm | +| `time_to_bed_alarm_alert` | Time to bed | -{% details "Available event types" %} +### Sleep health + +Events related to sleep health. | Event type | Description | | ------------- | ---------------------- | | `antisnoring` | Anti-snoring triggered | - -{% enddetails %} +| `apnea_alarm` | Sleep apnea detected | ### Lullaby Events related to the Lullaby feature. -{% details "Available event types" %} - | Event type | Description | | --------------------- | ------------------------------- | | `lullaby_start` | Lullaby started playing | | `lullaby_stop` | Lullaby stopped playing | | `lullaby_volume_down` | Lullaby started lowering volume | -{% enddetails %} - ### Sleep phase Events when entering a new sleep phase. -{% details "Available event types" %} - | Event type | Description | | ------------- | ----------- | | `awake` | Woke up | @@ -117,14 +120,16 @@ Events when entering a new sleep phase. | `not_awake` | Fell asleep | | `rem` | REM sleep | -{% enddetails %} +{% warning %} + +Be cautious when automating based on sleep phase events, especially deep and light sleep, as these can trigger lots of events throughout the night and they may not precisely correlate with the resulting sleep graph as Sleep as Android can only detect phases reliably using whole-night data. + +{% endwarning %} ### Sleep tracking Events related to the sleep tracking feature. -{% details "Available event types" %} - | Event type | Description | | ------------------------ | ---------------- | | `sleep_tracking_paused` | Tracking paused | @@ -132,14 +137,10 @@ Events related to the sleep tracking feature. | `sleep_tracking_started` | Tracking started | | `sleep_tracking_stopped` | Tracking stopped | -{% enddetails %} - ### Sound recognition Events triggered when a specific sound is detected during sleep tracking. -{% details "Available event types" %} - | Event type | Description | | ------------------- | -------------------- | | `sound_event_baby` | Baby crying | @@ -148,20 +149,6 @@ Events triggered when a specific sound is detected during sleep tracking. | `sound_event_snore` | Snoring | | `sound_event_talk` | Talking | -{% enddetails %} - -### Sleep apnea - -When a significant dip in oxygen saturation level is detected. - -{% details "Available event types" %} - -| Event type | Description | -| ------------- | -------------------- | -| `apnea_alarm` | Sleep apnea detected | - -{% enddetails %} - ## Removing the integration This integration can be removed by following these steps: From b7e75469476f25928f21cd0fef516e73a73e7a04 Mon Sep 17 00:00:00 2001 From: tr4nt0r <4445816+tr4nt0r@users.noreply.github.com> Date: Wed, 4 Jun 2025 04:14:47 +0200 Subject: [PATCH 8/9] fixes --- source/_integrations/sleep.markdown | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/_integrations/sleep.markdown b/source/_integrations/sleep.markdown index bf0a4acc4bec..304e22383830 100644 --- a/source/_integrations/sleep.markdown +++ b/source/_integrations/sleep.markdown @@ -50,7 +50,7 @@ If you scroll to the top and click on *Events* you can individually select and d "Webhook ID": description: "The ID for the webhook URL." "Cloudhook": - description: "Whether a Nabu Casa Cloudhook is used." + description: "Whether a Nabu Casa Cloudhook is used." {% endconfiguration_basic %} ## Events @@ -72,7 +72,7 @@ Events related to the alarm clock feature. ### Smart wake-up -Events related to the smart wake-up feature. +Events related to the smart wake-up feature. | Event type | Description | | ------------------------- | -------------------------- | @@ -122,7 +122,7 @@ Events when entering a new sleep phase. {% warning %} -Be cautious when automating based on sleep phase events, especially deep and light sleep, as these can trigger lots of events throughout the night and they may not precisely correlate with the resulting sleep graph as Sleep as Android can only detect phases reliably using whole-night data. +Be cautious when automating based on sleep phase events, especially deep and light sleep, as these can trigger lots of events throughout the night, and they may not precisely correlate with the resulting sleep graph as Sleep as Android can only detect phases reliably using whole-night data. {% endwarning %} From 459a598d8cc7f55a948041565edb97f5714c40fa Mon Sep 17 00:00:00 2001 From: tr4nt0r <4445816+tr4nt0r@users.noreply.github.com> Date: Mon, 23 Jun 2025 23:40:47 +0200 Subject: [PATCH 9/9] rename --- .../_integrations/{sleep.markdown => sleep_as_android.markdown} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename source/_integrations/{sleep.markdown => sleep_as_android.markdown} (99%) diff --git a/source/_integrations/sleep.markdown b/source/_integrations/sleep_as_android.markdown similarity index 99% rename from source/_integrations/sleep.markdown rename to source/_integrations/sleep_as_android.markdown index 304e22383830..2b0be008f8ce 100644 --- a/source/_integrations/sleep.markdown +++ b/source/_integrations/sleep_as_android.markdown @@ -8,7 +8,7 @@ ha_release: 2025.7 ha_config_flow: true ha_codeowners: - '@tr4nt0r' -ha_domain: sleep +ha_domain: sleep_as_android ha_integration_type: integration ha_platforms: - event