Do not Disturb (DND)

Post your feature requets for new triggers, conditions, actions and other improvements.

Moderator: Martin

Post Reply
User avatar
Uli
Posts: 14
Joined: 30 Mar 2019 21:10

Do not Disturb (DND)

Post by Uli » 01 Apr 2019 07:39

Hi to all,
at first I want to say, that <i am very suprised about the tool automagic It seems to be great. I am no computer scientist, but I like programming in my free time.

Until today, I found no app, which is working very good in case of "Do not disturb". So i decided to do it myself. But every beginning is hard as you know. I hope, you can help me in some questions.
:)

There are several things which shoulfd be checked and for which I don't find some discription.

+ how can I get the phone-number which is just calling?
+ how can I check, whether this number (person) is member of a group in my phonebook?

The task should start at a certain time.
Then want to switch off sound and vibration.
I have to wait for a phone call.
The number of a phonecall should then be checked of member of a group or not.
then the task has to decide, whether this group is allowed to call me or not.
If not the cellphone should hang up at once, if yes the cellphone should vibrate or ring.
At another time of the day this task is to be deactivated.

I would be very glad, if you could help me. Perhaps there is a similar tast already, which I did not found.

One other question from a beginner. Does a List exists with all commands and features with an explanantion? And does a kind of tutorial exist, which explains all from the beginning?

I alread want to say thank you very much for your help.

Kind regards
Uli

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

Re: Do not Disturb (DND)

Post by Desmanto » 01 Apr 2019 10:17

What is your phone and ROM? I think most phone already have the setting for DND, to allow only certain number/alarm to pass when it is enabled. You should use built-in one if it is available. However, the behaviour and available actions can be limited, so Automagic can extend it.


Since you are going to use DND, and you want to activate it only at certain time, we should separate it to at least 2 flows. Flow 1 is to use trigger time and set the time when you want the DND enabled. Add action to Set interruption mode to None (enable DND) and set ringer mode to silent/vibrate. Then use Set Flow State to enable the incoming call flow 3 (below).

At Another flow 2, set the time again when you want to disable the DND and set ringer mode to normal back. Disable the incoming call flow 3. Essentially this toggle back flow 1.

Remember, depends on the android version, these 2 setting must be enabled separately. At mine, RR 7.0.1 Pie 9.0, DND and ringer mode are separated, and I have to enable both to achieve maximum silence (no notif from apps and silent ringing).

Create another flow 3, use trigger Incoming Call. You can check all available variable provided by this trigger, by pressing "?" (question mark) in the trigger menu.

To get the number, use {incoming_number}. If you have save the contact for that number, you can have {contact_name} and {contact_groups}. Check this group to see if you want to allow it. Use condition expression to check it, example

Code: Select all

contact_groups == "Family"
True, change the ringer mode to normal, to allow the call to ring (and set interruption mode to All (disable DND)). Add sleep 30 seconds, and then change ringer mode to silent/vibrate again. (we only allow the ring for maximum 30 seconds)
False, Action end call


To know every documentation about automagic, you can look at my index, at the subsection General - tutorial and documentation. I spent 4 days just to read the documentation at the first time I try Automagic. You can look at various examples also at my index. There is subsection for Phone Call. But AFAIR, there is no flows yet to do the things you want in this case.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

User avatar
Uli
Posts: 14
Joined: 30 Mar 2019 21:10

Re: Do not Disturb (DND)

Post by Uli » 02 Apr 2019 19:57

Hi Desmanto,

at first ... thank you very much for your time and help.

The next day I will use aour advices and create these flows. But I fear, that there will be some questions. :(

My cell phone is Samsung Galaxy S10+.

And no, I can only use 1 single DND. And that is not enough. With my last cellphone HTC U11 I could create multiple tasks for DND ... and I miss them. :(

Again, thank you very much for your help! :!:

Uli

User avatar
Uli
Posts: 14
Joined: 30 Mar 2019 21:10

Re: Do not Disturb (DND)

Post by Uli » 12 Apr 2019 14:48

Desmanto wrote:What is your phone and ROM? I think most phone already have the setting for DND, to allow only certain number/alarm to pass when it is enabled. You should use built-in one if it is available. However, the behaviour and available actions can be limited, so Automagic can extend it.


Since you are going to use DND, and you want to activate it only at certain time, we should separate it to at least 2 flows. Flow 1 is to use trigger time and set the time when you want the DND enabled. Add action to Set interruption mode to None (enable DND) and set ringer mode to silent/vibrate. Then use Set Flow State to enable the incoming call flow 3 (below).

... set ringer mode to silent/vibrate ...
Sorry, I am using the german version of Automagic and I cannot find, where I can enable and disable this setup. Could you please give me a hint? ;-)
The rest I have already done.


At Another flow 2, set the time again when you want to disable the DND and set ringer mode to normal back. Disable the incoming call flow 3. Essentially this toggle back flow 1.

OK!

Remember, depends on the android version, these 2 setting must be enabled separately. At mine, RR 7.0.1 Pie 9.0, DND and ringer mode are separated, and I have to enable both to achieve maximum silence (no notif from apps and silent ringing).

Create another flow 3, use trigger Incoming Call. You can check all available variable provided by this trigger, by pressing "?" (question mark) in the trigger menu.

To get the number, use {incoming_number}. If you have save the contact for that number, you can have {contact_name} and {contact_groups}. Check this group to see if you want to allow it. Use condition expression to check it, example

Code: Select all

contact_groups == "Family"
True, change the ringer mode to normal, to allow the call to ring (and set interruption mode to All (disable DND)). Add sleep 30 seconds, and then change ringer mode to silent/vibrate again. (we only allow the ring for maximum 30 seconds)
False, Action end call

Ok, but the change of the interruption mode is only for this group, I think!?

To know every documentation about automagic, you can look at my index, at the subsection General - tutorial and documentation. I spent 4 days just to read the documentation at the first time I try Automagic. You can look at various examples also at my index. There is subsection for Phone Call. But AFAIR, there is no flows yet to do the things you want in this case.
Desmanto, again thank you very much for your help and maybe for my stupid questions. :?

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

Re: Do not Disturb (DND)

Post by Desmanto » 13 Apr 2019 17:18

Uli wrote: Sorry, I am using the german version of Automagic and I cannot find, where I can enable and disable this setup. Could you please give me a hint? ;-)
The rest I have already done.


