Visual Mapper: Control Android Devices & Create Sensors from Any App UI

Visual Mapper v0.4.0 - Transform Android Devices into HA Sensors & Automation

Hey everyone! I’ve been working on an open-source project that I think could be useful for the community, and I’m looking for testers and contributors to help improve it.

What is Visual Mapper?

Visual Mapper lets you create Home Assistant sensors from any Android app’s UI and automate device interactions - all without modifying the Android app itself. It works by connecting to your Android device via ADB and reading the screen/UI elements.

Example Use Cases:

  • Create a sensor from your EV app showing battery %, range, charging status

  • Monitor your robot vacuum’s status from its Android app

  • Read values from legacy devices that only have Android apps (old thermostats, cameras, etc.)

  • Automate repetitive tasks: “Open app → Navigate to screen → Capture value → Return home”

How It Works

  1. Connect your Android device via WiFi ADB (Android 11+) or USB

  2. Use the visual Flow Wizard to record navigation steps

  3. Select UI elements to capture as sensors

  4. Schedule flows to run periodically (e.g., every 5 minutes)

  5. Sensors auto-publish to HA via MQTT with auto-discovery

Current Features (v0.4.0)

  • :white_check_mark: WiFi ADB connection (Android 11+)

  • :white_check_mark: USB ADB connection

  • :white_check_mark: Screenshot capture & element detection

  • :white_check_mark: Visual Flow Wizard (record & replay)

  • :white_check_mark: Sensor creation from UI elements

  • :white_check_mark: MQTT auto-discovery to Home Assistant

  • :white_check_mark: Scheduled flow execution

  • :white_check_mark: Multi-device support

  • :white_check_mark: Live screen streaming (MJPEG v2)

  • :white_check_mark: Auto-unlock (PIN/passcode)

  • :white_check_mark: Smart screen sleep prevention

  • :white_check_mark: ML Training Server (optional)

  • :white_check_mark: Android Companion App

  • :white_check_mark: Dark mode UI

  • :white_check_mark: NEW Full-width responsive UI

  • :white_check_mark: NEW Mobile/tablet support

Screenshots

Flow Wizard UI

Flow Management

Sensor creation dialog

Dashboard

HA sensors created

Android Companion App

The optional Android companion app provides enhanced automation via Accessibility Service instead of ADB. This gives you reliable, native access to UI elements without ADB connection issues.

Download APK (v0.3.3 - Signed)

Features

Screen Streaming (NEW)

  • :white_check_mark: MediaProjection low-latency capture (50-150ms)

  • :white_check_mark: Adaptive FPS based on battery state

  • :white_check_mark: WebSocket MJPEG binary protocol

  • :white_check_mark: Orientation change handling

Accessibility Service

  • :white_check_mark: UI element capture & interaction

  • :white_check_mark: Gesture dispatch (tap, swipe, scroll)

  • :white_check_mark: Pull-to-refresh automation

  • :white_check_mark: Text input automation

  • :white_check_mark: Screen wake/sleep control

  • :white_check_mark: Key event simulation

Flow Execution

  • :white_check_mark: All step types (TAP, SWIPE, TEXT_INPUT, WAIT, etc.)

  • :white_check_mark: Conditional logic (if element exists, if text matches)

  • :white_check_mark: Screen wake/sleep steps

ML & Navigation

  • :white_check_mark: TensorFlow Lite with NNAPI/GPU acceleration

  • :white_check_mark: Q-Learning exploration with Room persistence

  • :white_check_mark: Dijkstra path planning with reliability weighting

  • :white_check_mark: On-device model inference

Server Integration

  • :white_check_mark: MQTT sensor publishing to Home Assistant

  • :white_check_mark: Bidirectional flow sync with server

  • :white_check_mark: Real-time status updates

Security

  • :white_check_mark: Encrypted storage

  • :white_check_mark: Audit logging

  • :white_check_mark: Privacy controls & app exclusions

When to Use the Companion App

  • Device doesn’t support WiFi ADB reliably

  • Want ML-assisted app exploration (learns optimal paths)

  • Need more reliable UI interaction than ADB provides

  • Want flows to run even when HA server is offline

  • Need Accessibility Service features not available via ADB

ML Training Server

