Johboh / hassalarm

Android app for integration with Hass.io as a sensor for the next scheduled alarm on the device
MIT License
62 stars 6 forks source link

Only syncs for a few minutes after app is closed and only resyncs when app is opened. #4

Closed TychoWerner closed 4 years ago

TychoWerner commented 5 years ago

The clock state is perfectly synced when I recently opened the hassalarm but when I exit out of the hassalarm app it works fine for a minute or so and then I try and it doesn't sync. It's been 5 minutes now whilst my phone has a connection and it doesn't sync over.

Johboh commented 5 years ago

It should eventually sync, within an hour or so after you have set the alarm. It does not sync directly due to WorkManager scheduling. Can you confirm that it eventually syncs?

TychoWerner commented 5 years ago

Will test it now, set my alarm with the app closed, will check to see if it updated.

TychoWerner commented 5 years ago

I’ve let it to sync all night, but it won’t sync with the app closed. The moment I opened hassalarm it goes.

I have a Huawei P Smart

Johboh commented 5 years ago

Ok, then I have to look into it. And you haven't set it to not allow background work?

TychoWerner commented 5 years ago

Hi @Johboh

I have found Battery Optimization and I have removed HASSAlarm from it and it still seems like it won't update unless the app is in the background.

Will check in about an hour to see if it still has gone thru.

Thanks for making this though.

TychoWerner commented 5 years ago

Hi @Johboh

I have found Battery Optimization and I have removed HASSAlarm from it and it still seems like it won't update unless the app is in the background.

Will check in about an hour to see if it still has gone thru.

Thanks for making this though.

Waited an hour for it to sync but I haven't gotten it to sync actually. I have WiFi on and mobile data as well; the second I open the app itself it sync's instantly.

oxan commented 4 years ago

I'm also experiencing this issue. Did you manage to find a solution?

TychoWerner commented 4 years ago

I'm also experiencing this issue. Did you manage to find a solution?

I haven't found a solution yet :/

Johboh commented 4 years ago

Sorry, I haven't had a chance to look at this yet. @oxan, what device do you have?

oxan commented 4 years ago

I'm using a OnePlus 6, stock firmware, Android 9.

Johboh commented 4 years ago

So I think I know what this is. I'm using a strict policy for the background task to not waste battery, so the job will only run when the device is on wifi and connected to a charger, and then within hours. I can change this so its not that strict.

Johboh commented 4 years ago

@oxan @TychoWerner I pushed a new version new that is more aggressive in job scheduling. A job should be scheduled within 1h after changing the alarm clock value. Also, what alarm clock app are you using?

weado commented 4 years ago

Hi, I the same issue on my Samsung S8. after change my alarm time on my phone, I have to lauch the Hassalarm app to send the new information to my HA. unfortunately, It's the same with your last version.

Do not hesitate if you want some help to try (Sorry I don't know develop)

Johboh commented 4 years ago

@weado can you verify that you don't have any kind of task killer installed? And that you don't have battery optimization enabled for the hassalarm app (i.e disable it for this app)? Did you also wait up to one hour after changing the time? The job is scheduled to run within one hour. Given the above, can you also test with another alarm clock? For example the Alarm Clock Xtreme or the Google stock alarm clock.

weado commented 4 years ago

Hello, I'm sorry my last message, but I didn't understand that I need to have to wait a little time (until 1 hour) to HassAlarm send the informations to HA. Thank you for this app !

Johboh commented 4 years ago

Yes its not obvious :) I will add an "about" section in the app with some documentation.

Johboh commented 4 years ago

I'm closing this. Please reopen if there are still issues with this and I will look into it.