Researched from Home Assistant, Companion app, Apple, and Google documentation, checked October 10, 2026. This is a proposed configuration walkthrough, not a Tara hardware or battery-lifespan test. The cover is an illustrative generated image.

1. Choose a native limit or a charger cutoff

A Home Assistant phone charging automation can turn off the outlet feeding your charger after it receives the target battery percentage. For a phone you carry every day, first look for a charge-limit setting on the phone itself. Use that setting when available; it removes several connections that could fail or report late.

For an older phone without that option, a dedicated smart plug and the Home Assistant Companion app can provide an approximate cutoff. Start with a simple rule: you turn charging on, and Home Assistant turns it off when the reported level reaches 80%. You can change that example target to suit your needs. This guide does not claim that 80% is the right limit for everyone.

Do not add a second rule that turns the plug on whenever the phone says “not charging.” Switching the plug off causes that state too, which can make the two rules fight.

  • iPhone 15 and later: Apple documents charge-limit choices from 80% to 100% under Settings → Battery → Charging. On older iPhones, Optimized Battery Charging delays some charging but still aims to finish at 100%; it is not a permanent 80% cap. See Apple’s charging options.
  • Pixel 6a and later: Google documents a Limit to 80% option under Battery → Battery health → Charging optimization. Follow the menus on your installed software; older releases may arrange them differently. See Pixel charging optimization.
  • Other phones: check the manufacturer’s instructions for your exact model and software. A setting that delays a full charge is different from one that limits the charge level.

Apple and Google both describe intentional full charges to maintain battery estimates, even with a lower limit selected. If you use a native limit, let the phone manage that behavior rather than adding a competing Home Assistant cutoff. Neither route supports a promised percentage improvement in battery lifespan here.

2. Check the phone reading and the dedicated plug

You need an existing Home Assistant installation, the official Companion app connected to it, and a plug already controllable in Home Assistant. The plug must feed only this phone’s charger, not a shared charging station or other equipment. Use the phone manufacturer’s charging equipment guidance and keep normal device protections enabled.

An entity is Home Assistant’s named reading or control, such as a battery percentage or an outlet switch. Find the phone’s battery-level entity and the plug’s switch entity in their settings or Developer tools → States. Record the actual IDs; the examples below do not know your device names.

For a routine that works without internet, the phone must reach Home Assistant locally and the plug’s integration must support local control. A smart plug appearing in Home Assistant does not prove it is cloud-independent. If you need a plug, use the separate Home Assistant smart-plug comparison to check the connection path.

The Companion sensor documentation distinguishes the reporting behavior:

  • Android: check Settings → Companion App → Manage Sensors for Battery level. Fast While Charging, under Sensor Update Frequency, requests minute-based periodic updates while charging; restart the app after changing it. Battery sensors can also update on other events. Delivery is not guaranteed.
  • iPhone: enable Battery Level in Companion App Settings → Sensors if needed. Background updates depend on iOS; opening the app or pulling to refresh can update the reading. Do not assume a locked phone reports each percentage promptly.

Before automating, compare the Home Assistant reading with the phone during a normal charge, including while the screen is locked. If the reading gets stuck, resolve reporting first or use manual charging. A displayed number is not proof of a fresh report.

3. Build a harmless rehearsal with helpers

A helper is a stored value or control you create inside Home Assistant. Here, a number stands in for the battery and a toggle stands in for the charger. Neither operates hardware.

  1. Open Settings → Devices & services → Helpers → Create helper. Create a Number named “Charge test battery,” with minimum 0, maximum 100, and step 1. Set it to 50.
  2. Create a Toggle named “Charge test plug.” Leave it off initially.
  3. Create another Toggle named “Phone charge limit.” This will be the real on/off control for the cutoff rule. Turn it on.
  4. Check that their entity IDs match the three IDs below. If Home Assistant assigned different IDs, replace every occurrence in the example.
  5. Create a new empty automation under Settings → Automations & scenes. Open its menu, choose Edit in YAML, replace the editor contents with this whole block, and save. YAML is the text form of the automation settings; indentation matters.

This version controls only the pretend charger. The Number and Toggle helper documentation covers their setup and actions.

On a phone, scroll the code sideways. Copy the whole block when creating the automation.

alias: Phone charge cutoff - rehearsal
triggers:
  - trigger: state
    entity_id:
      - input_number.charge_test_battery
      - input_boolean.charge_test_plug
      - input_boolean.phone_charge_limit
  - trigger: homeassistant
    event: start
  - trigger: time_pattern
    minutes: "/5"
conditions:
  - condition: state
    entity_id: input_boolean.phone_charge_limit
    state: "on"
  - condition: state
    entity_id: input_boolean.charge_test_plug
    state: "on"
  - condition: template
    value_template: >-
      {% set level = states('input_number.charge_test_battery') | float(-1) %}
      {{ 80 <= level <= 100 }}
actions:
  - action: input_boolean.turn_off
    target:
      entity_id: input_boolean.charge_test_plug
mode: single

The rule checks after a listed value changes, when Home Assistant starts, and every five minutes. That last check can catch a value already above the target after the automation was saved or reloaded. It does not request a fresh reading from the phone. The short template accepts a reported level from 80 through 100; missing or nonnumeric values become −1 and cannot pass.

