Needs a phone that reports battery level to HA and a switch controlling the charger. Automatically turns off charger when the battery level reaches the defined high value and turns back on when the battery level drops to the low value.
blueprint:
name: Charge phone
description: Charges phone until a percentage and then turns off until percentage
drops below a defined point.
domain: automation
input:
phone_battery:
name: Phone Battery level
description: This sensor will be used to determine the charge level of the phone
selector:
entity:
domain: sensor
device_class: battery
phone_charger:
name: Phone Charger
description: Entity that controls supplying power to the phone
selector:
target:
entity:
domain: switch
low_battery:
name: Low Battery
description: Battery below which the phone should be charged
selector:
number:
min: 10.0
max: 95.0
unit_of_measurement: percentage
mode: slider
step: 1.0
charged_battery:
name: Charged Battery
description: Battery above which the phone should stop charging (should be greater
then Low Battery)
selector:
number:
min: 80.0
max: 100.0
unit_of_measurement: percentage
mode: slider
step: 1.0
source_url: https://github.com/apollo1220/blueprints/blob/39a53c112c215be2ffd2968cadd192d6a3acc261/phone_charger.yaml
mode: single
max_exceeded: silent
trigger:
- platform: numeric_state
entity_id: !input 'phone_battery'
below: !input 'low_battery'
- platform: numeric_state
entity_id: !input 'phone_battery'
above: !input 'charged_battery'
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: !input 'phone_battery'
above: !input 'charged_battery'
sequence:
- service: homeassistant.turn_off
target: !input 'phone_charger'
default:
- service: homeassistant.turn_on
target: !input 'phone_charger'
- wait_for_trigger:
- platform: numeric_state
entity_id: !input 'phone_battery'
above: !input 'charged_battery'
continue_on_timeout: false
- service: homeassistant.turn_off
target: !input 'phone_charger'