The ML Training Server enables real-time Q-learning from Android exploration data. The Android app explores your apps and learns optimal navigation paths over time.

Deployment Options:

  • Local (in add-on) - Enable in add-on config, ML runs alongside Visual Mapper

  • Remote - Run on a separate machine with GPU/NPU for better training

  • Dev machine - Use included scripts to run ML training with full hardware acceleration

Hardware Acceleration:

  • Coral Edge TPU - USB/M.2/PCIe - Raspberry Pi, Linux servers

  • DirectML (NPU) - Windows ARM/x64 - Windows laptops with NPU

  • CUDA (GPU) - NVIDIA GPUs - High-performance servers

  • CPU - All platforms - Fallback, always available


# Add-on config to enable local ML training

ml_training_mode: "local" # or "remote" or "disabled"

ml_use_dqn: true # Use Deep Q-Network (better learning)

For machines with hardware accelerators:


# Windows with NPU

.\scripts\run_ml_dev.ps1 -Broker 192.168.x.x -DQN -UseNPU

# Linux/Raspberry Pi with Coral Edge TPU

./scripts/run_ml_dev.sh --broker 192.168.x.x --use-coral

# Linux with NVIDIA GPU

./scripts/run_ml_dev.sh --broker 192.168.x.x --dqn

Installation Options

1. Home Assistant Add-on (Recommended)

Add this repository to your HA add-on store:


https://github.com/botts7/visual-mapper-addon

2. Docker (Standalone)


docker run -d --name visual-mapper \

--network host \

-e MQTT_BROKER=your-mqtt-broker \

ghcr.io/botts7/visual-mapper:latest

3. Manual Installation


git clone https://github.com/botts7/visual-mapper.git

cd visual-mapper/backend

pip install -r requirements.txt

python main.py

4. Android Companion App (Optional)

Download from: Releases · botts7/visual-mapper-android · GitHub

Enable “Install from unknown sources” in Android settings to install.

Requirements

  • Android device with Developer Options and Wireless Debugging enabled (Android 11+)

  • Both devices on the same network

  • MQTT broker (Mosquitto) for HA integration

For Companion App:

  • Android 8.0+ (API 26)

  • Accessibility Service permission

  • Optional: Notification access for richer automation

Current State / Known Limitations

This is beta software - it works, but there are rough edges:

  • Samsung devices: Required extra work for lock screen handling (now mostly working)

  • Element detection: Sometimes UI elements move between app updates

  • ADB stability: WiFi connections can drop occasionally (auto-reconnect implemented)

  • Documentation: Still being written

What I’m Looking For

Testers

  • Try it with different Android devices (especially non-Samsung)

  • Test with various Android apps

  • Report bugs and edge cases

  • Suggest UX improvements

  • Test the Android companion app on different devices

Contributors

  • Python/FastAPI backend

  • JavaScript frontend

  • Android/Kotlin development

  • Machine Learning improvements

  • Documentation

  • UI/UX design

Links


Changelog

v0.4.0 (Latest)

  • Full-Width Layout: All pages now use full viewport width with 24px edge padding - no more wasted screen space

  • Mobile Responsive Design: Flows and Navigation Learn pages now work properly on mobile/tablet devices

  • Elements Tab Redesign: Card-based layout matching Smart tab style with type icons, alternative names dropdown, current value display, and collapsible grouped tree structure

  • UI Consistency: All container widths now consistent across dashboard, flows, performance, and flow wizard pages

Android Companion App v0.3.3

  • MediaProjection Screen Streaming: Low-latency capture (50-150ms vs 100-3000ms ADB)

  • Adaptive FPS: 25 FPS when charging, 20/12/5 FPS on battery based on level

  • Battery Caching: Check battery state every 30s instead of every frame

  • Improved Frame Buffer: Increased buffer size for smoother capture

  • MJPEG Protocol v2: Header includes width/height for orientation detection

  • WebSocket MJPEG Protocol: Binary streaming compatible with backend SharedCaptureManager

  • Orientation Handling: Automatically recreates VirtualDisplay when device rotates

v0.3.1

  • Dynamic Cache Busting: All pages now use session-based cache busting - no more stale CSS/JS

  • Dark Mode Everywhere: Dark mode support added to all pages with instant theme switching (no flash)

  • Dev Tools Improvements: Version info now fetched dynamically from API

  • Diagnostic Page: Dynamic CSS and module loading

  • Flow Tab Fix: Fixed button visibility in dark mode

