mirror of
https://github.com/sudoxnym/sleepd.git
synced 2026-04-14 03:26:53 +00:00
No description
|
|
||
|---|---|---|
| .github | ||
| brands | ||
| custom_components/saas | ||
| .gitignore | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| DEPLOY.md | ||
| hacs.json | ||
| LICENSE | ||
| README.md | ||
🌙 SAAS - Sleep As Android Status
📖 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.
💡 This integration works best with a Xioami MiBand (7 or older) mixed with the Notify app and Sleep As Android configured.
🧱 This integration will create:
-
📡 8 Sensors
- Message Received *State
- Wake Status
- Sound
- Disturbance
- Alarm
- Lullaby
- Sleep Tracking
- Sleep Stage
This should intelligently and dynamically allow for state changes in the Wake Status Sensor.
-
🎛️ 8 Buttons
- Alarm Dismiss
- Alarm Snooze
- Lullaby Stop
- Sleep Tracking Pause
- Sleep Tracking Resume
- Sleep Tracking Start
- Sleep Tracking Start with Optimal Alarm
- Sleep Tracking Stop
-
🛠️ 1 Service
service: saas.saas_example_alarm_set data: message: Example Message! day: monday hour: 7 minute: 30 -
🔗 1 Device per user
One HA device is created per configured user instance to link sensors, services, and buttons.
✅ Known working
- 📟 Xioami Mi Band 7
- 📟 Xioami Mi Band 8 and 9 may work, but they have a different OS that jumps through hoops to work.
- ⌚ Garmin Fenix 7X with Garmin Alternative, NOT the free one.
- ⌚ Xioami Amazfit GTR Mini — 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.
🧪 Installation:
- Add https://www.github.com/sudoxnym/saas to your Custom Repositories in HACS
- Search and Download SAAS - Sleep As Android Status
- Restart Home Assistant
-
- Add Integration: SAAS - Sleep As Android Status
⚙️ Configuration:
- Name: Name of user
- Topic: MQTT Topic from Sleep As Android
- QoS: Quality of Service
- Awake Duration: Time in seconds in which awake states = true to indicate awake.
Sensor usually updates within 30 seconds or so after the duration, not entirely sure why the delay.FIXED - Asleep Duration: Time in seconds in which sleep states = true to indicate asleep.
Sensor usually updates within 30 seconds or so after the duration, not entirely sure why the delay.FIXED - Awake States: States to indicate being awake
- Asleep States: States to indicate being asleep
- Mobile App: Target for buttons REQUIRES COMPANION APP
📲 Set Up Notify for Mi Band 7
- Pair MiBand 7 as you normally would with Mi Fitness
- Obtain auth key for Notify app using ADB
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
- 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
🔐 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.com
🛌 Sleep as Android Setup
- 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
📦 Changes
0.0.6a- Initial Beta Release
- Added persistent states
- Alarm Event sensor attributes
0.1.0
- Fixed Wake Status Timing
- Bug fixes on Sound sensor
- Accurate updates to AlarmEvent, Disturbance, Sound
- Organized README
🚨 Known Issues
Logger: homeassistant.helpers.service Source: /usr/src/homeassistant/homeassistant/helpers/service.py:708 Failed to load integration: saas NoneType: None
💬 No known effects. Just an error message, everything works as expected.
This is my first integration.