Integrate Dormi with Tasker, Automate, Home Assistant, and more
Dormi's Automation feature allows seamless integration with third-party automation apps such as Tasker, Automate, and Home Assistant. This enables you to control Dormi's monitoring functionality externally and expose Dormi's state to other apps for advanced automation workflows.
Automation is managed through three new options in the Dormi app settings:
Automation relies on Android Intents and broadcasts. You can send intents to Dormi to control it (via the Control feature) or receive broadcasts from Dormi about its state (via the Expose feature).
Use other apps to control Dormi by sending intents. The available automation actions are:
MONITORING_START: Start monitoring.MONITORING_STOP: Stop monitoring.MONITORING_SNOOZE: Snooze monitoring for 10 minutes (resets the timer if already snoozed).MONITORING_RESUME: Resume monitoring if snoozed.EXPOSE_STATE: Request the current state of monitoring, even if Expose is disabled. Add an extra string key 'target_pkg' to send the broadcast to a specific app (e.g., 'com.llamalab.automate' for Automate, 'net.dinglisch.android.taskerm' for Tasker, 'io.homeassistant.companion.android' for Home Assistant Companion). Set it to 'any' to broadcast system-wide.For actions like MONITORING_STOP, MONITORING_SNOOZE, MONITORING_RESUME, and EXPOSE_STATE:
com.sleekbit.dormi.automation.action.[ACTION_NAME] (e.g., com.sleekbit.dormi.automation.action.MONITORING_STOP).com.sleekbit.dormi to make the intent explicit.secret with the value configured in Dormi settings.tag for debugging (Dormi will show a toast and log it to logcat).com.sleekbit.dormi.automation.Control.If sent as an ordered broadcast, Dormi responds with a result code (Activity.RESULT_OK for success, Activity.RESULT_CANCELED for failure) and a short message.
For privacy and Google Play policy compliance, starting monitoring requires user visibility. Send the intent to the main activity:
com.sleekbit.dormi.automation.action.MONITORING_START.com.sleekbit.dormi.ui.BmActivity.This starts a countdown timer, notifies the user, and allows abortion of the action.
adb shell am broadcast -a com.sleekbit.dormi.automation.action.MONITORING_SNOOZE -n com.sleekbit.dormi/.automation.Control --es secret your_secret --es tag test123
adb shell am broadcast -a com.sleekbit.dormi.automation.action.EXPOSE_STATE -n com.sleekbit.dormi/.automation.Control --es secret your_secret --es target_pkg any --es tag test955
When enabled, Dormi broadcasts events for other apps to consume:
com.sleekbit.dormi.automation.event.MONITORING_STATE_CHANGED: Sent on changes in monitoring state, noise detection, or device mode. Extras: monitoring_state (one of "stopped", "starting", "monitoring", "snoozed", "reconnecting"), device_mode ("child" or "parent"), noise_detected (true/false).com.sleekbit.dormi.automation.event.CRASH: Sent on app crash, no extras.The "reconnecting" state is parent-mode specific, indicating a lost connection where the child device's state is unknown until reestablished.
Step-by-step guide for controlling and exposing Dormi state in Tasker.
com.sleekbit.dormi.automation.action.MONITORING_SNOOZE (replace with desired action).com.sleekbit.dormi.com.sleekbit.dormi.automation.Control (for non-START actions).secret:your_secret.tag:debug_tag.com.sleekbit.dormi.ui.BmActivity instead.Example for EXPOSE_STATE: Add Extra target_pkg:net.dinglisch.android.taskerm to target Tasker specifically.
com.sleekbit.dormi.automation.event.MONITORING_STATE_CHANGED.com.sleekbit.dormi.automation.event.CRASH.Step-by-step guide for Automate (similar to Tasker but with flow-based UI).
com.sleekbit.dormi.automation.action.MONITORING_STOP (replace as needed).com.sleekbit.dormi.com.sleekbit.dormi.automation.Control.secret with value your_secret, and optionally tag.com.sleekbit.dormi.ui.BmActivity.For EXPOSE_STATE, add extra target_pkg:com.llamalab.automate.
com.sleekbit.dormi.automation.event.MONITORING_STATE_CHANGED.Integrate with Home Assistant Companion app on Android for remote control and state exposure.
Use the notify.mobile_app_[your_device] service with message: command_broadcast_intent to send intents remotely.
intent_package_name: com.sleekbit.dormi.intent_class_name: com.sleekbit.dormi.automation.Control (for non-START).intent_action: com.sleekbit.dormi.automation.action.MONITORING_SNOOZE (replace as needed).intent_extras: secret:your_secret,tag:ha_debug.intent_class_name: com.sleekbit.dormi.ui.BmActivity.Example YAML for a button in Lovelace:
type: button
name: Snooze Dormi
tap_action:
action: call-service
service: notify.mobile_app_your_device
data:
message: command_broadcast_intent
data:
intent_package_name: com.sleekbit.dormi
intent_class_name: com.sleekbit.dormi.automation.Control
intent_action: com.sleekbit.dormi.automation.action.MONITORING_SNOOZE
intent_extras: "secret:your_secret,tag:ha_snooze"
Configure the Companion app to receive broadcasts and forward them to the server.
android.intent_received event.Example YAML automation to parse the event and create sensors:
automation:
- alias: Parse Dormi State
trigger:
- platform: event
event_type: android.intent_received
event_data:
action: com.sleekbit.dormi.automation.event.MONITORING_STATE_CHANGED
action:
- service: input_text.set_value
data:
entity_id: input_text.dormi_monitoring_state
value: "{{ trigger.event.data.extra_monitoring_state }}"
sensor:
- platform: template
sensors:
dormi_state:
friendly_name: "Dormi Monitoring State"
value_template: "{{ states('input_text.dormi_monitoring_state') }}"
attribute_templates:
device_mode: "{{ trigger.event.data.extra_device_mode if trigger else 'unknown' }}"
noise_detected: "{{ trigger.event.data.extra_noise_detected if trigger else 'unknown' }}"
binary_sensor:
- platform: template
sensors:
dormi_noise_detected:
friendly_name: "Dormi Noise Detected"
value_template: "{{ trigger.event.data.extra_noise_detected == 'true' if trigger else false }}"
This creates a sensor for monitoring state with attributes, and a binary sensor for noise detection. Adjust entity IDs as needed.