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

"next_alarm" not updated for timers with recurrence #566

Closed
chemelli74 opened this issue Feb 20, 2020 · 16 comments · Fixed by #591
Closed

"next_alarm" not updated for timers with recurrence #566

chemelli74 opened this issue Feb 20, 2020 · 16 comments · Fixed by #591

Comments

@chemelli74
Copy link
Contributor

Describe the bug
After a alarm fire, value show past data, like "2 hours ago".

To Reproduce
Steps to reproduce the behavior:

  1. Set a recurring alarm
  2. Wait for it to fire
  3. HA shows "1 hour ago"

Expected behavior
After a alarm fire, I would epect "next_alarm" to show the next one.
I think this is down to the way refresh is done.

Screenshots
If applicable, add screenshots to help explain your problem.
image

System details

  • Home-assistant (version): 0.105.2
  • Hassio (Yes/No): No
  • alexa_media (version from const.py or HA startup): 2.5.5
  • alexapy (version from pip show alexapy or HA startup):
@chemelli74
Copy link
Contributor Author

As expected, now that the refresh occured the sensor is updated:

image

So the question is: how often is refreshed ? Can I force a more frequent refresh ?

Simone

@alandtse
Copy link
Owner

Every 10 minutes or on hearing a command.

@chemelli74
Copy link
Contributor Author

Every 10 minutes or on hearing a command.

That's not the case as I can clearly see "3 hours ago".

Simone

@alandtse
Copy link
Owner

Please provide logs (check wiki for info). We'll be looking for the following lines:

2020-02-20T09:10:39.014678506Z 2020-02-20 01:10:39 DEBUG (MainThread) [alexapy.alexaapi] static GET: https://alexa.amazon.com/api/notifications returned 200:OK:application/json
2020-02-20T09:10:39.018985876Z 2020-02-20 01:10:39 DEBUG (MainThread) [custom_components.alexa_media] a******e@g*******m: Found 10 devices, 10 bluetooth
2020-02-20T09:10:39.020897547Z 2020-02-20 01:10:39 DEBUG (MainThread) [custom_components.alexa_media] a******e@g*******m: Updated 14 notifications for 6 devices at 2020-02-20 01:10:39.019570-08:00

We'll also need to see the json output from https://alexa.amazon.com/api/notifications (fix the region) for the specific alarm that isn't updating.

@alandtse alandtse reopened this Feb 21, 2020
@chemelli74
Copy link
Contributor Author

Accessing the site gives me the following page:

image

Simone

@alandtse
Copy link
Owner

First, you'll need to update the url to the domain you are using to connect to Amazon (e.g., alexa.amazon.it if you're in Italy). Second, if you are seeing that on the correct domain, you have connectivity issues to Amazon and of course the component won't work.

@chemelli74
Copy link
Contributor Author

Please provide logs (check wiki for info). We'll be looking for the following lines:

2020-02-20T09:10:39.014678506Z 2020-02-20 01:10:39 DEBUG (MainThread) [alexapy.alexaapi] static GET: https://alexa.amazon.com/api/notifications returned 200:OK:application/json
2020-02-20T09:10:39.018985876Z 2020-02-20 01:10:39 DEBUG (MainThread) [custom_components.alexa_media] a******e@g*******m: Found 10 devices, 10 bluetooth
2020-02-20T09:10:39.020897547Z 2020-02-20 01:10:39 DEBUG (MainThread) [custom_components.alexa_media] a******e@g*******m: Updated 14 notifications for 6 devices at 2020-02-20 01:10:39.019570-08:00

I see the GET (with 200 OK) but not the "udpated notifications" in my debug log.

Simone

@alandtse
Copy link
Owner

Can you please provide the json from the notifications page for the missing alarm?

@chemelli74
Copy link
Contributor Author

Can you please provide the json from the notifications page for the missing alarm?

Sure, how should I capture it ?

Simone

@alandtse
Copy link
Owner

@chemelli74

We'll also need to see the json output from https://alexa.amazon.com/api/notifications (fix the region) for the specific alarm that isn't updating.

@chemelli74
Copy link
Contributor Author

chemelli74 commented Mar 13, 2020

taken at 09:36 (Rome)

