Phone charge/discharge automation ideas

Hi Everyone,

I notice because I have the android app on my phone HA knows when my phone is charging and discharging.

As I usually charge my phone next to my bed, I starting thinking of ideas for automations that I could trigger.

So far I have an automation that turns on my electric blanket before bedtime (If my phone is home) as I turn it off when I get into bed I thought of using my phone charge status to switch off my electric blanket.

Did anyone come up with any fun/useful automation’s to trigger when the phone is put on to charge or starts discharging (like when I get up in the morning?) :slight_smile:

I notice because I have the android app on my phone HA knows when my phone is charging and discharging.

Once you plug the phone in the charger, how long does it take HA to register from not charging to charging?

I tested mine and it has been 10 minutes since I charged the phone and it is still showing not charging. I think I’ve read somewhere to use a smart plug and use that state of when the plug is being use as a trigger.

I use it to log when I’m in bed (so no traditional sensor required) based on a few things:

  1. Charger type = AC (my phone shows AC or Data; e.g. whether its connected to a wall wort or a computer)
  2. Connected WiFi AP = one closest to the bedroom (or its connected to one of the other ones and signal is also weak in case it holds its connection too long)

I then use it to turn off things I forgot when I go to bed. I’ve also pulled that data into Grafana to calculate number of sleep hours per night.

Hey @duceduc,

Its very fast as far as I can tell (within a few seconds). Maybe your phone is limiting the app running in the background, sleeping it or something?

I like the idea of calculating how much sleep you have had it would probably be pretty accurate for me as well.

Another idea I had was to arm a sort of alarm, entry doors should’t be opened at night while my phone is charging but may need to talk to my family about that first :slight_smile:

Simply turning the charger off when the phone is fully charged would be good for the battery.

Actually now you mention that it would be even better to turn it off when around 80% charged and I could get more charge cycles out of my phone battery :slight_smile: Not sure if I am going to bother though.

I use phone charging status (and the attribute relating to wireless charging as we both use Pixel stand wireless chargers) for my wife and I to determine when everyone at home is asleep.

This status:

  • Stops notifications from the Unifi Protect camera at the front of the house
  • Suppresses Google Home and Notification alerts from the doorbell integrated through RF.
  • Enables alerts from security automations that react to events in the (detached) garage - cars leaving, door opening, etc.

I use the “Charging State” along with occupancy (someone is home) to trigger my good night sequence which turns off a bunch of lights, says “good night” (TTS) and sets the volume and starts a sleep timer on my bedroom Sonos…

So you guys never charge your phones unless you are asleep/going to bed?

That’s why I filter mine by charger ‘AC’ (Ac charger by bed) and that its connected to the access point near my bedroom. I’m pretty sure I had another characteristic too, but I don’t remember it off the top of my head.

I don’t, my battery lasts all day

Only have a wireless charger at work and bedside, and the automation is conditional on being at home.

So if you’ve had a hard day and the cellphone is flat when you get home, you put it on the charger and the house says g’night? The phone on the charger and you being at home can’t be the only criteria.

There’s a time condition as well, but given that the only wireless chargers in our house are by the bed and only used overnight it really doesn’t make any difference for our use case.

If we need a charge during the day we use wired. I cannot think of a single time I’ve charged my phone during the day on the Pixel Stand since setting it up nearly two years ago.

Just goes to show, we all have different habits and different setups. Thank goodness HA is so flexible.