#Device unplugged automation triggered 20 minutes after it happened

9 messages · Page 1 of 1 (latest)

woven salmon
#

I have an automation that resets a counter when I unplug my phone. It's been working great until this morning. I woke up (and took my phone off the charger) at 06:28 when my alarm went off, but the automation ran at 06:55.
Any ideas what could have caused this? It's been running fine for quite some time - including yesterday morning.

alias: FreeMan is awake
description: >-
  Reset light dimming when phone unplugged between 4am and 1hr after
  sunrise
trigger:
  - type: not_plugged_in
    platform: device
    device_id: 0de3dc2943fa2181779f2b0378115fde
    entity_id: 80a5b5d22d86d3ae9ddcdcdbc604ccd6
    domain: binary_sensor
condition:
  - condition: sun
    before: sunrise
    before_offset: "+1:00:00"
    enabled: true
action:
  - data: {}
    target:
      entity_id: counter.morninglightdivisor
    action: counter.reset
mode: single

(Yes, I know the comment says after 4am, but there's no code to support that. The problem with comments...)

Attached is the logbook entry and the trace timeline showing when it actually triggered.

latent kernel
#

#1284965926336335993 might also be able to help more. Looks like the automation is fine, since the actual sensor didn't change til 6:55.

I will say I've also experienced delays for the phone sensors updating, although not to that extent... sometimes its up to a minute or 2.

Assuming there wasn't anything out of the ordinary going on w/ your phone? No updates, power cycles, etc.

#

Also make sure battery usage is unrestricted ... check Settings -> Companion App -> Scroll and check Background Access and make sure it's able to run in the background

woven salmon
#

Would happily tag it for #1284965926336335993 if it were listed as an option - I'm not seeing it...

The phone hadn't rebooted, there was no indication of an OS update or anything else.
Battery usage is set to allow background usage. As noted, this has been running for months (with occasional slight delays, but nothing like this), but I did just double check to ensure that it was set properly. I also disabled background running, then reenabled, just to be sure... 🤷‍♂️ sometimes settings do get corrupted and a reset will fix it.

latent kernel
#

It's a different channel, instead of automations

woven salmon
#

Oh... I see what you mean, those are tags within the automations channel. Can (should?) this be moved? Would cross-posting be allowed/recommended?

near snow
#

looks like it took some time before HA registred that the phone was no longer charging

#

Discord Cache strikes again..

latent kernel
#

There doesn't appear to be any way to move it... I'd suggest posting this w/ context over there, just because I believe this is more something with the companion app (and there's some people that monitor that channel as opposed to this one with more expertise there).