{"notifications":[{"alarmTime":1584057600000,"automationId":null,"createdDate":1583795024866,"deferredAtTime":null,"deliveryType":null,"deviceName":null,"deviceSerialNumber":"xxxxxxxxxx","deviceType":"A1RABVCI4QCIKC","extensibleAttribute":null,"geoLocationTriggerData":null,"id":"A1RABVCI4QCIKC-xxxxxxxxx-8a3e70ce-c774-4909-98b6-082681e25c4b","lastOccurrenceTimeInMilli":0,"lastUpdatedDate":0,"musicAlarmId":null,"musicEntity":null,"notificationIndex":"8a3e70ce-c774-4909-98b6-082681e25c4b","originalDate":"2020-03-13","originalTime":"08:00:00.000","personProfile":null,"provider":null,"rRuleData":null,"recurrenceEligibility":false,"recurringPattern":"XXXX-WD","remainingTime":0,"reminderAppLabel":null,"reminderLabel":null,"reminderSubLabel":null,"skillInfo":null,"snoozedToTime":null,"sound":{"displayName":"Simple Alarm","folder":null,"id":"system_alerts_melodic_01","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_01.mp3"},"status":"ON","targetPersonProfiles":null,"timeZoneId":null,"timerLabel":null,"tmwNotificationProperties":null,"triggerTime":0,"type":"Alarm","version":"19"},{"alarmTime":1583798400000,"automationId":null,"createdDate":1581459338506,"deferredAtTime":null,"deliveryType":null,"deviceName":null,"deviceSerialNumber":"xxxxxxxxx","deviceType":"A1RABVCI4QCIKC","extensibleAttribute":null,"geoLocationTriggerData":null,"id":"A1RABVCI4QCIKC-xxxxxxx-9ef5918c-06ba-4a54-ba93-b7f1ab9d538f","lastOccurrenceTimeInMilli":0,"lastUpdatedDate":0,"musicAlarmId":null,"musicEntity":null,"notificationIndex":"9ef5918c-06ba-4a54-ba93-b7f1ab9d538f","originalDate":"2020-03-10","originalTime":"07:00:00.000","personProfile":null,"provider":null,"rRuleData":null,"recurrenceEligibility":false,"recurringPattern":"XXXX-WD","remainingTime":0,"reminderAppLabel":null,"reminderLabel":null,"reminderSubLabel":null,"skillInfo":null,"snoozedToTime":null,"sound":{"displayName":"Simple Alarm","folder":null,"id":"system_alerts_melodic_01","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_01.mp3"},"status":"OFF","targetPersonProfiles":null,"timeZoneId":null,"timerLabel":null,"tmwNotificationProperties":null,"triggerTime":0,"type":"Alarm","version":"81"},{"alarmTime":0,"automationId":null,"createdDate":1581717987717,"deferredAtTime":null,"deliveryType":null,"deviceName":null,"deviceSerialNumber":"xxxxxxx","deviceType":"A1RABVCI4QCIKC","extensibleAttribute":null,"geoLocationTriggerData":null,"id":"A1RABVCI4QCIKC-xxxxxx-ac4f1bee-cd90-33b4-bbbe-4c20c1d191f1","lastOccurrenceTimeInMilli":0,"lastUpdatedDate":0,"musicAlarmId":null,"musicEntity":null,"notificationIndex":"ac4f1bee-cd90-33b4-bbbe-4c20c1d191f1","originalDate":"2020-02-15","originalTime":"09:00:00.000","personProfile":null,"provider":null,"rRuleData":null,"recurrenceEligibility":false,"recurringPattern":null,"remainingTime":0,"reminderAppLabel":null,"reminderLabel":null,"reminderSubLabel":null,"skillInfo":null,"snoozedToTime":null,"sound":{"displayName":"Simple Alarm","folder":null,"id":"system_alerts_melodic_01","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_01.mp3"},"status":"OFF","targetPersonProfiles":null,"timeZoneId":null,"timerLabel":null,"tmwNotificationProperties":null,"triggerTime":0,"type":"Alarm","version":"3"},{"alarmTime":1583798400000,"automationId":null,"createdDate":1582700396167,"deferredAtTime":null,"deliveryType":null,"deviceName":null,"deviceSerialNumber":"xxxxxxxx","deviceType":"A1RABVCI4QCIKC","extensibleAttribute":null,"geoLocationTriggerData":null,"id":"A1RABVCI4QCIKC-xxxxxxx-f76fc3fc-768d-490d-afb0-a9ec92ce0e4f","lastOccurrenceTimeInMilli":0,"lastUpdatedDate":0,"musicAlarmId":null,"musicEntity":null,"notificationIndex":"f76fc3fc-768d-490d-afb0-a9ec92ce0e4f","originalDate":"2020-03-10","originalTime":"07:15:00.000","personProfile":null,"provider":null,"rRuleData":null,"recurrenceEligibility":false,"recurringPattern":"XXXX-WD","remainingTime":0,"reminderAppLabel":null,"reminderLabel":null,"reminderSubLabel":null,"skillInfo":null,"snoozedToTime":null,"sound":{"displayName":"Simple Alarm","folder":null,"id":"system_alerts_melodic_01","providerId":"ECHO","sampleUrl":"https://s3.amazonaws.com/deeappservice.prod.notificationtones/system_alerts_melodic_01.mp3"},"status":"OFF","targetPersonProfiles":null,"timeZoneId":null,"timerLabel":null,"tmwNotificationProperties":null,"triggerTime":0,"type":"Alarm","version":"81"}]}

@alandtse
Copy link
Owner

Thanks, can you identify which ones wasn't showing up that should've been showing up?

@chemelli74
Copy link
Contributor Author

Thanks, can you identify which ones wasn't showing up that should've been showing up?

Alarm was 8:00 am for working days

Simone

@alandtse
Copy link
Owner

alandtse commented Mar 15, 2020

Can you please provide the attributes for the next_alarm sensor in HA for that item? Is sorted_active empty?

Also, can you confirm whether at the time you took the notifications info, whether the date was in the past for you?

"originalDate":"2020-03-13","originalTime":"08:00:00.000"

@alandtse alandtse changed the title "next_alarm" not updated "next_alarm" not updated for timers with recurrence Mar 16, 2020
@alandtse
Copy link
Owner

Never mind. Was able to reproduce it and have a fix.

@alandtse
Copy link
Owner

As a further note, Amazon does update the alarm json at midnight so any timers will show the next day's timers.

alandtse added a commit that referenced this issue Mar 18, 2020
fix: fix next timer for recurrence alarms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants