Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android next alarm sensor not triggering automations or Node Red time nodes at alarm time #2616

Closed
strikeir13 opened this issue Jun 16, 2022 · 12 comments
Labels
bug Something isn't working question Further information is requested sensor-tracking

Comments

@strikeir13
Copy link

Home Assistant Android version:
2022.6.0-full
Android version:
12, security update June 5, 2022
Phone model:
Pixel 6
Home Assistant version:
2022.6.6
Last working Home Assistant release (if known):
2022.6.x (it was working earlier in June)
Last working Android app version: any stable version prior to 2022.6.0-full, I updated on June 9, 2022
Description of problem:
The Next Alarm sensor is not triggering automations or sending any output from a Node Red time node. I have nothing selected in the Android app Next Alarm sensor Allow List. When setting a new alarm, I can see the correct local time value reflected in both the Developer Tools and on the Node Red time node. However, at the set time, neither the HA native automation nor the Node Red time node trigger any subsequent actions.
Traceback (if applicable, to get the logs you may refer to: https://companion.home-assistant.io/docs/troubleshooting/faqs/#android-crash-logs):

Screenshot of problem:
Developer Tools:
image
Node Red time node configured for sensor.pixel_6_next_alarm (flow directly from Node Red cookbook example)
image
Additional information:
In the event it may be time zone related, I'm using times for US Central Time (CST) and Daylight Savings Time (DST) is currently active in my location.

@strikeir13 strikeir13 added the bug Something isn't working label Jun 16, 2022
@dshokouhi
Copy link
Member

Skip node red and try a basic automation, if it still fails share the yaml and any error in the logs please.

@dshokouhi dshokouhi added question Further information is requested sensor-tracking labels Jun 16, 2022
@strikeir13
Copy link
Author

Here's the YAML for my test automation:

- id: '1655385085563'
  alias: Android alarm test
  description: ''
  trigger:
  - platform: time
    at: sensor.pixel_6_next_alarm
  condition: []
  action:
  - device_id: c2afa01328e3e50d470c19dc582a8cc8
    domain: mobile_app
    type: notify
    message: The alarm went off
  mode: single

homeassistant_companion_log_5-16-2022_10-14-8.txt
Attached are the logs. I trimmed the log from the point where the next alarm is first registered to roughly 1 minute after the alarm went off. At no point did the automation fire and I did not receive a notification on my phone. When testing the automation actions manually via the automation menu, the action does run and I do receive a notification on my phone.

@dshokouhi
Copy link
Member

Do you see the state updating as expected in HA for the sensor? If you do then this would be a HA core issue and not an issue with the mobile app.

@strikeir13
Copy link
Author

Yes, when I change the alarm on my phone, I can see the correct time displayed Developer Tools.

@dshokouhi
Copy link
Member

any HA core errors at that time?

@strikeir13
Copy link
Author

It doesn't look like it. This is the extent of the logs for that time period:

2022-06-16 10:09:37 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.backyard] Error from stream worker: Error opening stream (HTTP_NOT_FOUND, Server returned 404 Not Found) rtsps://stream-uc2-bravo.dropcam.com:443/sdm_live_stream/CiUA2vuxr_Q_coOWxoR7BxwMjI1hjQeYBWPKR55jq-2XmjgFPGWkEnEA3HkqUOmO7S5yDYd5R6-hNLE95Y76HSrMPduzAt_1lhmARzbU5fhaXCklIPFS24bY2Qz1sf67eb45rsFNGP2CvFMwXHsB-iovE0IdY-jC49FG1m9-gAkM7dUC_Tpk3dMFKdrfKPimJk0fJ0p7hXpAtg?auth=****
2022-06-16 10:11:43 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.front_yard] Error from stream worker: Error opening stream (HTTP_NOT_FOUND, Server returned 404 Not Found) rtsps://stream-ue1-delta.dropcam.com:443/sdm_live_stream/CiUA2vuxr-spkLFzHVBnNbe6IDcOCzNc-FT5VKjjrtrtP3Nwah-9EnEA3HkqUOYuk6YdYDA6XYGyzuq1f-qI5rePahkr90Eh6b5vrThUf9Bca0kIgDp2gsN2_FivXHdWbSGJdY8sdzVdOqKDHeHU8KjHZhGgLBnoR33Fyn0XaCjPR1g7Wq6gOc4CJ6gBF49vXSiJDYLp9A98AA?auth=****
2022-06-16 10:13:58 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.backyard] Error from stream worker: Error opening stream (HTTP_NOT_FOUND, Server returned 404 Not Found) rtsps://stream-uc2-bravo.dropcam.com:443/sdm_live_stream/CiUA2vuxr_Q_coOWxoR7BxwMjI1hjQeYBWPKR55jq-2XmjgFPGWkEnEA3HkqUOmO7S5yDYd5R6-hNLE95Y76HSrMPduzAt_1lhmARzbU5fhaXCklIPFS24bY2Qz1sf67eb45rsFNGP2CvFMwXHsB-iovE0IdY-jC49FG1m9-gAkM7dUC_Tpk3dMFKdrfKPimJk0fJ0p7hXpAtg?auth=****
2022-06-16 10:18:28 ERROR (stream_worker) [homeassistant.components.stream.stream.camera.backyard] Error from stream worker: Error opening stream (HTTP_NOT_FOUND, Server returned 404 Not Found) rtsps://stream-uc2-bravo.dropcam.com:443/sdm_live_stream/CiUA2vuxr_Q_coOWxoR7BxwMjI1hjQeYBWPKR55jq-2XmjgFPGWkEnEA3HkqUOmO7S5yDYd5R6-hNLE95Y76HSrMPduzAt_1lhmARzbU5fhaXCklIPFS24bY2Qz1sf67eb45rsFNGP2CvFMwXHsB-iovE0IdY-jC49FG1m9-gAkM7dUC_Tpk3dMFKdrfKPimJk0fJ0p7hXpAtg?auth=****

@strikeir13
Copy link
Author

I rolled back to HA Core 2022.6.5 and the issue persisted. The state changes for the _next_alarm sensor are definitely being picked up - an automation trigger based on any state change for sensor.pixel_6_next_alarm triggers when the alarm is set or goes off, as expected:

platform: state
entity_id:
  - sensor.pixel_6_next_alarm

@strikeir13
Copy link
Author

I did some more testing on this today - if I set an offset to the alarm time, e.g. trigger 1 minute before the alarm, the YAML automation works as expected. If I then change the automation by removing the time offset (so that it triggers ON the alarm time), no actions are triggered.

Node Red behaves the same, offsets before the alarm work but exact alarm times do not.

@dshokouhi
Copy link
Member

I would check the date/time on your server and device maybe something is out of sync?

@strikeir13
Copy link
Author

I just checked, and my Raspberry Pi 4 server and my Pixel 6 phone are within 5 seconds of each other. My server matches the time shown on a Windows PC exactly. If I use {{ as_datetime(as_timestamp(now()))}} in the template Dev Tools, it also matches the Windows PC time exactly.

@strikeir13
Copy link
Author

The end result of my investigation was that my phone was a few seconds ahead of my server clock, which was apparently enough for the phone alarm to trigger on the phone and then the node red next alarm node to update to the next alarm or unavailable before sending any payloads. The same behavior occurred with the HA built-in automations. There was one comment on the community forums that said a race condition could occur on the phone and result in this behavior, but I have no way to determine whether that is happening on my phone in particular. My solution for now has been to have the node red next alarm node trigger 1 minute before my alarm and then add a 1 minute delay node immediately downstream of the next alarm. It's clearly a workaround, but it works for now.

@dshokouhi
Copy link
Member

Closing as this is not an issue the app can handle

@dshokouhi dshokouhi closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested sensor-tracking
Projects
None yet
Development

No branches or pull requests

2 participants