Phone-charging-notification-automation behaves erratically

I have an automation that notifies me whenever my phone is below 50% battery and not charging

it has been acting quite erratically lately

First off, it’s not intended to trigger more than once after the battery is below 50%, but does so regardless, in intervals that seem random to me. How would I prevent that?

  trigger:
  - platform: numeric_state
    entity_id: sensor.iphone_battery_level
    below: 50
  condition:
  - condition: state
    entity_id: sensor.iphone_battery_state
    state: Not Charging
  action:
  - service: notify.pushover
    data:
      title: charge iPhone!
      message: x
  - service: automation.turn_off
    metadata: {}
    data:
      stop_actions: false
    target:
      entity_id: automation.automation_59
  - delay:
      hours: 1
      minutes: 20
      seconds: 0
      milliseconds: 0
  - service: automation.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: automation.automation_59
  mode: single

update: the issue occurred because of a second iPhone I am using which was set up based on the data of the first and apparently has the same name.

I had to do the procedure that was imprecisely described in this post to resolve the issue.

Assuming this automation is automation59 then you can remove the automation turn off and automation turn on and get the exact same result.
Only time it will not get the same result is if you reboot HA, but in that case the automation as it is now will fail you anyways so it won’t be what you expect.

1 Like