Hi, I have few automation that have a condition that check if the sensor of my phone is charging and the charger type is wireless. The problem I have is my phone seems to get fully charged around 3am and then both sensor report not charging anymore and charger type none. I can see with the battery level sensor that the phone really stop charging, I guess it protect the battery…
Anyone have an idea how can I still get my condition to match ? Like a template that check “if charger type was wireless for 2+hours and the battery level reached 100% in the last 8hours” or something like that ?
Does anyone have a similar behaviour with these sensor ? I can’T say when this changed but I’m pretty sure this was working few months ago, I just haven’t noticed before few weeks ago.
Hi,
What are you trying to achieve with your automation? Do you want to turn off the charger when the phone battery is full?
Happy to try & help of I can understand what you goal is.
Cheers
Nick
When phone is plugged in, face down and connected to (home) wifi, then it calls a http end point. Unplugging in the morning does the reverse. You could easily do this in Tasker, with a few modifications.
I do the same thing to trigger my "good night " automation (switch tv and lights off and close all the window shutters). I just check the charger type, not the charging:
My automation slowly open my lifx bulb near my bed. The automation trigger using a helper I fill every night using the sensor next alarm of my phone minus 10 minutes. So if my alarm is at 6 AND my phone is on a wireless charger(the condition) the automation will start my light and increase it on a 10 minutes span.
The problem I have right now is as my phone is fully charged around 3am, sometimes the sensor stay wireless till the morning, sometimes it does not, like this this I don’t know if it’s the wireless charger that cause this or the phone that protect the battery but it’s not always the same result, really weird.
And when it does that my condition isn’t met on the morning because it looks like my phones wasn’t on my wireless charger on the tabletop…
So I was hoping it could be possible using a template for the condition that would do something like " sensor.example_charger_type was wireless for at least 2 hours in the last 8 hours AND battery was at 100% somewhere in the last 8hours" but my template skills have no idea where to start!
I hope this help you understand, thanks for your help!
Yes I tried using both, the problem is my phone is on a wireless charging pad and it looks like the phone protect the battery when it reach 100% so it disconnect the charger… so at 3am the phone is charged and the charger disconnect.
So as I stated in another reply, my hope was to use a template that could do something similar to this: " sensor.example_charger_type was wireless for at least 2 hours in the last 8 hours AND battery was at 100% somewhere in the last 8hours" but I have no idea how I could do that
Also used another alternative. I’ve created a wireless charging stand that detects the phone pressure on top of it with a mouse microswitch conneted to a sonoff. This sonoff is also capable of switching the wireless charger on On/Off. This system has an additional purpose: to charge the phone half way immediately when I go to sleep and the remaining to the top two hours before the next alarm. This minimizes how long the phone’s battery is being charged to 100%, which is known to affect its longevity.
Find another way to detect your phone, like mxanders suggestion.
Your phone is protecting the battery life by turning off the charger.
Lithium-ion batteries works best with small recharging cycles at around 50% battery charge. The further away you get from this threshold the worse the charging is for the battery life.
This is the reason the phone in the low charge end shuts down before the power is actually drained completely from the battery and you will be able to turn on the phone several more times.
In the high charge end it will turn off the charger at 100% and then keep it off until around 93% where it will top it off again.
Modern phones also have AI built into the battery management, so if you normally get up at 6 in the morning, then it might go even lower than 93% in order to the charge later and hit 100% just before 6.
Another way to perhaps help reliability of knowing the phones charging state. This is my entire automation for controlling the phone charge. In my case i’m only controling the behaviour of the switch attached to my wireless charger but something like this might help wtih knowing if the phone is being wirelessly charged or not.
alias: "device: charge nick's phone at night"
description: >-
turn on the phone charger under the bed at night at 12am & 4am & turn off each
time with battery level reaches 98%.
trigger:
- platform: time
at: "00:00"
id: 12am
- platform: time
at: "04:00"
id: 4am
condition:
- type: is_battery_level
condition: device
device_id: 28ae27a1b2484956b9cb4c0813d60532
entity_id: sensor.pixel_3_xl_battery_level
domain: sensor
below: 80
action:
- type: turn_on
device_id: 38ca53dfd42ccb0dd1549065e6d2e0a0
entity_id: switch.sonoffpowr2_03
domain: switch
- wait_for_trigger:
- type: battery_level
platform: device
device_id: 28ae27a1b2484956b9cb4c0813d60532
entity_id: sensor.pixel_3_xl_battery_level
domain: sensor
above: 99
for:
hours: 0
minutes: 0
seconds: 0
id: pixel_battery
- type: turn_off
device_id: 38ca53dfd42ccb0dd1549065e6d2e0a0
entity_id: switch.sonoffpowr2_03
domain: switch
mode: restart
Thanks for all your suggestions, based on that I think I will create an automation that fill a helper if the phone charger type is wireless for at least 1hour and the battery level reached 100% for at least X minutes between 23h and 6am. And another automation that reset this helper every day at noon.
That way I will have a pretty precise way to know my phone was on the tabletop charger during the night… I guess this could be done with a template but that way at least I know how to do it
Out of curiosity, is the ultimate goal to create an alarm using your light bulbs but you only want that to happen if you are at home & in bed at the time of the alarm?
If that is the case then you could check if a phone alarm is set & if the phone is at home, then take the light bulb actions.
Cheers
Hi, yeah I want the light to open before the alarm so that will help to wake me up and I want that only when I’m in the bed, At home is not enough because I sometimes fall asleep on the sofa and I my girlfriend is not a big fan of the wake up light so no wake up light when I’m not in bed
In case someones trying to do the same thing, here’s what I’m testing right now
alias: SYS - Fill cell charge table de nuit
description: >-
Sert a activer le helper si mon cellulaire à chargé 1h30 wireless durant la nuit
trigger:
- platform: state
entity_id:
- sensor.cellX_charger_type
to: wireless
for:
hours: 1
minutes: 30
seconds: 0
id: "on"
- platform: time
at: "09:00:00"
id: off9
condition:
- condition: time
after: "21:00:00"
before: "09:15:00"
weekday:
- mon
- tue
- wed
- thu
- fri
action:
- if:
- condition: trigger
id: "on"
then:
- service: input_boolean.turn_on
data: {}
target:
entity_id: input_boolean.XX_charge_table_de_nuit
- if:
- condition: trigger
id: off9
then:
- service: input_boolean.turn_off
data: {}
target:
entity_id: input_boolean.XX_charge_table_de_nuit
mode: single
This should run everytime my cellphone is on a wireless charger for 1h30 between 21h and 9h15 am and turn on the helper I will use as a condition to trigger my automation. There’s a second trigger id that will run at 9h and turn off the helper.