This guide explains how to test the AndrOBD Home Assistant plugin without connecting to a real vehicle or OBD-II adapter.
There are several options for testing AndrOBD plugins without a physical OBD device:
- AndrOBD Built-in Demo Mode (Recommended - Easiest)
- ELM327-emulator (Python-based)
- ECU Engine Sim (Android App)
- Hardware Emulators (Most realistic but requires purchase)
AndrOBD has a built-in demo mode that simulates live OBD data without requiring any external setup.
-
Install AndrOBD
-
Install the Home Assistant Plugin
- Build the plugin:
./gradlew assembleDebug - Install the APK:
adb install -r src/build/outputs/apk/debug/AndrOBD-Plugin-Home-Assistant-debug.apk
- Build the plugin:
-
Enable Demo Mode in AndrOBD
- Open AndrOBD
- Go to Settings
- Look for Demo mode or Simulation mode
- Enable it
-
Configure the Plugin
- Open the AndrOBD Home Assistant plugin app
- Configure your Home Assistant URL and bearer token
- Set transmission mode to "Real-time" for testing
-
Enable Plugin in AndrOBD
- Open AndrOBD
- Go to Settings → Plugin extensions
- Find and enable Home Assistant Publisher plugin
- The plugin should now receive simulated OBD data from AndrOBD's demo mode
-
Verify Data Transmission
- In Home Assistant, go to Developer Tools → States
- Search for
sensor.androbd_entities - You should see sensors being created with simulated data
- No additional software needed
- Works entirely on the Android device
- Perfect for quick testing and development
- Most straightforward setup
The ELM327-emulator is a Python tool that emulates an ELM327 OBD-II adapter.
- Python 3.x installed on your computer
- Android device with Bluetooth or WiFi connectivity
- AndrOBD installed on Android device
pip install ELM327-emulator- Start the emulator on your computer:
elm -n -s carThis starts the emulator listening on TCP port 35000.
-
Find your computer's IP address:
- Linux/Mac:
ifconfigorip addr - Windows:
ipconfig
- Linux/Mac:
-
In AndrOBD on your Android device:
- Go to Settings → Connection
- Select Network (WiFi/LAN)
- Enter your computer's IP address and port 35000
- Connect
- Set up Bluetooth serial port on your computer
- Start the emulator with Bluetooth:
elm -s car --device /dev/rfcomm0Replace /dev/rfcomm0 with your Bluetooth serial port.
- Pair your Android device with your computer
- In AndrOBD, connect via Bluetooth
Custom ECU Simulation:
# Simulate specific vehicle responses
elm -s car --plugin my_vehicle.pyMulti-ECU Simulation:
elm -s multi_ecuError Injection:
# Inject specific DTCs or errors for testing error handling
elm -s fault_injection- Highly configurable
- Supports multiple ECU simulation
- Can inject faults and edge cases
- Works over network (WiFi) or Bluetooth
- Good for testing error handling
ECU Engine Sim turns one Android device into an OBD-II adapter emulator that another Android device can connect to.
-
Install on First Android Device (Emulator):
- Download ECU Engine Sim from Google Play
- This device will act as the "vehicle"
-
Configure ECU Engine Sim:
- Open ECU Engine Sim
- Enable Bluetooth
- Configure simulated sensors and values
- Start broadcasting
-
Connect from Second Device (AndrOBD):
- Install AndrOBD on your second Android device
- Pair with the first device via Bluetooth
- Connect to the simulated OBD adapter
- The Home Assistant plugin should receive the simulated data
- No computer required
- Tests actual Bluetooth communication path
- More realistic than demo mode
- Can simulate specific sensor values
- Requires two Android devices
- Free version has limitations
- Less flexible than Python emulator
For production-grade testing, consider hardware emulators:
- Type: Hardware device
- Features: Emulates full OBD-II port including physical layer
- Use case: Professional testing, timing-sensitive tests
- Cost: ~$30-50 USD
- Link: Freematics Store
- Most realistic testing environment
- Tests all layers including physical
- Can simulate voltage levels and timing
- Professional quality
- Requires purchase
- Overkill for software-only testing
Regardless of which emulation method you choose, follow these steps to test the plugin:
First, ensure the plugin appears in AndrOBD:
- Open AndrOBD
- Go to Settings → Plugin extensions or Plugin Manager
- Look for Home Assistant or Home Assistant Publisher in the list
- If not visible, check:
- Plugin APK is installed (
adb shell pm list packages | grep homeassistant) - Plugin manifest has correct intent filter
- AndrOBD is updated to latest version
- Plugin APK is installed (
- Open the AndrOBD Home Assistant standalone app
- Configure:
- Enable Home Assistant: Check this
- Home Assistant URL: Your HA instance URL (e.g.,
https://homeassistant.local:8123) - Bearer Token: Long-lived access token from Home Assistant
- Transmission Mode: Use "Real-time" for testing
- Update Interval: 5000ms (5 seconds) is good for testing
- Start Emulator (if using external emulator)
- Connect AndrOBD to the emulator or enable demo mode
- Start Data Collection in AndrOBD
- Monitor Plugin Logs:
adb logcat | grep HomeAssistant - Check Home Assistant:
- Go to Developer Tools → States
- Search for
sensor.androbd_ - Verify sensors are being created and updated
Test these scenarios to ensure robust operation:
Scenario 1: Real-time Mode
- Set transmission mode to "Real-time"
- Ensure data flows continuously while connected
Scenario 2: SSID Connected Mode
- Set transmission mode to "SSID Connected"
- Configure your WiFi SSID
- Verify data is only sent when connected to specified WiFi
Scenario 3: Network Failures
- Temporarily disconnect from WiFi/network
- Verify plugin buffers data
- Reconnect and verify buffered data is sent
Scenario 4: Invalid Credentials
- Use an invalid bearer token
- Check that errors are logged properly
- Verify plugin handles auth failures gracefully
Check Plugin is Running:
adb shell dumpsys activity services | grep -i homeassistantView Plugin Logs:
adb logcat | grep -E "HomeAssistant|androbd\.plugin"Check if Plugin Responds to IDENTIFY:
adb logcat | grep IDENTIFYView All OBD Data:
adb logcat | grep -i "obd\|elm327"Possible causes:
- Plugin APK not installed
- AndrOBD version too old
- Android 11+ package visibility restrictions
- Incorrect manifest configuration
Solutions:
- Verify installation:
adb shell pm list packages | grep homeassistant - Update AndrOBD to latest version
- Check manifest has correct intent filter with
android:exported="true" - Try uninstalling and reinstalling both AndrOBD and plugin
Possible causes:
- Plugin not properly enabled in AndrOBD
- Demo mode not working
- Emulator not connected
Solutions:
- Check plugin is enabled in AndrOBD settings
- Restart AndrOBD after enabling plugin
- Check emulator connectivity
- View logs:
adb logcat | grep HomeAssistant
Possible causes:
- Incorrect Home Assistant URL
- Invalid bearer token
- Network connectivity issues
- HTTPS certificate problems
Solutions:
- Test HA URL in browser from Android device
- Regenerate bearer token in Home Assistant
- Check network connectivity
- For self-signed certificates, install CA cert on device
- Temporarily use HTTP localhost for testing
Here's a complete testing session using AndrOBD demo mode:
# 1. Install apps
adb install -r AndrOBD-v2.x.x.apk
adb install -r AndrOBD-Plugin-Home-Assistant-debug.apk
# 2. Configure and start logging
adb logcat -c # Clear logs
adb logcat | grep -E "HomeAssistant|IDENTIFY|Plugin" > plugin-test.log &
# 3. Open apps and configure
# (Do this manually on device)
# - Open AndrOBD, enable demo mode
# - Open HA Plugin, configure URL and token
# - In AndrOBD, enable HA plugin
# 4. Wait 30 seconds for data to flow
# 5. Check results
# - View plugin-test.log for activity
# - Check Home Assistant for sensors
# - Verify data is updating
# 6. Stop logging
kill %1 # Stop logcat background jobFor automated testing without OBD hardware:
- Use AndrOBD Demo Mode in automated tests
- Mock Home Assistant Server using test HTTP server
- Verify Plugin Behavior by checking HTTP requests
- Test Error Handling by simulating failures
Example test structure:
tests/
├── mock-homeassistant-server.py # Fake HA server
├── test-plugin-discovery.sh # Verify plugin appears
├── test-data-flow.sh # Verify data transmission
└── test-error-handling.sh # Test failure scenarios
- AndrOBD: https://github.com/fr3ts0n/AndrOBD
- AndrOBD Plugin Framework: https://github.com/fr3ts0n/AndrOBD-libplugin
- ELM327 Command Reference: https://www.elmelectronics.com/wp-content/uploads/2017/01/ELM327DS.pdf
- Home Assistant REST API: https://developers.home-assistant.io/docs/api/rest/
- AndrOBD Telegram Group: https://t.me/joinchat/G60ltQv5CCEQ94BZ5yWQbg
If you develop improvements to the testing process or find new emulation tools, please contribute:
- Fork the repository
- Add your documentation or scripts
- Submit a pull request
For issues or questions:
- GitHub Issues: https://github.com/ian-morgan99/AndrOBD-Plugin-Home-Assistant/issues
- AndrOBD Community: https://t.me/joinchat/G60ltQv5CCEQ94BZ5yWQbg