So I purchased one of these…
Table Top Wireless charger
and created an automation using a zigbee plug to turn it on and off… so I figured I’d share and if anyone was interested I’m always happy to share seeing how I’ve gotten so much help from here from others and have used things I’ve found on here myself.
Here’s the automation, feel free to use, modify and share if you’d like!
What this does is detects the phone battery and turns on the charger if I’m home [that way the charger doesn’t turn on when I’m not home] and the phone battery goes below 50 and turns off if the battery reads 95% charged or I take it off the charger for more than 2 minutes. Yes I left the condition tag in the trigger section in case anyone wanted to add a condition.
Thank you all!
- alias: 15 - Auto Manage John's Phone Charging
id: auto_manage_john_phone_charging
mode: single
triggers:
# Battery level changes
- trigger: state
entity_id: sensor.sm_f956u1_battery_level
id: battery_change
# Phone stops charging for 2 minutes
- trigger: state
entity_id: binary_sensor.sm_f956u1_is_charging
to: "off"
for: "00:02:00"
id: stopped_charging
condition: []
action:
- choose:
#################################################
# 🔌 BATTERY LOW - TURN ON CHARGER
#################################################
- conditions:
- condition: trigger
id: battery_change
- condition: numeric_state
entity_id: sensor.sm_f956u1_battery_level
below: 50
- condition: state
entity_id: device_tracker.john
state: "home"
- condition: state
entity_id: switch.phone_charger
state: "off"
sequence:
- action: switch.turn_on
target:
entity_id: switch.phone_charger
- action: tts.google_translate_say
target:
entity_id: media_player.sonos_five
data:
message: "Your phone battery is at {{ states('sensor.sm_f956u1_battery_level') }} percent. Turning on the phone charger so you can charge it."
#################################################
# 🔌 BATTERY FULL - TURN OFF CHARGER
#################################################
- conditions:
- condition: trigger
id: battery_change
- condition: numeric_state
entity_id: sensor.sm_f956u1_battery_level
above: 95
- condition: state
entity_id: switch.phone_charger
state: "on"
sequence:
- action: switch.turn_off
target:
entity_id: switch.phone_charger
- action: tts.google_translate_say
target:
entity_id: media_player.sonos_five
data:
message: "Your phone battery is at {{ states('sensor.sm_f956u1_battery_level') }} percent. Turning off the phone charger."
#################################################
# 🔌 PHONE STOPPED CHARGING - SAFETY SHUTOFF
#################################################
- conditions:
- condition: trigger
id: stopped_charging
- condition: state
entity_id: switch.phone_charger
state: "on"
sequence:
- action: switch.turn_off
target:
entity_id: switch.phone_charger
- action: tts.google_translate_say
target:
entity_id: media_player.sonos_five
data:
message: "Your phone stopped charging for 2 minutes so I'm turning off the charger."
I added a few things to this… one is if temp gets too high [ Will NOT turn on unless temp below 95] it shuts off…
if phone is off charger for 2 minutes it shuts off…
alias: 15 - Auto Manage John's Phone Charging
id: auto_manage_john_phone_charging
mode: single
triggers:
# Battery level changes
- trigger: state
entity_id: sensor.sm_f956u1_battery_level
id: battery_change
# Phone stops charging for 2 minutes
- trigger: state
entity_id: binary_sensor.sm_f956u1_is_charging
to: "off"
for: "00:02:00"
id: stopped_charging
# 🔥 Battery temperature changes
- trigger: state
entity_id: sensor.sm_f956u1_battery_temperature
id: battery_temp_change
condition: []
actions:
- choose:
#################################################
# 🔥 BATTERY TEMP OVER 100 - SAFETY SHUTOFF
#################################################
- conditions:
- condition: trigger
id: battery_temp_change
- condition: numeric_state
entity_id: sensor.sm_f956u1_battery_temperature
above: 100
- condition: state
entity_id: switch.phone_charger
state: "on"
sequence:
- action: switch.turn_off
target:
entity_id: switch.phone_charger
- action: tts.google_translate_say
target:
entity_id: media_player.sonos_five
data:
message: >
Your phone battery temperature is
{{ states('sensor.sm_f956u1_battery_temperature') }}
degrees, which is over 100. Turning off the phone charger.
#################################################
# 🔌 BATTERY LOW - TURN ON CHARGER
# 🔒 Will NOT turn on unless temp below 95
#################################################
- conditions:
- condition: trigger
id: battery_change
- condition: numeric_state
entity_id: sensor.sm_f956u1_battery_level
below: 50
- condition: numeric_state
entity_id: sensor.sm_f956u1_battery_temperature
below: 95 # 🔒 Thermal lockout
- condition: state
entity_id: device_tracker.john
state: "home"
- condition: state
entity_id: switch.phone_charger
state: "off"
sequence:
- action: switch.turn_on
target:
entity_id: switch.phone_charger
- action: tts.google_translate_say
target:
entity_id: media_player.sonos_five
data:
message: >
Your phone battery is at
{{ states('sensor.sm_f956u1_battery_level') }}
percent. Turning on the phone charger, please charge your phone.
#################################################
# 🔌 BATTERY FULL - TURN OFF CHARGER
#################################################
- conditions:
- condition: trigger
id: battery_change
- condition: numeric_state
entity_id: sensor.sm_f956u1_battery_level
above: 95
- condition: state
entity_id: switch.phone_charger
state: "on"
sequence:
- action: switch.turn_off
target:
entity_id: switch.phone_charger
- action: tts.google_translate_say
target:
entity_id: media_player.sonos_five
data:
message: >
Your phone battery is at
{{ states('sensor.sm_f956u1_battery_level') }}
percent. Turning off the phone charger.
#################################################
# 🔌 PHONE STOPPED CHARGING - SAFETY SHUTOFF
#################################################
- conditions:
- condition: trigger
id: stopped_charging
- condition: state
entity_id: switch.phone_charger
state: "on"
sequence:
- action: switch.turn_off
target:
entity_id: switch.phone_charger
- action: tts.google_translate_say
target:
entity_id: media_player.sonos_five
data:
message: >
Your phone is off the charger for 2 minutes,
so I'm turning off the charger.
1 Like
One more modification… if you don’t put the phone on the charger within 2 minutes it will now shut off the charger.
As it was if it was charging and you removed the phone for 2 minutes it would shut off… now it’ll do both!
- alias: 15 - Auto Manage John's Phone Charging
id: auto_manage_john_phone_charging
mode: single
triggers:
# Battery level changes
- trigger: state
entity_id: sensor.sm_f956u1_battery_level
id: battery_change
# Phone stops charging for 2 minutes
- trigger: state
entity_id: binary_sensor.sm_f956u1_is_charging
to: "off"
for: "00:02:00"
id: stopped_charging
# 🔥 Battery temperature changes
- trigger: state
entity_id: sensor.sm_f956u1_battery_temperature
id: battery_temp_change
# 🔌 Charger turned on but phone not charging after 2 min
- trigger: state
entity_id: switch.phone_charger
to: "on"
for: "00:02:00"
id: charger_on_no_charge
condition: []
actions:
- choose:
#################################################
# 🔥 BATTERY TEMP OVER 100 - SAFETY SHUTOFF
#################################################
- conditions:
- condition: trigger
id: battery_temp_change
- condition: numeric_state
entity_id: sensor.sm_f956u1_battery_temperature
above: 100
- condition: state
entity_id: switch.phone_charger
state: "on"
sequence:
- action: switch.turn_off
target:
entity_id: switch.phone_charger
- action: tts.google_translate_say
target:
entity_id: media_player.sonos_five
data:
message: >
"Your phone battery temperature is
{{ states('sensor.sm_f956u1_battery_temperature') }}
degrees, which is over 100. Turning off the phone charger."
#################################################
# 🔌 CHARGER ON BUT PHONE NOT PLUGGED IN
#################################################
- conditions:
- condition: trigger
id: charger_on_no_charge
- condition: state
entity_id: binary_sensor.sm_f956u1_is_charging
state: "off"
sequence:
- action: switch.turn_off
target:
entity_id: switch.phone_charger
- action: tts.google_translate_say
target:
entity_id: media_player.sonos_five
data:
message: >
"The charger has been on for two minutes but your phone is not charging.
Turning off the charger."
#################################################
# 🔌 BATTERY LOW - TURN ON CHARGER
#################################################
- conditions:
- condition: trigger
id: battery_change
- condition: numeric_state
entity_id: sensor.sm_f956u1_battery_level
below: 60
- condition: numeric_state
entity_id: sensor.sm_f956u1_battery_temperature
below: 95
- condition: state
entity_id: device_tracker.john
state: "home"
- condition: state
entity_id: switch.phone_charger
state: "off"
sequence:
- action: switch.turn_on
target:
entity_id: switch.phone_charger
- action: tts.google_translate_say
target:
entity_id: media_player.sonos_five
data:
message: >
"Your phone battery is at
{{ states('sensor.sm_f956u1_battery_level') }}
percent. Turning on the phone charger, please plug in your phone."
#################################################
# 🔌 BATTERY FULL - TURN OFF CHARGER
#################################################
- conditions:
- condition: trigger
id: battery_change
- condition: numeric_state
entity_id: sensor.sm_f956u1_battery_level
above: 95
- condition: state
entity_id: switch.phone_charger
state: "on"
sequence:
- action: switch.turn_off
target:
entity_id: switch.phone_charger
- action: tts.google_translate_say
target:
entity_id: media_player.sonos_five
data:
message: >
"Your phone battery is at
{{ states('sensor.sm_f956u1_battery_level') }}
percent. Turning off the phone charger."
#################################################
# 🔌 PHONE STOPPED CHARGING - SAFETY SHUTOFF
#################################################
- conditions:
- condition: trigger
id: stopped_charging
- condition: state
entity_id: switch.phone_charger
state: "on"
sequence:
- action: switch.turn_off
target:
entity_id: switch.phone_charger
- action: tts.google_translate_say
target:
entity_id: media_player.sonos_five
data:
message: >
"Your phone has not been charging for two minutes,
so I'm turning off the charger."