v1.0.0 - rebrand complete, clean readme

This commit is contained in:
sudoxnym 2025-12-07 08:13:29 -06:00
parent 7b62009e0d
commit a95a4f7c30
2 changed files with 101 additions and 184 deletions

279
README.md
View file

@ -1,210 +1,127 @@
<p align="center"> # sleepd
<a href="https://hacs.xyz/docs/faq/custom_repositories">
<img src="https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge&logo=home%20assistant&labelColor=202020&color=41BDF5" alt="add to hacs">
</a>
</p>
<h1>🌙 sleepd - Sleep As Android status</h1> > sleep as android status integration for home assistant
<h2>🚨 0.2.0 breaking changes 🚨</h2> [![HACS Custom](https://img.shields.io/badge/HACS-Custom-41BDF5?style=flat-square&logo=homeassistant)](https://hacs.xyz/docs/faq/custom_repositories)
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. [![License](https://img.shields.io/badge/license-MIT-green?style=flat-square)](LICENSE)
--- ---
<h2>📖 description:</h2> ## what it does
<p>
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.
</p>
<h3>🧱 this integration will create:</h3> 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.
<ul> ## sensors
<li>
<details>
<summary><strong>📡 8 sensors</strong></summary>
| Sensor | Description | | sensor | description |
| ------ | ----------- | |--------|-------------|
| message received | shows the last raw MQTT event payload | | wake status | `awake` or `asleep` based on configurable states and durations |
| wake status | indicates awake or asleep based on your sleep stage | | sleep stage | current stage from sleep as android (light, deep, rem, awake) |
| sound | snore, talk, cough, and other sound events | | sleep tracking | whether tracking is active or paused |
| disturbance | reports apnea and antisnoring events | | alarm event | alarm events like snooze, dismiss, skip |
| **next alarm** | upcoming alarm time and label; stores the last ten alarms in attributes | | sound | snore, talk, cough, and other detected sounds |
| alarm | alarm related events such as snooze or dismiss | | disturbance | apnea and anti-snoring events |
| lullaby | lullaby status | | lullaby | lullaby playback status |
| sleep tracking | whether sleep tracking is active or paused | | state | raw event from last mqtt message |
| sleep stage | current sleep stage from Sleep As Android |
<p>the wake status sensor adjusts automatically based on the defined awake and asleep states.</p> ## buttons
</details>
</li> *requires home assistant companion app*
<li>
<details> - alarm dismiss / snooze
<summary><strong>🎛️ 8 buttons *only if mobile_app selected</strong></summary> - lullaby stop
<ul> - sleep tracking start / stop / pause / resume
<li>alarm dismiss</li> - sleep tracking start with smart alarm
<li>alarm snooze</li>
<li>lullaby stop</li> ## installation
<li>sleep tracking pause</li>
<li>sleep tracking resume</li> 1. add this repo to HACS custom repositories:
<li>sleep tracking start</li> ```
<li>sleep tracking start with optimal alarm</li> https://github.com/sudoxnym/sleepd
<li>sleep tracking stop</li> ```
</ul>
</details> 2. search for **sleepd** in HACS and install
</li>
<li> 3. restart home assistant
<details>
<summary><strong>🛠️ 1 service</strong></summary> 4. add integration via UI or click below:
<pre>
service: sleepd.sleepd_example_alarm_set [![Add Integration](https://my.home-assistant.io/badges/config_flow_start.svg)](https://my.home-assistant.io/redirect/config_flow_start/?domain=sleepd)
data:
message: Example Message! ## configuration
day: monday
hour: 7 | option | description |
minute: 30 |--------|-------------|
</pre> | name | identifier for this user/device |
</details> | topic | mqtt topic (must match sleep as android settings) |
</li> | awake duration | seconds of awake events before marking as awake |
<li> | sleep duration | seconds of sleep events before marking as asleep |
<details> | awake states | which states indicate being awake |
<summary><strong>🔗 1 device per user</strong></summary> | sleep states | which states indicate being asleep |
<p>one HA device is created per configured user instance to link sensors, services, and buttons.</p> | mobile app | companion app target for buttons (optional) |
</details>
</li> ## sleep as android setup
</ul>
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)
<details> <details>
<summary><strong>✅ known working</strong></summary> <summary>mi band 7 setup with notify</summary>
<ul>
<li>📟 **Xiaomi Mi Band 7**</li>
<li>📟 **Xiaomi Mi Band 8** and **Mi Band 9** may work, but they have a different os that jumps through hoops to work.</li>
<li>**Garmin Fenix 7X** with garmin alternative, **not** the free one.</li>
<li>**Xiaomi Amazfit GTR3 Pro** — may require root. i am rooted so i just did what's in this guide, but there may be alternative ways to get the key.</li>
</ul>
</details>
<h2>🧪 installation:</h2> 1. pair band with mi fitness app
<ul> 2. extract auth key via adb:
<li>add <code>https://www.github.com/sudoxnym/sleepd</code> to your custom repositories in HACS</li> ```bash
<li>search and download **sleepd - Sleep As Android status**</li>
<li>restart Home Assistant</li>
<li>
<a href="https://my.home-assistant.io/redirect/config_flow_start/?domain=sleepd">
<img src="https://my.home-assistant.io/badges/config_flow_start.svg" alt="add to ha">
</a>
</li>
<li>add integration: **sleepd - Sleep As Android status**</li>
</ul>
<h2>⚙️ configuration:</h2>
<ul>
<li>name: name of user</li>
<li>topic: MQTT topic from Sleep As Android *MUST MATCH*</li>
<li>awake duration: time in seconds in which awake states = true to indicate awake. <b>fixed</b></li>
<li>asleep duration: time in seconds in which sleep states = true to indicate asleep. <b>fixed</b></li>
<li>awake states: states to indicate being awake</li>
<li>asleep states: states to indicate being asleep</li>
<li>mobile app: target for buttons <b>requires companion app *OPTIONAL: REQUIRES COMPANION APP*</b></li>
</ul>
<details>
<summary><strong>📲 set up Notify for Mi Band 7</strong></summary>
<ol>
<li>pair **Mi Band 7** as you normally would with <a href="https://play.google.com/store/apps/details?id=com.xiaomi.wearable&hl=en_US">Mi Fitness</a></li>
<li>obtain auth key for Notify app using ADB</li>
</ol>
<pre>
adb shell adb shell
grep -E "authKey=[a-z0-9]*," /sdcard/Android/data/com.xiaomi.wearable/files/log/XiaomiFit.device.log | 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}' awk -F ", " '{print $17}' | grep authKey | tail -1 | awk -F "=" '{print $2}'
</pre> ```
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
<p>credit: <a href="https://www.reddit.com/r/miband/comments/15j0rfq/comment/kxlyzc6/">iamfosscad</a></p>
<ol start="3">
<li>uninstall **Mi Fitness**</li>
<li>download/install <a href="https://play.google.com/store/apps/details?id=com.mc.miband1&hl=en_US">Notify for Mi Band</a></li>
<li>follow prompts, input auth key, select Mi Fitness is not installed</li>
<li>enable Sleep As Android in Notify settings</li>
</ol>
</details> </details>
<details> <details>
<summary><strong>🔐 extracting the Zepp <code>authKey</code> on a rooted android device</strong></summary> <summary>zepp auth key extraction (rooted)</summary>
<pre>
```bash
su su
cd /data/data/com.huami.watch.hmwatchmanager/databases/ cd /data/data/com.huami.watch.hmwatchmanager/databases/
ls origin_db_* sqlite3 origin_db_* "SELECT AUTHKEY FROM DEVICE;"
sqlite3 origin_db_1234567890 "SELECT AUTHKEY FROM DEVICE;" ```
</pre>
<ul>
<li>⚠️ do not unpair before extracting</li>
<li>use with caution root required</li>
<li>modified apps are available on <a href="https://geekdoing.com">GeekDoing</a> and <a href="https://freemyband.com">FreeMyBand</a></li>
</ul>
</details> </details>
<h3>🛌 <a href="https://play.google.com/store/apps/details?id=com.urbandroid.sleep&hl=en_US">sleep as android setup</a></h3> ## changelog
<ol>
<li>open the app and follow setup</li>
<li>settings wheel > services > automation > MQTT</li>
</ol>
<pre> **1.0.0** - rebranded from saas to sleepd, removed next alarm sensor
(tcp/ssl)://(MQTT User):(MQTT Pass)@(HA URL):(port)
</pre>
<ul> **0.2.1** - fixed manifest error, config reconfigure now works
<li>topic: must match config</li>
<li>client id: any unique id</li>
</ul>
<ol start="4"> **0.2.0** - fixed deprecation warnings for HA 2025.12 (breaking: re-add integration after update)
<li>enable automatic tracking</li>
<li>sensor: sonar or accelerometer</li>
<li>wearables > **Xiaomi Mi Band** > test sensor</li>
</ol>
<details> **0.1.0** - fixed wake status timing, sound sensor bugs
<summary><strong>📦 changes</strong></summary>
<b>0.2.2</b>
<ul>
<li>added Next Alarm sensor with alarm label tracking</li>
<li>stores up to ten previous alarms in sensor attributes</li>
</ul>
<b>0.2.1</b>
<ul>
<li>fixed manifest error preventing config setup</li>
<li>fixed fine tuning in the configure section, now changing time or device actually works</li>
</ul>
<b>0.2.0</b> ---
<ul>
<li>added services.yaml to resolve known NoneType error</li>
<li>fixed deprecation warnings for future Home Assistant releases</li>
<li>breaking changes: remove and re-add existing integration entries after update</li>
</ul>
<b>0.1.0</b> *formerly known as [saas](https://github.com/sudoxnym/saas)*
<ul>
<li>fixed wake status timing</li>
<li>bug fixes on sound sensor</li>
<li>accurate updates to alarmevent, disturbance, sound</li>
<li>organized readme</li>
</ul>
<b>0.0.6a</b>
<ul>
<li>initial beta release</li>
<li>added persistent states</li>
<li>alarm event sensor attributes</li>
</ul>
</details>
<details>
<summary><strong>🚨 known issues</strong></summary>
<p>💬 no known issues at this time.</p>
</details>

View file

@ -6,5 +6,5 @@
"dependencies": ["mqtt", "mobile_app"], "dependencies": ["mqtt", "mobile_app"],
"documentation": "https://www.github.com/sudoxnym/sleepd", "documentation": "https://www.github.com/sudoxnym/sleepd",
"issue_tracker": "https://www.github.com/sudoxnym/sleepd/issues", "issue_tracker": "https://www.github.com/sudoxnym/sleepd/issues",
"version": "0.2.1" "version": "1.0.0"
} }