I’m, trying to create an automation that turns on lights after a defined amount of time, based on my phone alarm.
But I cannot get it to fire.
I’ve followed multiple ‘tutorials’ that seem to be based of the same config, but from mhy testing, the state never seems to change to True.
I am basing this of my phone alarm - Android 13, Pixel 6 Pro
Am I missing something:
I’ve tried following a couple of different guides but can’t get it to fire off. I’m beginning to wonder if it’s bugged or something.
It doesnt show up under Trigger, Device, Pixel 6, and so far none of the templates ive tried have worked.
It does show me the sensor.pixel_6_next_alarm under Developer Tools, States.
Local Time: Sun Oct 08 07:45:00 EDT 2023
Package: com.google.android.deskclock
Time in Milliseconds: 1696765500000
device_class: timestamp
icon: mdi:alarm
friendly_name: Pixel 6 Next alarm
If the entity exists and it is returning the correct value in the States tool, then the issue is most likely with your automation. Post what you have tried, the automation debug trace, and what your goal is…
I have the same issue with my pixel 6a and also doesn’t fire.
In my opinion the problem is when the alarm sounds, the sensor or template automatically goes to the next alarm so the condition is never fulfilled. Even if you leave only one alarm, because then it goes to the next day’s alarm.
I have stripped back my automation to bare bones basic:
- alias: Wake up Lights - Bedroom Light Fade in
initial_state: 'on'
mode: restart
trigger:
- platform: time
at: sensor.pixel_6_pro_next_alarm
action:
- delay:
hours: 0
minutes: 0
seconds: 10
milliseconds: 0
- service: light.turn_on
target:
entity_id: light.lounge_lamp
Does not fire, and same as others have mentioned, HA appears to report the correct stae for the alarm sensor:
2024-03-15T13:45:00+00:00
device_class: timestamp
icon: mdi:alarm
friendly_name: Pixel 6 Pro Next alarm
Local Time: Fri Mar 15 13:45:00 GMT 2024
Package: com.google.android.deskclock
Time in Milliseconds: 1710510300000
I found out why it won’t work in many cases: The entity which uses the phones next alarm sensor usually gets refreshed one second before the alarm acutally goes off (Lets say the alarm is due to 08:00:00 it refreshes 07:59:59 almost all the time). The automation with this template refreshes usually around one second after a full minute (so 08:00:01 for example). So after the alarm goes off the sensor gets refreshed and the automation won’t fire at all because the actual time to fire did change.