Unlocking Advanced Automation with Home Assistant Companion App Sensors
- #automation

Unlocking Advanced Automation with Home Assistant Companion App Sensors
The Home Assistant Companion App is more than just a way to access your Home Assistant dashboard on the go. Installed on your Android or iOS device, it transforms your smartphone or tablet into a powerful data source for your smart home, exposing a wealth of sensors that provide real-time information about the device itself, its environment, and your interaction with it. While basic device tracking tells Home Assistant whether you're home or away, these additional sensors unlock a new dimension of context and personalization for your automations.
Beyond Basic Presence: Why Companion App Sensors Matter
Traditional presence detection in Home Assistant often relies on Wi-Fi connectivity, router tracking, or basic GPS. While useful, these methods can be slow, unreliable, or lack detail. The Companion App sensors offer granular data:
- Battery Status: Know the exact percentage, charging state, and even charging method (AC, USB, Wireless).
- Location and Activity: More precise GPS, geofences, and accelerometer data to detect movement or activity state (walking, cycling).
- Connectivity: Wi-Fi SSID, BSSID, IP address, cellular state, and even Bluetooth connection info.
- Device State: Screen on/off, ringer mode, battery saver state, storage info.
- Health and Wellness: Steps taken, distance covered (requires permissions).
- Notifications: Sensor for the last notification received.
Leveraging this data allows your smart home to react not just to *if* you are home, but *how* you are using your devices, their current state, and even your physical activity, leading to truly intelligent and proactive automations.
Setting Up Companion App Sensors
If you're already using the Companion App, you likely have many of these sensors enabled by default. If not, the setup is straightforward:
- Download and Install: Get the official Home Assistant app from the Google Play Store or Apple App Store.
- Connect to Home Assistant: Open the app and connect to your Home Assistant instance. This typically involves entering your instance URL or relying on auto-discovery. Log in with your Home Assistant user credentials.
- Grant Permissions: The app will request various permissions (location, physical activity, battery optimization). Granting relevant permissions is crucial for enabling specific sensors. You can manage these later in your phone's settings or the app's settings within Home Assistant.
- Explore Sensors: Once connected, the app registers your device and its available sensors with Home Assistant. Navigate to 'Settings' -> 'Devices & Services' -> 'Devices'. Find your mobile device listed. Clicking on it will show all the entities (sensors, device trackers, etc.) exposed by the app for that device.
- Configure Sensors (Optional): Within the Companion App on your phone, you can access 'App Configuration' -> 'Manage Sensors'. Here you can enable/disable specific sensors, adjust reporting settings (e.g., background location updates), and troubleshoot.
Integrating Sensors into Automations
Each enabled sensor appears as a standard Home Assistant entity. You can find its entity ID (e.g., sensor.your_phone_battery_level
, sensor.your_phone_wifi_connection
, sensor.your_phone_steps
) and use it in triggers, conditions, and actions just like any other sensor.
Automation Examples:
Here are a few ideas demonstrating the power of these sensors:
1. Battery Level Low Warning:
automation:
- alias: Notify when Phone Battery is Low
description: Send a persistent notification when phone battery drops below 15%
trigger:
- platform: numeric_state
entity_id: sensor.your_phone_battery_level
below: 15
condition:
- condition: state
entity_id: sensor.your_phone_is_charging
state: 'off'
action:
- service: persistent_notification.create
data:
title: "Battery Low!"
message: "Your phone battery is at {{ states('sensor.your_phone_battery_level') }}%. Time to charge!"
notification_id: phone_battery_low
mode: single
2. Automate Based on Wi-Fi Connection:
Trigger specific actions when connecting to your home Wi-Fi vs. leaving it. This can be faster than GPS for detecting arrival/departure.
automation:
- alias: Welcome Home based on WiFi
description: Turn on lights and unlock door when connecting to home WiFi
trigger:
- platform: state
entity_id: sensor.your_phone_wifi_connection
to: 'YOUR_HOME_SSID'
condition:
- condition: state
entity_id: device_tracker.your_phone_tracker
state: 'not_home'
action:
- service: light.turn_on
entity_id: light.entryway
- service: lock.unlock
entity_id: lock.front_door
mode: single
(Replace YOUR_HOME_SSID
with your actual Wi-Fi network name)
3. Pause Media When Phone Rings:
automation:
- alias: Pause Media on Phone Call
description: Pause playing media (e.g., on a media player) when phone ringer is not silent or vibrate
trigger:
- platform: state
entity_id: sensor.your_phone_ringer_mode
from: 'silent'
- platform: state
entity_id: sensor.your_phone_ringer_mode
from: 'vibrate'
condition:
- condition: state
entity_id: media_player.your_speaker
state: 'playing'
action:
- service: media_player.media_pause
entity_id: media_player.your_speaker
mode: single
(Replace media_player.your_speaker
with the entity ID of your media player)
4. Log Daily Steps:
Use the 'Steps Sensor' to track your daily activity within Home Assistant's history and dashboards.
template:
- sensor:
- name: "My Daily Steps"
unique_id: my_daily_steps_sensor
state:
"{{ states('sensor.your_phone_steps') | int(0) }}"
unit_of_measurement: "steps"
icon: mdi:walk
# You might also set up an automation to reset this daily or use utility_meter for tracking
(Ensure the steps sensor is enabled and permissions granted on your phone)
Best Practices for Reliability and Privacy
- Understand Permissions: Each sensor requires specific phone permissions. Review these requests carefully during setup and in your phone's settings. Explain to other household members why these permissions are needed if they install the app.
- Battery Optimization: Modern OS's aggressively optimize battery. Ensure the Home Assistant app is excluded from battery optimization for reliable background sensor updates, especially location. The app settings often guide you on this.
- Limit Enabled Sensors: Only enable the sensors you actually plan to use. This reduces Home Assistant's processing load and can potentially save a tiny amount of battery on your phone.
- Be Mindful of Data: Sensors like location, activity, and network info are sensitive. Be aware of what data you are collecting and how it's being used or stored within Home Assistant. Secure your Home Assistant instance appropriately.
- Use Templates for Data Extraction: Some sensors provide complex state attributes (e.g., connection details). Use Jinja2 templates in automations or template sensors to extract the specific piece of information you need (like the SSID from the Wi-Fi connection sensor).
- Combine Sensors for Robust Logic: For critical automations like arrival detection, don't rely on just one sensor. Combine GPS/Geofence location with Wi-Fi SSID state for a more reliable 'home' status.
- Review Sensor Updates: Periodically check the Home Assistant documentation or app release notes. New sensor types are added, and existing ones might be improved or changed.
Conclusion
The Home Assistant Companion App sensors provide an incredibly rich and accessible source of data for building sophisticated and personalized smart home automations. By moving beyond simple presence detection and leveraging information about your device's state, connectivity, and even your physical activity, you can create a truly responsive and intelligent living environment. Invest some time exploring the sensors available from your devices; you might find the perfect trigger or condition for your next killer automation!

NGC 224
Author bio: