athombv / homey-web-api-issues

This issue tracker is for Homey Developers using the Web API.
4 stars 1 forks source link

Previous value in HomeyAPIV2.ManagerAlarms.Alarm nextOccurance after HomeyAPIV2.alarms.updateAlarm #25

Closed oh2th closed 1 year ago

oh2th commented 1 year ago

On app start I fetch all alarms with HomeyAPIV2.alarms.getAlarms and have a result:

{
  "id": "27f59121-f08b-418d-ae59-ded2f54c5713",
  "name": "AlarmUtils Test 3",
  "time": "20:04",
  "enabled": true,
  "repetition": {
    "monday": false,
    "tuesday": false,
    "wednesday": false,
    "thursday": false,
    "friday": false,
    "saturday": false,
    "sunday": false
  },
  "nextOccurance": "2023-01-27T18:04:00.000Z"
}

And as such that is fine, however if I update the alarm from Homey mobile app, or from a flowCard in my app fi.oh2th.alarmutils using getAlarm({ id: alarm.id }) the result has nextOccurance always one update behind.

For example if I now update the time to 19:04 and repetition for Wednesdays, the next getAlarm({ id: alarm.id }) will result in:

{
  "id": "27f59121-f08b-418d-ae59-ded2f54c5713",
  "name": "AlarmUtils Test 3",
  "time": "19:04",
  "enabled": true,
  "repetition": {
    "monday": false,
    "tuesday": false,
    "wednesday": true,
    "thursday": false,
    "friday": false,
    "saturday": false,
   "sunday": false
  },
  "nextOccurance": "2023-01-27T18:04:00.000Z"
}

where everything else is correct except nextOccurance is still the old value. Now of I update again, nextOccurance becomes the previous value.

oh2th commented 1 year ago

https://github.com/athombv/homey-apps-sdk-issues/issues/287