diff --git a/README.md b/README.md index 01005f1..a9cbf75 100644 --- a/README.md +++ b/README.md @@ -1,210 +1,127 @@ -

- - add to hacs - -

+# sleepd -

๐ŸŒ™ sleepd - Sleep As Android status

+> sleep as android status integration for home assistant -

๐Ÿšจ 0.2.0 breaking changes ๐Ÿšจ

-due to changes in **Home Assistant** 2025.12, you **must** remove your existing **sleepd** integration entries and re-add them after updating to this version. +[![HACS Custom](https://img.shields.io/badge/HACS-Custom-41BDF5?style=flat-square&logo=homeassistant)](https://hacs.xyz/docs/faq/custom_repositories) +[![License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](LICENSE) --- -

๐Ÿ“– description:

-

-sleep as android status is my solution for wake/sleep state within HA. it listens for the Sleep As Android MQTT messages, so it does require being on the same network. as of 0.0.4, buttons that link with the companion app have been added. -

+## what it does -

๐Ÿงฑ this integration will create:

+sleepd listens for Sleep As Android MQTT messages and exposes sleep state, events, and controls to Home Assistant. track when you're asleep, detect snoring, control alarms, and automate your smart home based on your sleep. - +## buttons + +*requires home assistant companion app* + +- alarm dismiss / snooze +- lullaby stop +- sleep tracking start / stop / pause / resume +- sleep tracking start with smart alarm + +## installation + +1. add this repo to HACS custom repositories: + ``` + https://github.com/sudoxnym/sleepd + ``` + +2. search for **sleepd** in HACS and install + +3. restart home assistant + +4. add integration via UI or click below: + + [![Add Integration](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=sleepd) + +## configuration + +| option | description | +|--------|-------------| +| name | identifier for this user/device | +| topic | mqtt topic (must match sleep as android settings) | +| awake duration | seconds of awake events before marking as awake | +| sleep duration | seconds of sleep events before marking as asleep | +| awake states | which states indicate being awake | +| sleep states | which states indicate being asleep | +| mobile app | companion app target for buttons (optional) | + +## sleep as android setup + +1. open sleep as android > settings > services > automation > MQTT + +2. connection string format: + ``` + tcp://user:pass@your-ha-ip:1883 + ``` + or with ssl: + ``` + ssl://user:pass@your-ha-ip:8883 + ``` + +3. set topic to match your sleepd config + +4. enable automatic tracking + +## compatible wearables + +tested with: +- xiaomi mi band 7 (via notify for mi band) +- garmin fenix 7x (via garmin alternative - paid) +- amazfit gtr3 pro (may require root for auth key)
- โœ… known working - -
+mi band 7 setup with notify -

๐Ÿงช installation:

- +1. pair band with mi fitness app +2. extract auth key via adb: + ```bash + adb shell + grep -E "authKey=[a-z0-9]*," /sdcard/Android/data/com.xiaomi.wearable/files/log/XiaomiFit.device.log | \ + awk -F ", " '{print $17}' | grep authKey | tail -1 | awk -F "=" '{print $2}' + ``` +3. uninstall mi fitness +4. install [notify for mi band](https://play.google.com/store/apps/details?id=com.mc.miband1) +5. enter auth key during setup +6. enable sleep as android in notify settings -

โš™๏ธ configuration:

- - -
- ๐Ÿ“ฒ set up Notify for Mi Band 7 -
    -
  1. pair **Mi Band 7** as you normally would with Mi Fitness
  2. -
  3. obtain auth key for Notify app using ADB
  4. -
- -
-adb shell
-grep -E "authKey=[a-z0-9]*," /sdcard/Android/data/com.xiaomi.wearable/files/log/XiaomiFit.device.log |
-awk -F ", " '{print $17}' | grep authKey | tail -1 | awk -F "=" '{print $2}'
-  
- -

credit: iamfosscad

- -
    -
  1. uninstall **Mi Fitness**
  2. -
  3. download/install Notify for Mi Band
  4. -
  5. follow prompts, input auth key, select Mi Fitness is not installed
  6. -
  7. enable Sleep As Android in Notify settings
  8. -
- ๐Ÿ” extracting the Zepp authKey on a rooted android device -
+zepp auth key extraction (rooted)
+
+```bash
 su
 cd /data/data/com.huami.watch.hmwatchmanager/databases/
-ls origin_db_*
-sqlite3 origin_db_1234567890 "SELECT AUTHKEY FROM DEVICE;"
-  
+sqlite3 origin_db_* "SELECT AUTHKEY FROM DEVICE;" +``` -
-

๐Ÿ›Œ sleep as android setup

-
    -
  1. open the app and follow setup
  2. -
  3. settings wheel > services > automation > MQTT
  4. -
+## changelog -
-(tcp/ssl)://(MQTT User):(MQTT Pass)@(HA URL):(port)
-
+**1.0.0** - rebranded from saas to sleepd, removed next alarm sensor - +**0.2.1** - fixed manifest error, config reconfigure now works -
    -
  1. enable automatic tracking
  2. -
  3. sensor: sonar or accelerometer
  4. -
  5. wearables > **Xiaomi Mi Band** > test sensor
  6. -
+**0.2.0** - fixed deprecation warnings for HA 2025.12 (breaking: re-add integration after update) -
- ๐Ÿ“ฆ changes - 0.2.2 - - 0.2.1 - +**0.1.0** - fixed wake status timing, sound sensor bugs - 0.2.0 - +--- - 0.1.0 - - - 0.0.6a - -
- -
- ๐Ÿšจ known issues -

๐Ÿ’ฌ no known issues at this time.

-
+*formerly known as [saas](https://github.com/sudoxnym/saas)* diff --git a/custom_components/sleepd/manifest.json b/custom_components/sleepd/manifest.json index d418f06..ec11e10 100644 --- a/custom_components/sleepd/manifest.json +++ b/custom_components/sleepd/manifest.json @@ -6,5 +6,5 @@ "dependencies": ["mqtt", "mobile_app"], "documentation": "https://www.github.com/sudoxnym/sleepd", "issue_tracker": "https://www.github.com/sudoxnym/sleepd/issues", - "version": "0.2.1" + "version": "1.0.0" }