Stop charging when completed to save your devices from overcharging

This blueprint switch off power when charging is done.

You need a switch that output the actual power consumption. Then if power consumption is under the set threshold the switch will be toggled off.

Hope you like it, my first blueprint so hope all works well.

2 Likes

Nice, like 🔋 Turn off phone charging after the phone is charged but more advanced. Any chance you could turn it back on once the battery needs charging?

That would only work for devices like phones where you get that info from the cloud. But not when putting it into the charger. If there is a solution my girlfriend would love it. :wink:

Every phone or device with a Li-Ion battery already has a battery management system. Why not trust it to…manage the battery? :slight_smile: Seems like cutting power would cause the battery to begin discharging, thus increasing battery wear as Li-Ion batteries have limited charge/discharge cycles.

3 Likes

Why only thinking about phones? There is a full range of devices to be loaded, some with some without battery management. Btw I saw some iPhone and android on work blowing up because of Loading the whole day. So also modern deices can have problems. Only a low percentage maybe but there is a chance. And another escape could be saving power, I have a bunch of devices loading here, cameras, copter, phones, tablet, laptops and other things. And if they would load the whole day it cost extra power and money. :wink:
Also on the way I do not care for devices maybe loading at home because they shut off the switch if they do not need anymore.

And if you do not have a need for it fine, I had and wanted to share that piece of code. :slight_smile:

Same would be, why is there an automation telling you that dishwasher is done when you can hear it beep next to you. Because not everyone has it near to hear or forget it sometimes behind the closed door. :wink:

I agree on your point. But it shouldn’t matter since it’s measured in full cycles. So 4 quarter loads are still one load cycle. And batteries nowadays are much better so I wouldn’t worry about it.

You can always have an automation to turn on the switch every now and then.
If nothing is charging the blueprint automation should switch it off again.

I made a quite complex Node red flow that can distinguish between different phones/tablets which is charging where and switch it of at a given percentage.

And the plug at the bad auto turns on at 4 at night and if a phone is connected it charges it up to 90% and switch off.

1 Like

I believe that in case of a device that has the HA app running, this is relatively easy. If I remember correctly it gives you all kind of info like battery level and charging yes/no, etc. I haven’t got the app on my phone at the time, but remember something like that.

I was thinking of this too, but then with a slightly different approach.
My idea was/is to store the charging time to full charge* in a helper and set a “wake-up time”, so it would start charging “just in time” to be fully charged at the moment I get out of bed. Of course it should always start charging when my phone hits 1%.

Of course I’d install the app again for this, but just don’t have the time for this fun stuff at the moment…


  • one could do something like 10% charge takes X minutes. This will be approximately right and the charger could just be switched off at full change.

I believe your thinking is flawed.
You can’t measure the time it takes to fill up 10% and just multiply with 10.

The charging is varied across the range, so the first ten is one value and the next is different, and the last ten usually takes “forever”.
Not to mention that you shouldn’t let the battery go as low as 1% or even 10% for that matter if you care about the battery.

If you want a full charged battery at wake up then just have the charger start once an hour during the night and the charger will keep the battery charged and have an automation turn it of at some percentage.

I am aware of that. One of the things that is causing that behavior (at least on Apple devices) is the ‘optimized charging’. Once disabled the charging speed is/feels more consistent.

My idea was more of a 100% charge divided by 10 and add some margin. Having that said, I realized the helper wasn’t much of a help since it won’t be that dynamic over time and since you can turn of the charging at a certain time things should work out fine and one can start the day with a near full phone :slight_smile:

About the minimal and max battery level, you can set a start and end value of course.
So even when you put the phone on the charger with 30% battery left and you’d want it to go as low as 20% before charging, things should be doable.

Anyway, a lot of variables and I agree that the inconsistent charging speed might be a challenge.

I don’t understand why you insist on making it hard with helpers and charging speed.
Use the charging percentage period.

Sorry?
I quote my own response:

Having that said, I realized the helper wasn’t much of a help since it won’t be that dynamic over time and since you can turn of the charging at a certain time things should work out fine and one can start the day with a near full phone

But, the cool thing about all this is that it’s all so flexible that anyone can choose more or less his/her own solutions.

That’s it for me. Cheers!

This blueprint is great and (almost) exaclty what I was looking for! Other automations rely on percentage, but I can’t the percentage from my e-bike. Turning it off when it goes below a certain wattage is what I need.

I’ve added a extra parameter for my situation that maybe can be reused by others. It takes some time before my charger goes above the threshold, it then triggers this automation before it actually starts charging. Adding the for parameter for the below trigger solved this issue for me.

blueprint:
  name: Turn off power when loading finished
    # ... #
  input:
    # ... #
    wattage_threshold_duration:
      name: Wattage threshold duration (optional)
      description: For how long must the threshold be reached?
        For example, 00:01:00 will turn of the switch when the wattage goes below
        the threshold for 1 minute.
      default: 00:00:00
      selector:
        time: {}
    actions:
      # ... #
trigger:
- below: !input 'wattage_threshold'
  for: !input 'wattage_threshold_duration'
  entity_id: !input 'charger_wattage'
  platform: numeric_state
condition:
  # ... #
action:
  # ... #

1 Like