Home Assistant Phone charging automation
Home Assistant

Home Assistant Phone charging automation

Phone charging state and the battery %
A flow by Sevagjb

Go to automations Download flow Download assets

Flow Details

when you start charging it will publish the state and the battery % when your phone battery is below 40% will trigger to publish when the battery is full,

Copy and paste the Yaml code into the automation only you have to change the phone sensor as this: -sensor.iphone_battery_state -sensor.iphone_battery_level

you can change the time pattern, the battery threshold (40%) and the text as you like. enjoyed :)

alias: "" description: "" trigger: - platform: time_pattern minutes: /7 - platform: state entity_id: - sensor.iphone_battery_state to: Charging condition: [] action: - choose: - conditions: - condition: template value_template: |- {% if states('sensor.iphone_battery_level' ) |float <40 %} true {%- endif %} sequence: - service: mqtt.publish data: payload: &amp;amp;amp;amp;amp;gt;- {"text":"My iPhone is {{ states("sensor.iphone_battery_state") }} {{ states('sensor.iphone_battery_level', "state" , 'unit_of_measurement' ) }} ","icon":"12832","color": "#b93232","pushIcon":2,"repeat":3,"textCase":2,"textOffset":33} topic: awtrix_light/notify alias: " MQTT: Publish Reed" - conditions: - condition: template value_template: |- {% if states("sensor.iphone_battery_state") =="Charging" -%} true {%- endif %} sequence: - service: mqtt.publish data: payload: &amp;amp;amp;amp;amp;gt;- {"text":"My iPhone is {{ states("sensor.iphone_battery_state") }} {{ states('sensor.iphone_battery_level', "state" , 'unit_of_measurement' ) }} ","icon":"1095","pushIcon":2,"repeat":3,"textCase":2,"textOffset":33} topic: awtrix_light/notify alias: " MQTT: Publish White" - conditions: - condition: template value_template: |- {% if states("sensor.iphone_battery_state") =="Full" -%} true {%- endif %} sequence: - service: mqtt.publish data: payload: &amp;amp;amp;amp;amp;gt;- {"text":"My iPhone is {{ states("sensor.iphone_battery_state") }} {{ states('sensor.iphone_battery_level', "state" , 'unit_of_measurement' ) }} ","icon":"12126","color": "##22aa13","pushIcon":2,"repeat":3,"textCase":2,"textOffset":33} topic: awtrix_light/notify alias: " MQTT: Publish Green" mode: single
/flows/6wq2N5Nlo7KV/1095.gif
/flows/6wq2N5Nlo7KV/12126.gif
/flows/6wq2N5Nlo7KV/12832.gif
-- Flow first published on May 20, 2023, last updated on May 24, 2023 at 11:34.