v0.2.97

  • Adaptive Backend Sampling: Fixed monotonic counter vs capped timing lists

  • Async Streaming: stopStreaming() now properly awaited in all callers

  • Capture Mode Fix: setCaptureMode race condition resolved

  • Sensor Edit: Fixed API path for editing sensors

  • Persistent Shell: Now default for UI dumps (faster than per-command subprocess)

v0.2.86

  • Edit Buttons: Added edit button for sensor and action flow steps in Step 3 and Step 4

  • Click pencil icon to edit linked sensor or action directly from flow step

v0.2.80

  • MJPEG v2 Streaming: Shared capture pipeline with single producer per device

  • SharedCaptureManager: Broadcasts to all subscribers, eliminates per-frame ADB handshake overhead

  • New endpoint: /ws/stream-mjpeg-v2/{device_id}

v0.2.66

  • Companion App Integration: Fast UI element fetching (100-300ms vs 1-3s)

  • Canvas Fit Mode: Defaults to fit-height (shows full device screen)

  • Stream Quality: Default changed to ‘fast’ for better WiFi compatibility

v0.2.6

  • Coral Edge TPU: Hardware acceleration support for Raspberry Pi and Linux servers

  • Hardware Accelerators UI: Services page shows available accelerators

  • ML Training Server: Multiple deployment options (local, remote, dev)

2 Likes

I am interested in testing this.

Hey @mohammednafeel, that’s great to hear!

Getting Started:

  1. Add the add-on repo to your HA: GitHub - botts7/visual-mapper-addon: Visual Mapper Home Assistant Add-on
  2. Install “Visual Mapper” from your add-on store
  3. Enable ADB Debugging on your Android device (Developer Options → USB / Wireless Debugging)
  4. Pair the device using the pairing code etc shown in Android

What would be most helpful to test:

  • Different Android devices - I’ve mainly tested on Samsung, so feedback from other brands (Pixel, OnePlus, Xiaomi, etc.) is valuable
  • Different apps - Any apps you’d like to create sensors from
  • Flow reliability - Does the wizard record steps correctly? Do they replay accurately?
  • Connection stability - Does ADB stay connected or drop frequently?

If you run into issues:

  • Check the add-on logs (they’re pretty verbose)
  • Open an issue on GitHub with your device model and Android version
  • Screenshots of any errors are super helpful

Let me know what device you’re planning to test with and what apps you want to automate - happy to help you get set up!

added an interactive helper for setup in latest code, if you want to give that a try

Visual Mapper v0.4.0 Released!

Hey everyone! Just pushed a new release with some nice UI improvements.

What’s New in v0.4.0

UI/UX Improvements:

  • :white_check_mark: Full-Width Layout - All pages now use the full viewport width with 24px edge padding - no more wasted screen space

  • :white_check_mark: Mobile Responsive Design - Flows and Navigation Learn pages now work properly on mobile/tablet devices

  • :white_check_mark: Elements Tab Redesign - Card-based layout matching the Smart tab style with type icons, alternative names dropdown, current value display, and collapsible grouped tree structure

  • :white_check_mark: UI Consistency - All container widths now consistent across dashboard, flows, performance, and flow wizard pages

Android Companion App v0.3.3

Big update to the companion app with native screen streaming:

  • :white_check_mark: MediaProjection Screen Streaming - Low-latency capture (50-150ms vs 100-3000ms with ADB)

  • :white_check_mark: Adaptive FPS - 25 FPS when charging, automatically reduces on battery to save power

  • :white_check_mark: Battery Caching - Checks battery state every 30s instead of every frame for better performance

  • :white_check_mark: MJPEG Protocol v2 - Header now includes width/height for orientation detection

  • :white_check_mark: Orientation Handling - Automatically recreates VirtualDisplay when device rotates

Download Links

How to Update

HA Add-on:

  1. Go to Settings > Add-ons

  2. Click on Visual Mapper

  3. Click Update (or Rebuild if using local build)

Android Companion:

  1. Download the new APK from the link above

  2. Install over the existing app (no need to uninstall)


As always, feedback and bug reports welcome! GitHub · Where software is built