MIUIGlobal 10.0.6.0 nächster Alarm

Post your questions and help other users.

Moderator: Martin

Hofi
Posts: 6
Joined: 27 Nov 2018 14:44

MIUIGlobal 10.0.6.0 nächster Alarm

Post by Hofi » 30 Nov 2018 06:52

Hallo zusammen,

ich habe ein merkwürdiges Problem, seitdem ich mein Xiaomi MiMix 2s habe:

Als Weckerapp verwende ich Alarmdroid.

Ich habe einen Flow erstellt, der mich bei einem bestimmten Ereignis (Nachricht von Pushsafer) eine Stunde vor dem eigentlich Wecker weckt. Das ist auf meinem Samsung Galaxy S6 edge wunderbar gelaufen.
Seitdem ich nun auf ein Xiaomi umgestiegen bin, kann ich die nächste Weckzeit nicht mehr auslesen:

Die Variable next_alarm liefert einen Zeitwert max. 5 Minuten in der Zukunft (obwohl da zu 100% kein Wecker gestellt ist). Wenn dieser Zeitwert erreicht wird, wird die Variable automatisch um 5 Minuten hochgezählt. Was soll das? :?:
Screenshot_2018-11-30-07-33-18-264_ch.gridvision.ppam.androidautomagic.png
Ausgabe Variable Next_Alarm
Screenshot_2018-11-30-07-33-18-264_ch.gridvision.ppam.androidautomagic.png (67.86 KiB) Viewed 17003 times
Die Systemvariablen Next_Alarm_Formatted oder Next_Alarm_clock_formatted geben leider nicht den nächsten Alarm von Alarmdroid aus, sondern nur den nächsten Alarm des Systemweckers.


Android Version: 9 PKQ1
MIUI: 10.0.6.0 (Global)
Automagic Version:1.36.0

Was mich einfach wundert: es hat ja bereits mal funktioniert, aber jetzt ist irgendwas anders :|
Habt ihr einen Tipp für mich, wie ich zuverlässig wieder an die Zeit des nächsten Alarmes komme?

Danke schonmal!!

Grüße

Andreas

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: MIUIGlobal 10.0.6.0 nächster Alarm

Post by Martin » 30 Nov 2018 20:36

Hallo Andreas

Das Problem könnte durch eine App verursacht werden, welche sich bei Android wie ein Wecker anmeldet (z.B. Automagic bei einem Trigger Periodischer Timer mit Option 'Wie Wecker') oder einer beliebigen anderen App, welche alle 5 Minuten etwas ausführen will und sich ähnlich einem Wecker verhält. Kandidaten sind andere Automatisierungstools oder Apps, welche z.B. alle 5 Minuten etwas machen wollen oder etwas synchronisieren und auf eine möglichst zeitgenaue Ausführung angewiesen sind.
Verdächtig wäre auch, wenn du alle Wecker in Alarmdroid deaktivierst und in der Statuszeile das Wecker-Symbol noch angezeigt bleibt. Bei einigen ROMs kann man die Statusbar expandieren und auf die Weckzeit klicken, um die zugehörige App zu öffnen.

Freundliche Grüsse
Martin

Hofi
Posts: 6
Joined: 27 Nov 2018 14:44

Re: MIUIGlobal 10.0.6.0 nächster Alarm

Post by Hofi » 03 Dec 2018 08:11

Martin wrote:Das Problem könnte durch eine App verursacht werden, welche sich bei Android wie ein Wecker anmeldet (z.B. Automagic bei einem Trigger Periodischer Timer mit Option 'Wie Wecker')...
Hallo Martin,

vielen Dank! Tatsächlich wars Automagic selber mit einem periodischen Timer. :shock:

Jetzt wird als Weckzeit 15.30 Uhr angezeigt, obwohl da kein Wecker gestellt ist und ich vorsichtshalber alle Flows deaktiviert habe. Kann ich irgendwie die App auslesen lassen, die diese Weckzeit an das System meldet?

Danke vielmals, da hätte ich ja noch ewig gesucht :P

Grüße

Andreas

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: MIUIGlobal 10.0.6.0 nächster Alarm

Post by Martin » 04 Dec 2018 20:42

Hallo Andreas

Das ist leider etwas knifflig.
Folgender Flow sollte den Packagenamen der App anzeigen: Find alarm app.

Der Flow ist nicht besonders robust und wird mit einem Fehler abbrechen, wenn kein Alarm gestellt ist, die Android Version zu alt ist oder die verursachende App keinen Intent registriert hat.
Ich hoffe der Flow funktioniert in deinem Fall.

Freundliche Grüsse
Martin

Hofi
Posts: 6
Joined: 27 Nov 2018 14:44

Re: MIUIGlobal 10.0.6.0 nächster Alarm

Post by Hofi » 05 Dec 2018 08:30

Hallo Martin,

der Flow hat einwandfrei funktioniert, danke dafür!

Das Ergebnis war leider wenig zufriedenstellend: com.android.calendar
Tatsächlich ist zu diesem Zeitpunkt ein Termin gestellt, jedoch in einem fremden, eingebundenen Kalender. Die Erinnerung an diesen Termin wird auch nicht auf dem lokalen Gerät durchgeführt sondern auf dem Gerät des Kalenderbesitzers, 10 min vor dem eigentlich Termin.

