Skip to content

feat: add wifi bluetooth automation trigger - #665

Merged
sameerasw merged 2 commits into
sameerasw:developfrom
thomasborgogno:feature/wifi-bluetooth-automation-trigger
Aug 2, 2026
Merged

feat: add wifi bluetooth automation trigger#665
sameerasw merged 2 commits into
sameerasw:developfrom
thomasborgogno:feature/wifi-bluetooth-automation-trigger

Conversation

@thomasborgogno

Copy link
Copy Markdown
Contributor

Summary

Adds two new automation trigger types: Bluetooth device connected/disconnected and Wi-Fi network connected/disconnected. Users can now build automations that fire an action when the phone connects to (or disconnects from) a specific paired Bluetooth device or a specific Wi-Fi network — the same way existing triggers like Charger Connected or Schedule work today.

What's new

  • Trigger.kt: 4 new sealed subtypes — BluetoothConnected/BluetoothDisconnected (device address + name) and WifiConnected/WifiDisconnected (SSID), all configurable via a settings sheet like Trigger.Schedule.
  • BluetoothModule (new): dynamic BroadcastReceiver on ACTION_ACL_CONNECTED/ACTION_ACL_DISCONNECTED, filtered by MAC address.
  • WifiModule (new): ConnectivityManager.NetworkCallback on the Wi-Fi transport, resolving the active SSID via WifiManager and firing on connect/lost.
  • AutomationManager: wires both modules into the existing module lifecycle (same pattern as Power/Display/Time modules).
  • Editor UI: two new trigger entries in AutomationEditorActivity, each configurable through a bottom sheet:
    • BluetoothDeviceSelectionSheet — pick from the phone's paired devices (requests BLUETOOTH_CONNECT on Android 12+).
    • WifiNetworkSelectionSheet — if the app has Shizuku (or root) authorized, it runs cmd wifi list-networks under shell privileges and lets the user pick straight from the device's saved networks; otherwise it falls back to manual SSID entry with a "Use Current Network" helper (requests ACCESS_FINE_LOCATION, needed by Android to read the current SSID).
  • Manifest: added ACCESS_WIFI_STATE (the Bluetooth/location permissions needed were already present).

Why

Requested enhancement to make automations react to connectivity context (e.g. "turn on Wi-Fi calling when connected to home network", "mute when a specific headset disconnects") without needing a schedule or manual toggle.

Test plan

  • Create a Trigger automation on "Bluetooth Device Connected"/"Disconnected" for a paired device and verify the linked action fires on connect/disconnect.
  • Create a Trigger automation on "Wi-Fi Network Connected"/"Disconnected".
  • Verify triggers still fire correctly after the app/service is killed and restarted (foreground service reattachment).

@thomasborgogno
thomasborgogno changed the base branch from main to develop July 30, 2026 09:35
@thomasborgogno
thomasborgogno force-pushed the feature/wifi-bluetooth-automation-trigger branch from a23bebc to 96c7f7f Compare July 30, 2026 15:13
@sameerasw

Copy link
Copy Markdown
Owner

Thanks for your contributions <3

@sameerasw
sameerasw merged commit 5f0e315 into sameerasw:develop Aug 2, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Essentials Progress Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants