Android alarm and openHAB2

restapi
Tags: #<Tag:0x00007f015a053c70>

(Ben) #21

I’ve got a prob with the app updating the value in OH2 much to often.

2018-03-28 20:40:23.529 [vent.ItemStateChangedEvent] - wakeup changed from 1522296000 to 0
2018-03-28 20:40:27.134 [vent.ItemStateChangedEvent] - wakeup changed from 0 to 1522263031
2018-03-28 20:40:35.624 [vent.ItemStateChangedEvent] - wakeup changed from 1522263031 to 0
2018-03-28 20:40:40.572 [vent.ItemStateChangedEvent] - wakeup changed from 0 to 1522263045
2018-03-28 20:40:44.481 [vent.ItemStateChangedEvent] - wakeup changed from 1522263045 to 0
2018-03-28 20:41:15.810 [vent.ItemStateChangedEvent] - wakeup changed from 0 to 1522263080
2018-03-28 20:41:19.146 [vent.ItemStateChangedEvent] - wakeup changed from 1522263080 to 0
2018-03-28 20:41:22.574 [vent.ItemStateChangedEvent] - wakeup changed from 0 to 1522263086
2018-03-28 20:41:23.985 [vent.ItemStateChangedEvent] - wakeup changed from 1522263086 to 0

Everytime I am touching my phone, the app sends the “new” alarm value to OH. As you can see, the time differs but I didnt change my alarm at all. So the app doesn’t recognize, that the actuall alarm hasn’t changed and there’s no need to send a new value.


(Eberhard Kahlenberger) #22

Strange … I guess there is another app using the alarm feature to schedule things it has to do … I’m already working on the next version and try to improve the behavior. Right now I would assume, that you don’t have any alarm scheduled … as 0 is only send if there is no alarm and if an app scheduled alarm time is reached or revoked, it should fall back to the android alarm clock alarm and not 0.
I can only read the next alarm value, as the android API is designed that way. If there is another app constantly scheduling things, the android alarm clock alarm might never be visible, until its over :confused: … We’ll see…

Do you have any app installed, doing some background work or something like that?

I’m looking into it


(Ben) #23

Thanks for your fast reply. Just found out what this issue causes. You were quite right with another app causing that behavior. The problem is tasker. Although I am not using the alarm clock in my tasker tasks, if I’m switching tasker off everything is fine.


(Eberhard Kahlenberger) #24

Great news :smiley: … I can find out which app scheduled the next alarm. I think about showing which apps scheduled an alarm and allow the user to exclude certain apps while allowing different android alarm apps. Might take a moment to implement :wink:


(Eberhard Kahlenberger) #25

I implemented that feature. Unfortunately, I don’t get tasker to schedule any alarms for me. But I seems to work. The beta version is life in google play and released on github.com. I will publish it as soon as google approves my latest changes.


(Eric Zenz-Matzl) #26

Hi Eberhard,

Your APP is awesome.
But it seems not to work with my AlarmClock APP (AlarmDroid).

I have there multiple alarms configured, each (or most of them) for more then one day.
But the current behavior is, that after the current alarm is triggered, the Item change to 0.

2018-12-05 06:00:03.869 [vent.ItemStateChangedEvent] - AndroidAlarm changed from 1543986000 to 0

Only if i open your APP, the item will get the next alarm, but after this one triggered i have the same problem again…

I have a Galaxy S7 running on Android 8.0.0

I would be great if you can help me.


(Eberhard Kahlenberger) #27

Hi Eric,

since I also use AlarmDroid, I exclude that. I’m too running Android 8.0.0 (although on a Sony device). I know that the current alarm is not always sent to the server, but right now I’ve got no real clue why.
I guess that the app gets unloaded by the os and therefore receives no alarm anymore (Although this should actually not happen, because the app should be started on any alarm change) or is unloaded while trying to sent the next alarm to the server (which is more likely)

There are multiple things that are happening in the app. When the alarm is scheduled, the app is called and reads the next alarm from the AlarmManager. If the app, that scheduled the alarm, is allowed to do so, the rest call is made. Now things get tricky as this might fail due to numerous reasons. If that happens, the request ist scheduled to run again after 30s (but android can decide to delay that, as long as it wants :/). WLAN has to be on, assuming that openhab is running in a home network.
If the rest call is answered with anything but 200 HTTP OK by the openhab server, this alarm will be disregarded.

Is there any error message displayed in the app?
Is there any app disallowing “Home Automation Alarm Sender” to run?
Is WLAN on?


(Eric Zenz-Matzl) #28

Hi Eberhard,

Thanks for the reply.
You are right, my OH is running in a home network, but WIFI was enabled all the time.
I see no App which is disallowing HAAS to run, also i don’t see any error in the APP (when i’m in the wifi).

I tested it yesterday also with an other APP, which should detect the alarm and send the info via MQTT to Openhab.
But this app also failed…

I only get the new AlarmDate when i open your APP (also tested with other Alarm Clocks).

I think the problem is that i have a Samsung phone.
I will test it again in the evening with my old LG, maybe i’m lucky…


(Eberhard Kahlenberger) #29

another idea: there might be something about power management. Maybe allowing background activity for HAAS or excluding its background activity from power saving is helping.


(Mueller Ma) #30

I opened a PR to add this functionality to the official app: https://github.com/openhab/openhab-android/pull/1137.
If someone wants to give it a try, here’s the apk: https://github.com/openhab/openhab-android/pull/1137#issuecomment-446747581