D.h. mir wird momentan als "next_Alarm" 12:00 Uhr angezeigt, basierend auf einem Alarmtrigger der App "com.android.calendar". Der Termin, auf den sich dieser "next_alarm" anscheinend bezieht, ist in einem eingebundenenm, fremden Kalender gespeichert mit der Erinnerungszeit 11:50 Uhr.
Ich erhalte auf dem betroffenen Gerät für diesen Termin gar keine Erinnerung, die Erinnerung erfolgt nur auf dem Gerät des Kalenderbesitzers.

Ich habe echt keine Ahnung mehr, wie ich dieses Problem in den Griff bekommen soll... Hast du noch irgendwelche Ideen?

Danke!

Grüße

Andreas

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: MIUIGlobal 10.0.6.0 nächster Alarm

Post by Martin » 07 Dec 2018 20:44

Hallo Andreas

Da bin ich nun ehrlich gesagt etwas ratlos. Evtl. kannst du in den Einstellungen der Kalender-App etwas einstellen, Benachrichtigungen für diesen Kalender ausschalten oder eine andere Kalenderapp verwenden.

Freundliche Grüsse
Martin

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: MIUIGlobal 10.0.6.0 nächster Alarm

Post by Desmanto » 09 Dec 2018 17:38

When I am using MIUI, the next_alarm also not working properly. I am now on RR 6.2.0, the next_alarm shows the proper next alarm schedule.

To read the alarm, probably need root. I don't use MIUI now, so can't test it. Don't know if query content provide can work.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Hofi
Posts: 6
Joined: 27 Nov 2018 14:44

Re: MIUIGlobal 10.0.6.0 nächster Alarm

Post by Hofi » 10 Dec 2018 15:22

Hello Desmanto,

yes, it seems to be a MIUI issue for the next_alarm problem.

In the meantime, I've switched my alarm clock app from my prefered one, alarmdroid, to the stock alarm clock. Now, i'm getting the correct alarm time using Next_Alarm_clock_formatted (Next_Alarm_formatted is showing the alarm 1 hour earlier???!!)

But do you have a hint for me how to work with the content from Next_Alarm_clock_formatted?
I want to have an (automagic-)alarm one hour before my "normal" alarm clock rings (means, 1 hour before Next_Alarm_clock_formatted).

But i can not calculate with the data given from Next_Alarm_clock_formatted, its like a string containing letters and numbers, e.g.: Mo. 17:00
Maybe "query content provider" is the right thing for me, but, to be honest, i never worked with that and i don't know how to parse the default Xiaomi alarm app.

I'm getting totally crazy right now, the flow worked fine on many different phones and after switching to XIAOMI, it is getting complicated.

I really hope you or someone else can help me! At the moment, I have to get up one hour earlier every day, looking out of the window if there is snow on the street and if no, go to bed again. Thats really anoying :roll: :roll:

Thanks in advance

BR

Andreas

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: MIUIGlobal 10.0.6.0 nächster Alarm

Post by Desmanto » 11 Dec 2018 05:31

I have checked the query content provider and can't find any method to list all available alarms. Don't know if there is any way to do it without root. I have root, I can query directly using SQLite to the /data/user_de/0/com.google.android.deskclock/databases/alarms.db (LOS based ROM clock db is stored at /user_de). Non root user have to use other method, just as you have done.


So you have solved the next alarm problem. But you need to convert from "Mon 17:00" to a proper date. It can be parsed by pattern, but it lose its week, month and year; since it is converted to 0 based (1st Jan 1970, thursday). We have to added back the latest week counted from the 0 based.

It takes probably around 1 hours spanned accross several hours to get this right. Didn't realize it is quite complicated. I tested several function and some date pattern doesn't work when used in getDate(), such as the "c". After 50-60 trials, finally get it working. But I think the script is still ugly. I am open to any better idea than mine below

Assume your next_alarm_formatted is stored at variable {alarm}

Code: Select all

alarm = "Mon 17:00";

talarm = getDate(alarm, "EEE HH:mm");
toweek = getDate() / (7*86400000) * (7*86400000) ;

nexta = toweek + talarm;
if(nexta < getDate())
  nexta = addDays(nexta, 7);

reminder = addHours(nexta, -1);
{talarm} get the date from the alarm, but in 0 based. So it will the first monday after 1st Jan 1970

{toweek} get the latest week anchor. It is using the common method to round off to the nearest week. divide by 7 days (7* 86400000 miliseconds) and multiply again by the same value. Tested on today : Tuesday, 12 Dec 2018, 12:00, It will truncate the decimal and get you Thursday, 6 Dec 2018, 00:00 (will be different hours based on your timezone).

{nexta} is next alarm, add the talarm and toweek. We will get Monday, 10 Dec 2018, 17:00. But it is impossible to have alarm in the past, so we check it again to current date. If it is less than today, then add 7 days to it. Finally we get nexta = 17 Dec 2018, 17:00.

Since you want reminder to be 1 hour before, minus this 1 hour. {reminder} should contain the time, 1 hour before your next alarm.

Put the script into script and add condition debug dialog to check it. You should check {reminder} whether it is correct already. Try to change the alarm to "Tue 17:00" or "Wed 20:00", or any other value to see if it is working as expected.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Hofi
Posts: 6
Joined: 27 Nov 2018 14:44

Re: MIUIGlobal 10.0.6.0 nächster Alarm

Post by Hofi » 11 Dec 2018 14:57

Wow! Thats really amazing! This is exactly, what i was looking for! Now, my flow comes back to life again!!

I will do some test during the next hours to see, if everything is working, but at the moment, it looks fantastic!

Many Many thanks, is there any way to buy you a beer or to donate?
You spent a lot of time solving my problem(s), i really appreciate that!

Best Regards

Andreas

Post Reply