Watching changes and then checking the current number avoids relying on a single threshold crossing. A numeric-state trigger alone can miss a phone that was already above its threshold when the automation became active. These behaviors are described in the automation trigger documentation.

4. Check these expected results

Change the helpers themselves using their controls. Do not use the automation’s Run actions command for this test: it skips the normal triggers and conditions. Open the automation’s Traces afterward to see the path it took, following Home Assistant’s troubleshooting instructions.

On a small screen, scroll the table sideways.

Set up the testExpected resultWhat it checks
Limit on; battery 79; turn the test plug onThe test plug stays onA below-target value does not stop charging
With that plug on, change battery to 80The test plug turns offThe target includes exactly 80, not just values above it
Leave battery at 80; turn the test plug on againIt turns off againStarting above the target is checked too
Turn the limit off; turn the test plug on at 80The test plug stays onThe override allows charging
Turn the limit back on, with battery still 80The test plug turns offRe-enabling the rule checks the current level
Lower battery to 50 after a cutoffThe test plug stays offA falling battery does not start the next charge automatically

These are expected outcomes from the example’s logic, not measured device response times. If they do not match, inspect the entity IDs, helper values, automation’s enabled state, and trace before connecting the real plug.

5. Connect the checked rule to your charger

Disable the rehearsal automation while you edit it. Replace all occurrences of the following, then rename it “Phone charge cutoff.” Leave input_boolean.phone_charge_limit as the visible enable/override control.

  • input_number.charge_test_battery → your phone’s actual battery-level sensor, for example sensor.my_phone_battery_level.
  • input_boolean.charge_test_plug → your dedicated plug’s actual switch, for example switch.phone_charger.
  • action: input_boolean.turn_off → action: switch.turn_off.

Save, check the replacements, and enable the automation. The switch action now asks the plug to cut power. It does not command the phone’s internal charging controller, and an accepted command alone is not proof that the outlet switched.

For the first real check, use a phone below the target, confirm the displayed battery reading is current, and turn on the dedicated charger plug. Watch a normal charging session: after a qualifying report, check both the outlet’s reported state and that the phone stops receiving charge. Do not repeatedly drain and recharge the phone to test the rule; use the helper rehearsal for repeat checks.

If you choose another target, replace 80 in the template, keep the upper bound of 100, and repeat the helper checks around your chosen number. The scheduled check is a retry opportunity, not a guarantee when the phone, network, server, or plug is offline.

6. Make the next charge and override obvious

Put the plug control and “Phone charge limit” toggle together on your dashboard. Label the plug clearly so another household member knows which charger it supplies.

  1. For an ordinary charge: leave the limit on, connect the phone, and turn the plug on using its physical button or Home Assistant. A current reading at or above the target will switch it off again.
  2. For a full charge before travel: turn the limit toggle off first, then turn the charger plug on. Any native phone limit still applies independently.
  3. Afterward: turn the limit back on when you want the cutoff again. It stays off until you deliberately re-enable it; this example has no automatic override expiry.

A cutoff leaves the outlet off. Waiting until the battery drops below 20% would not help someone who plugs in at 45% before a busy day. This example therefore gives the household an explicit start step rather than adding an automatic low-battery restart.

If you later add automatic charging windows, keep this manual route and decide which rule wins. The separate manual override guide explains how to make that handoff predictable.

When the result is different

What you seeFirst checkUseful next step
Phone passes 80% but the plug stays onCompare the phone screen with the reported level in Home AssistantIf the report is late, fix reporting or use a native limit. Faster automation checks cannot repair stale data.
A low phone makes the plug turn off immediatelyLook for an old high reading or the wrong phone’s sensorRefresh and confirm the right sensor. For manual charging now, disable the limit before turning the plug on.
The reading is Unknown or UnavailableCheck the app’s connection and sensor settingThe example leaves the plug as it is. Use ordinary charging while you repair the connection.
A trace reaches Turn off, but charging continuesCheck the selected outlet, physical plug and reported switch stateVerify that exact plug’s control and integration before relying on the routine.
The next evening’s charge never beginsCheck whether the plug is still off from the last cutoffTurn it on deliberately. This is an off-only automation.
The server is downCheck the plug’s actual stateThe routine cannot act. Use the physical control or normal charger connection; do not assume an automatic cutoff occurred.

Other practical questions

Can Home Assistant enforce an exact 80% limit?

No. This plug-based example acts on received battery reports. Delays can let the phone charge higher; stale high readings can stop it too soon. Use the phone’s own supported limit when available.

Does a smart plug prevent battery damage?

This automation is not a safety system or a substitute for the phone’s protections and manufacturer charging instructions. It cannot promise battery lifespan, detect every charging problem, or act while its control path is unavailable.

Can I use this for a permanently mounted tablet?

The same reporting and switching limits apply, but an off-only routine will not keep an unattended tablet charged indefinitely. Start with native charging controls and the separate wall-tablet setup guide. A daily phone routine is not a complete unattended charging design.

For Tara’s home automation kit with coordinated local routines, this is the kind of behavior worth making explicit during handoff: who starts a routine, what ends it, and which control lets the household take over.