Skip to content

DIY Automation

sameerasw edited this page Aug 9, 2026 · 1 revision

🤖 DIY Automation

DIY (Do It Yourself) lets you build custom automation rules directly in Essentials — no third-party apps required. Combine triggers (events that happen on your device) with actions (things Essentials does in response).


Overview

The DIY system is built around:

  • Rules — a named automation with one trigger and one or more actions
  • Triggers — events that fire the rule (time, app launch, notification, battery state, etc.)
  • Actions — what happens when the trigger fires (toggle a feature, send a notification, run a shell command, etc.)
  • GenAI Assist — optional AI-powered prompt generator to help build rules from natural language descriptions

Creating a Rule

  1. Open Essentials → DIY tab
  2. Tap the + button to create a new rule
  3. Choose a trigger
  4. Add one or more actions
  5. Name the rule and save

Triggers

Trigger Description
App launched Fires when a specific app comes to the foreground
App closed Fires when a specific app leaves the foreground
Time of day Fires at a scheduled time (supports daily/specific days)
Battery level Fires when battery drops below or rises above a threshold
Charging state Fires when device is plugged in or unplugged
Screen on/off Fires when screen state changes
Notification received Fires when a notification arrives from a selected app
Location Fires when entering/leaving a geofenced area
Network change Fires when connecting to or disconnecting from Wi-Fi
Bluetooth connection Fires when a specific BT device connects/disconnects

Actions

Action Description
Toggle feature Enable or disable any Essentials feature
Set sound mode Switch to Normal / Vibrate / Silent
Trigger QS tile Activate a QS tile action
Send notification Show a custom notification
Run shell command Execute an ADB shell command (requires Shizuku/Root)
Launch app Open a specific app
Set system setting Write a value to Secure/System/Global settings
Wait Pause before the next action (delay in seconds)

GenAI Prompt Generator

The GenAI assist feature helps you create automation rules from natural language:

  1. Tap the AI button in the DIY rules editor
  2. Describe what you want in plain English (e.g., "Turn on night light when I open Kindle")
  3. The AI generates a rule suggestion
  4. Review and save the rule

Notes

  • GenAI is powered by GenAIAutomationService and DIYViewModel
  • The generated rules are fully editable before saving

Rule Storage

Rules are stored in SettingsRepository using Gson JSON serialization under the DIY preference key. Each rule contains:

{
  "id": "unique_rule_id",
  "name": "Rule name",
  "enabled": true,
  "trigger": { "type": "APP_LAUNCHED", "packageName": "com.amazon.kindle" },
  "actions": [
    { "type": "TOGGLE_FEATURE", "featureId": "Dynamic night light", "value": true }
  ]
}

Background Execution

Rules are evaluated by EssentialsConditionProvider (a ConditionProviderService) and automation handlers in services/automation/. The condition provider listens for system events and checks if any rules match the current state.

Clone this wiki locally