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