Waschmaschine timer / washing machine dryer timer

Share and discuss your flows and ideas with other users.

Moderator: Martin

Post Reply
User avatar
yogi108
Posts: 100
Joined: 09 Nov 2016 08:00
Contact:

Waschmaschine timer / washing machine dryer timer

Post by yogi108 » 19 Oct 2017 08:17

--------------------------------------------------
----------- English version below --------------
--------------------------------------------------


Im Prinzip ist es eine einfache Problemstellung, die mit dem Androidtimer schmucklos erledigt werden kann.
Die Idee kam über Jennes, Hilfestellung bei Details von Desmanto.

Die Aufgabenstellung:
Nach Eingabe von Minuten die Endzeit berechnen, und via Benachrichtigungsleiste/Sperrbildschirm den aktuellen
Status ausgeben.

Die Ausführung:
Erfolgt über 2 flows.

der Startflow, initialisieren und berechnen, 2 Globalvariablen festlegen für Beginn und Ende des Timers, Benachrichtigung erstellen, flow trigger aktivieren
der Triggerflow,
  • Beenden bei Ablauf, Sound abspielen (Trigger Variable Datum/Zeit), inaktiv setzen des trigger flows
  • Abbrechen durch Antippen der Action in der Benachrichtung oder der Benachrichtigung selbst, inaktiv setzen des trigger flows
  • Aktualisieren der Benachrichtigung durch Display ein, Öffnen der Benachrichtigungsleiste, Neustart von AM
Der Timer übersteht auch ein Ausschalten/Neustart des Handys durch den Trigger "Variable Datum/Zeit".
Wurde das Handy ausgeschalten und der Timer ist abgelaufen, wird der Alarm nachgeholt. Braucht man länger für den
Login, als das der Start von AM braucht, hört man zwar den Alarm, jedoch wurde auf meinem Handy der darauf folgende
Meldungsdialog nicht angezeigt - der workaround war ein Eingabedialog, mit dem funktioniert es. (Huawei P9 lite 7.0)

Die Benachrichtigung wird mit Fortschrittsbalken und Information Beginn-Ende ausstehende Zeit aktualisiert.
Ein Detail, über das ich schon öfter gestolpert bin, war die noch verbleibende Zeit mittels getDurationString.
Es geht zwar auch über dateformat, mir ist die Funktion lieber. Gestört hat bisher immer die Angabe der Millisekunden.
Desmanto hat uns da etwas auf die Sprünge geholfen mit

Code: Select all

// wenn mehr als 10 Minuten keine Sekunden anzeigen
if(global_WMEnde-triggertime>600000)
{
  faktor=60000;
} else
{
  faktor=1000;
}
restzeit=getDurationString((global_WMEnde-triggertime)/faktor*faktor);
Der Trick ist die verbleibende Zeit durch einen Faktor zu dividieren (Division von Integer ergibt Integer!) und wieder
mit demselben Faktor multiplizieren.
Der Faktor ergibt sich aus der gewünschten Zeit bzw. nicht gewünschten Zeit.
1000 Millisekunden sind 1 Sekunde, Faktor = 1000, somit werden keine Millisekunden mehr angezeigt.
60000 Millisekunden sind 60 Sekunden (1 Minute), Faktor = 60.000, somit werden keine Sekunden und keine Millisekunden angezeigt.

LG

-------------------------------------------
----------- English version --------------
-------------------------------------------

It is a simple problem and can be managed by the standard Android stuff in less seconds.

The original idea from Jennes, help in the details from Desmanto.

The task:
After entering minutes, calculate the end time and use the notification bar / lock screen to display the current status.

Execution:
is done with 2 flows.

the start-up flow, initialize and calculate , set 2 global variables for the start and end of the timer, create notification, activate flow trigger

the Triggerflow,
  • Exit on expiration, play sound (trigger variable date / time), deactivate trigger flow
  • Cancel by tapping the action in the notification or tap the notification itself, deactivate trigger flow
  • Refresh the notification by display on or open the notification bar or restart of AM
The timer also triggers a switch off / restart of the mobile phone by the trigger "variable date / time".
If the mobile phone has been switched off and the timer has expired, the alarm is running on startup.
If you need longer for the Login, as the start of AM needs, one hears the alarm, however, on my mobile
the following Message dialog is not displayed - the workaround was an input dialog which works. (Huawei P9 lite 7.0)

The notification is updated with a progress bar and information start/end and pending time.
A detail, which I have stumbled on often, was the remaining time using getDurationString.
You can also use date format, I prefer the function. The milliseconds are not wanted.
Desmanto has helped us a bit with some hints:

Code: Select all

// if more then 10 minutes left show no seconds
if(global_WMEnde-triggertime>600000)
{
  faktor=60000;
} else
{
  faktor=1000;
}
restzeit=getDurationString((global_WMEnde-triggertime)/faktor*faktor);
The trick is to divide the remaining time by a factor (division of integer yields integer!) and again
multiply by the same factor.
The factor is determined by the desired time or the non-desired time.
1000 milliseconds are 1 second, factor = 1000, thus no milliseconds are displayed.
60000 milliseconds are 60 seconds (1 minute), factor = 60000 so no seconds or milliseconds are displayed.

kind regards,
Attachments
Waschmaschine.xml
(18.4 KiB) Downloaded 1125 times
"You cannot know the meaning of your life until you are connected to the power that created you.”
Shri Mataji Nirmala Devi, founder of Sahaja Yoga

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

Re: Waschmaschine timer / washing machine dryer timer

Post by Desmanto » 19 Oct 2017 16:05

Thanks for the flow and the explanation. I just know we can make notification progress bar using that way. I should adopt the concept to my flow then.

Actually it can be done in single flow, by removing the Display on Trigger (since maybe only this one will triggerred too much when the flow is not used). All other triggers such as event ui and notification won't get trigger if the notification is not there. GloVar date/time also won't trigger if the time has passed. Automagic startup only once every restart. But yeah, if you need the display on trigger, it should be separated to 2 flows to minimize battery usage.
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.

Jennes
Posts: 21
Joined: 19 May 2017 12:22

Re: Waschmaschine timer / washing machine dryer timer

Post by Jennes » 06 Aug 2018 10:57

Hallo nochmal,
kann es sein, dass bei Oreo der Trigger "Fenster geöffnet - Benachrichtungsleiste" nicht mehr funktioniert??

Das Aktualisieren der Restlaufzeit funktioniert bei mir nur noch, wenn ich das Gerät aus und wieder anschalte und der Sperrbildschirm zu sehen ist. Das Herunterziehen der Benachrichtungsleiste hat keinerlei Auswirkung mehr ... (separat getestet mit eigenem Flow)

Gibt es da evtl. eine Lösung?

Herzlichen Dank für weitere Unterstützung
VG Jennes

Post Reply