Device information

Is there a way to update Device information like battery percentage or plugged/unplugged state?

What device specifically?

There are some iPhone’s with the Home Assistant iOS app installed. I would like to send notifications based on battery level.

Not sure about through the iOS app but just using the icloud component you can pull this information.

sensor:
  - platform: template
    sensors:
      battery_adamiphone:
        unit_of_measurement: '%'
        value_template: >-
            {%- if states.device_tracker.adamsiphone7.attributes.battery %}
                {{ states.device_tracker.adamsiphone7.attributes.battery }}
            {% else %}
                {{ states.sensor.battery_adamsiphone7.state }}
            {%- endif %}

  - platform: template
    sensors:
      charging_adamiphone:
        value_template: >-
            {%- if states.device_tracker.adamsiphone7.attributes.battery_status %}
                {{ states.device_tracker.adamsiphone7.attributes.battery_status }}
            {% else %}
                {{ states.sensor.charging_adamsiphone7.state }}
            {%- endif %}

This will work I think. Only do I have to enter my iCloud password in the config.

Yes, you need to setup the icloud device tracker component first. Then get the entity ID for your iphone once it is setup. Replace “adamsiphone7” with your entity ID in the two code examples above and you should get two new sensors that will show battery percentage and if the phone is charging or not.

1 Like