Ok, but the change of the interruption mode is only for this group, I think!?
In German, it should be "Soundprofil einstellen", set ringer mode.

Yes, change the interruption only for that group. However, since we change the DND for global, during that 30 seconds, if there is someone called, even not from family group; the phoen still ring. But that's OK right, since you when you are in call, you won't mind the ringing already.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

User avatar
Uli
Posts: 14
Joined: 30 Mar 2019 21:10

Re: Do not Disturb (DND)

Post by Uli » 16 Apr 2019 16:03

Hi Desmanto,

I am really glad to get your help. Thank you very much again!!!

"Soundprofil einstellen" works!!!

What I want to achieve with DND is, that in my free time (no job, no work) all allowed numbers/groups will vibrate and/or ring. All other calls of numbers, which are not mentioned in "free numbers"/groups" shall be blocked at once. It should not ring one single time.

So, I think, I have to create a condition, which distinguishes between both cases of numbers and should vibrate and/or ring or should block the other numbers.

My problemn is, that I don't know, how to create this condition.

And the next problem is, that I cannot find the possibility to block numbers at once. Can you please help me!?

I think, I could find the synrax for blocking a number in your large index. But I did not find it. Where can I find this (and other commands) in your index? I would like to use it.

Thanks and kind regards
Uli

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

Re: Do not Disturb (DND)

Post by Desmanto » 20 Apr 2019 04:38

Do you mean my index thread link? It is at : viewtopic.php?f=6&t=6993
Look at Section Communication > Phone Call. But there is no exact case as you want. I haven't updated the index for long time. Gotta update it in the near future.


To separate the numbers you don't want to ring, simply filter out the allowed number. You are basically using whitelist mode here. So you define a group of number and several free numbers which will be whitelisted and ring when they call. Then all other numbers outside of these will be blocked and not ringing at all.

To achieve maximum effect, you should always use ringing mode vibrate/silent. Or you simply set the ringtone to no sound/silent sound. Then the branch for whitelisted number will turn the ringing mode to normal for a while (30 seconds) or set the ringtone to some ringing sound. Or maybe easier to use action sound directly in Automagic to make it ring (but you have to add additional trigger Incoming Call - Off-Hook, to stop the sound).

The condition expression to check it, is almost the same as before. You can check the group or the numbers defined, as answered by ariloc in your other thread. You can combine both.

Code: Select all

whitelist = newList(
"081122334455",
"088877665544",
"081234567890");

contact_groups == "Family" OR containsElement(whitelist, incoming_number);
This expression will check if the group is "Family" OR it is one of the whitelisted numbers defined. If any of these is true, then go to true branch, set the ringer mode to normal or ring the sound. If false, do nothing or reject the call using end call. Even if you do nothing, the phone won't ring anymore, because you have set the ringer mode to vibrate/silent.


===================================
But actually, not everything need Automagic. Sometimes we just can do it using built-in feature from the OS. Or only with some little help from Automagic.

You don't need DND all the time, or set the ringer mode to vibrate/silent all the time. All you have to do is to set your primary ringtone sound to no sound/silent sound. Most phones have it, if not, you can download a "no sound" file and use it as the ringtone. So all incoming call have ringtone "no sound". Then for each contact groups or whitelisted number, just set custom ringtone with the ringing one (have sound). Done.

All your defined contact group or numbers will ringing as usual, while all others numbers will ring with "no sound". Your DND is off (no need turn on DND) and ringer mode still normal.

If you need other numbers to ring with "sound" during work time, then you only need small help from Automagic. Trigger time (start working time) and action Set Default Ringtone to some ringtone with sound. Another Trigger Time (after work hour) to set it back to "no sound". Much easier to be done.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

User avatar
Uli
Posts: 14
Joined: 30 Mar 2019 21:10

Re: Do not Disturb (DND)

Post by Uli » 21 Apr 2019 13:10

Thanks❗❗❗
It works
👍🏼☺️

User avatar
Uli
Posts: 14
Joined: 30 Mar 2019 21:10

Re: Do not Disturb (DND)

Post by Uli » 21 Apr 2019 14:05

One last question ...

This is the code:

whitelist = newList("+49157712456789", "01577987654321");
contact_groups == "VIP" OR containsElement(whitelist, incoming_number);

In the contacts of my smartphone there is a Group called VIP. The phonenumbers in this Group are not accepted like the numbers above. Why not? 😥

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

Re: Do not Disturb (DND)

Post by Desmanto » 21 Apr 2019 17:29

Add condition debug dialog after the expression and connect both true and false from the expression to the debug dialog. Then try to call from any of the VIP number, check the value of the {contact_groups} in the debug dialog. It can be the value provided has space or any extra string.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), Resurrection Remix Official 7.0.2 20190829, Pie 9.0, Rooted.

Post Reply