Add to HACS

๐ŸŒ™ 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.

โœ… Known working:

๐Ÿงฑ This integration will create:

๐Ÿ“ก Sensors

This should intelligently and dynamically allow for state changes in the Wake Status Sensor.

๐ŸŽ›๏ธ Buttons

๐Ÿ› ๏ธ Service

service: saas.saas_example_alarm_set
data:
  message: Example Message!
  day: monday
  hour: 7
  minute: 30

๐Ÿงช Installation:

โš™๏ธ Configuration:

๐Ÿ“ฒ Set Up Notify for Mi Band 7
  1. Pair MiBand 7 as you normally would with Mi Fitness
  2. 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

  1. Uninstall Mi Fitness
  2. Download/Install Notify for Mi Band
  3. Follow prompts, input auth key, select Mi Fitness is not installed
  4. 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;"

๐Ÿ›Œ Sleep as Android Setup

  1. Open the app and follow setup
  2. Settings wheel > Services > Automation > MQTT
(tcp/ssl)://(MQTT User):(MQTT Pass)@(HA URL):(port)
  1. Enable automatic tracking
  2. Sensor: Sonar or Accelerometer
  3. Wearables > Xiaomi Mi Band > Test sensor

๐Ÿ“ฆ Changes:

0.0.6a 0.1.0

๐Ÿšจ 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.