diff --git a/README.md b/README.md
index dd7a710..de1dd63 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,3 @@
-
-
-

-
# sleepd
**real-time sleep state tracking for home assistant**
@@ -9,7 +5,7 @@
[](https://hacs.xyz/docs/faq/custom_repositories)
[](LICENSE)
-*processes sleep mqtt messages from android apps and exposes states, events, and controls to home assistant - automate your smart home based on whether you're awake or asleep.*
+*processes sleep mqtt messages and exposes states, events, and controls to home assistant - automate your smart home based on whether you're awake or asleep.*
---
@@ -55,34 +51,22 @@
### option 1: hacs (recommended)
-1. add this repo to HACS custom repositories:
- ```
- https://github.com/sudoxnym/sleepd
- ```
+1. add to hacs
-2. search for **sleepd** in HACS and install
+ [](https://my.home-assistant.io/redirect/hacs_repository/?owner=sudoxreboot&repository=sleepd&category=integration)
-3. restart home assistant
+3. search for **sleepd** in HACS and install
-4. add integration via UI:
+4. restart home assistant
+
+5. add integration via UI:
[](https://my.home-assistant.io/redirect/config_flow_start/?domain=saas)
### option 2: manual
-copy `custom_components/saas` to your HA `custom_components` directory
-
-## ⚙️ configuration
-
-| option | description |
-|--------|-------------|
-| name | identifier for this user/device |
-| topic | mqtt topic to subscribe to |
-| 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) |
+1. copy `custom_components/saas` to your HA `custom_components` directory
+2. restart home assistant
## 📡 mqtt setup
@@ -97,18 +81,77 @@ sleepd expects json messages with an `event` field:
{"event": "rem"}
```
-### sleep as android config
+
+ 📲 set up Notify for Mi Band 7
+
+ - pair **Mi Band 7** as you normally would with Mi Fitness
+ - obtain auth key for Notify app using ADB
+
-1. open sleep as android → settings → services → automation → MQTT
+
+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}'
+
-2. connection string:
- ```
- tcp://user:pass@your-ha-ip:1883
- ```
+ credit: iamfosscad
-3. set topic to match your sleepd config
+
+ - uninstall **Mi Fitness**
+ - download/install Notify for Mi Band
+ - follow prompts, input auth key, select Mi Fitness is not installed
+ - enable Sleep As Android in Notify settings
+
+
-4. enable automatic tracking
+
+ 🔐 extracting the Zepp authKey on a rooted android device
+
+su
+cd /data/data/com.huami.watch.hmwatchmanager/databases/
+ls origin_db_*
+sqlite3 origin_db_1234567890 "SELECT AUTHKEY FROM DEVICE;"
+
+
+
+ - ⚠️ do not unpair before extracting
+ - use with caution – root required
+ - modified apps are available on GeekDoing and FreeMyBand
+
+
+
+
+
+ - open the app and follow setup
+ - settings wheel > services > automation > MQTT
+
+
+
+(tcp/ssl)://(MQTT User):(MQTT Pass)@(HA URL):(port)
+
+
+
+ - topic: must match config
+ - client id: any unique id
+
+
+
+ - enable automatic tracking
+ - sensor: sonar or accelerometer
+ - wearables > **Xiaomi Mi Band** > test sensor
+
+
+## ⚙️ configuration
+
+| option | description |
+|--------|-------------|
+| name | identifier for this user/device |
+| topic | mqtt topic to subscribe to |
+| 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) |
## ⌚ tested wearables
@@ -116,27 +159,12 @@ sleepd expects json messages with an `event` field:
- garmin fenix 7x (via garmin alternative)
- amazfit gtr3 pro
-
-mi band 7 auth key extraction
-
-```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}'
-```
-
-
-
-## 📜 license
-
-MIT — do whatever you want with it
-
---
made by [sudoxnym](https://sudoxreboot.com) ⚡
-*formerly known as saas*
+*formerly known as [saas -sleep as android status](https://github.com/sudoxreboot/saas/tree/main) the app is capable of working with any mqtt sleep app now*