Hello, I would like to announce my latest custom component: ADB Sensor, a simple and flexible integration designed to enhance your Home Assistant setup for those of you using ADB (androidtv integration). If you have an Android TV, Fire TV, or any other ADB-compatible device, this component opens up a world of possibilities for creating better custom sensors tailored to your needs.
What is the ADB Sensor?
The ADB Sensor is a Home Assistant custom component that lets you monitor various aspects of your ADB-compatible devices by running ADB commands and displaying the results as sensor states. Whether you want to track the current app running on your Fire TV, monitor device states, or parse custom data, this integration has you covered.
Key Features
Custom ADB Commands: Create sensors based on any ADB command output.
Integration with
androidtv.adb_command
: Seamlessly works with the existing Home Assistant service for ADB commands.Value Templates: Customize and parse the output to fit your requirements.
Debugging Made Easy: Access raw ADB responses in the sensor attributes.
Example Use Case: Detecting the Current App running on your device
sensor:
- platform: adb_sensor
name: Fire TV Current App
adb_entity_id: media_player.fire_tv_192_168_1_202
adb_command: "dumpsys window | grep mCurrentFocus"
value_template: >
{% for line in value.split('\n') %}
{% if "mCurrentFocus=" in line %}
{{ line.split('=')[-1].split('{')[-1].split('}')[0].split()[-1] }}
{% endif %}
{% endfor %}
The sensor will dynamically update with the name of the currently open app on your Android device.
I hope this can be useful. Thank you!