Last active
August 29, 2024 19:27
-
-
Save nielsmaerten/68f38863c7f6f15e4e9a5267ba8c82a3 to your computer and use it in GitHub Desktop.
Home Assistant Automation Blueprint that turns off your phone's charger when the phone reaches a certain battery level. Prevents 'overcharging'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: "Turn off charger at battery level" | |
description: "Turn off a switch when a mobile device's battery reaches a certain level" | |
domain: automation | |
input: | |
battery_level_sensor: | |
name: Battery Level Sensor | |
description: "Select the sensor that reports the battery level" | |
selector: | |
entity: | |
domain: sensor | |
device_class: battery | |
battery_state_sensor: | |
name: Battery State Sensor | |
description: "Select the sensor that reports the battery charging state" | |
selector: | |
entity: | |
domain: sensor | |
device_class: enum | |
charger_switch: | |
name: Charger Switch | |
description: "Select the switch controlling the charger" | |
selector: | |
entity: | |
domain: switch | |
desired_battery_level: | |
name: Desired Battery Level | |
description: "Set the battery level at which to turn off the charger" | |
default: 80 | |
selector: | |
number: | |
min: 1 | |
max: 100 | |
unit_of_measurement: "%" | |
charging_state_value: | |
name: Charging State Value | |
description: "The value that indicates the battery is charging (e.g., 'charging')" | |
default: "charging" | |
selector: | |
text: | |
trigger: | |
- platform: state | |
entity_id: !input battery_level_sensor | |
- platform: state | |
entity_id: !input battery_state_sensor | |
condition: | |
- condition: numeric_state | |
entity_id: !input battery_level_sensor | |
above: !input desired_battery_level | |
- condition: state | |
entity_id: !input battery_state_sensor | |
state: !input charging_state_value | |
action: | |
- service: switch.turn_off | |
target: | |
entity_id: !input charger_switch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment