Sleep As Android custom integration

This integration will allow you to get events from your SleepAsAndroid application in a form of the sensor states and events in Home assistant.

Installation & configuration


You will need:

  • configured MQTT server in configuration.yaml like

      broker: mqtt.myserver
      port: 1883
      username: ha_husr
      discovery: true 
  • Sleep As android with MQTT support (currently beta version)

    • go to Settings -> Services -> Automatization -> MQTT
    • enable and configure MQTT
  • Home Assistant v2021.7


  • go to HACS->Integrations->three dots at upper-right conner->Custom repositories
  • add IATkachenko/HA-SleepAsAndroid to ADD CUSTOM REPOSITORY field and select Integration in CATEGORY
  • click add button
  • find Sleep As Andorid integration;
  • click Install (Home assistant restart may be required);


Component configuration

  • Name: name of the device/sensor and a prefix for the events. Will be used as a default prefix for devices and events.
  • Root Topic: MQTT topic where Sleep as Android will create subtopic for the event publishing. Every subtopic will be a unique device in Home Assistant.
  • QOS: quality of service for MQTT

Application configuration

To configure Sleep As Android for working with this integration:

  1. Go to application settings
  2. Find Services in integration section
  3. Go to Automation
  4. Find MQTT section


  • Enable it
  • URL is a URL for your MQTT server. It should look like tpc:///mqtt_user:[email protected]_host:mqtt_port
  • Topic is a topic name where the application will publish events. MUST be a subtopic in Root topic from integration settings. Topic name will be used as a suffix for the default device name in HomeAssistant.
    • For example, if your root topic is SleepAsAndroid, a valid subtopic would be SleepAsAndroid/username.
  • Client ID is any ID. It is not used by integration and is not published to MQTT (now).


More details in Wiki.


<name> is an integration name in lower case without spaces from the Settings dialog. List of events is available at Sleep As Android documentation page

on device event (recommended)

  1. select Device in automatization trigger and use SleepAsAndroid device;
  2. select trigger from a list.

on sensor state change

State of sensor sensor.<name> will contain the recent event name, that got published by the application.

on event

If application publishes a new event, then integration fires <name> event with payload:

  "event": "<event_name_from_application>"



  default: warning
    custom_components.sleep_as_android: debug