Sensor.phone_next_alarm stopped working in automations with core 2021.6.6

I have an automation triggered by an android phone next alarm. This was working ok before updating to core 2021.6.6. Has anyone encountered similar problem?

I have a lovelace card showing the phone next alarm, when I set it in the phone the value is updated properly (to the alarm time) and when the alarm initializes, the value is changed properly (to Unavailable) but for some reason my automation doesn’t trigger anymore.
Phone alarm monitor card:

type: entity
entity: sensor.sm_g981b_next_alarm
name: Phone alarm monitor

Automation trigger configuration:

trigger:
  - platform: time
    at: sensor.sm_g981b_next_alarm

Regardless whether I Dismiss or Snooze the alarm on the phone, the automation is not triggered anymore

System Health

version core-2021.6.6
installation_type Home Assistant OS
dev false
hassio true
docker true
virtualenv false
python_version 3.8.9
os_name Linux
os_version 5.10.17-v7l
arch armv7l
timezone Europe/Helsinki
Home Assistant Community Store
GitHub API ok
Github API Calls Remaining 5000
Installed Version 1.13.2
Stage running
Available Repositories 849
Installed Repositories 17
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 6.1
update_channel stable
supervisor_version supervisor-2021.06.8
docker_version 20.10.6
disk_total 14.1 GB
disk_used 6.3 GB
healthy true
supported true
board rpi4
supervisor_api ok
version_api ok
installed_addons File editor (5.3.1), SSH & Web Terminal (8.2.4), Samba share (9.5.1), Ruuvitag (0.3.0), RuuviTag Discovery (0.2.9), Spotify Connect (0.8.2), Duck DNS (1.12.5), Z-Wave JS (0.1.28), Node-RED (9.1.4)
Lovelace
dashboards 2
resources 13
views 6
mode storage
Spotify
api_endpoint_reachable ok
1 Like

There is something wrong in the next alarm triggering. I made a helper and automation:
Automation:

alias: Fill alarm time -1
description: ''
trigger:
  - platform: state
    entity_id: sensor.sm_g981b_next_alarm
condition: []
action:
  - service: input_datetime.set_datetime
    target:
      entity_id: input_datetime.heratyshelper
    data:
      timestamp: '{{ as_timestamp(states.sensor.sm_g981b_next_alarm.state) - 1}}'
mode: single

If I use the input_datetime.heratyshelper as a trigger instead of sensor.sm_g981b_next_alarm I can start automations based on the phone alarm. The alarm time filler didn’t work if I set it to the actual alarm time but works if I set it to -1 seconds before the phone alarm time (’- 1’ above)

1 Like

What I think happens is that nanosecond before the alarm time, the phone alarm sets the next alarm to snooze-delay time. Samsung, tested both with Samsung own alarm clock and Google clock.

Now I have the problem that the helper value is set to the snooze-delayed value and I haven’t figured out how to unset the helper value after running the alarm actions…
Workaround, call script as part of the alarm automation to set the helper value to 1970’s:

alias: Unfill herätys
sequence:
  - service: input_datetime.set_datetime
    target:
      entity_id: input_datetime.heratyshelper
    data:
      timestamp: 1
mode: single
1 Like