Help with constraint or condition

Creeper

New member
I have a system setting that turns off automatically every time I lock the screen or when the system setting is turned on for more than 7 hours. I need it to stay on all the time when the charger is plugged in, so I added a condition (System Setting Change Trigger) which turns it back on automatically every time it turns itself off. And I need to be able to turn it off manually when the screen is on, so I added another condition which sets a variable and prevents it from running the next ELSE IF statement which action turns it back on, since the macro I'm working on has a lot of conditions. Now, I also want the macro to be able to turn itself back on if it turned off automatically when the screen is on, the problem is it can't tell if it's triggered by a user or it turned itself off automatically so it set's the variable instead and doesn't run the next ELSE IF statement which is supposed to turn it back on.

I thought of using variables from Global/Secure/System Table so it knows that it was triggered manually through the quick setting tile or the game space while gaming but it might not work with other devices (newer models) since the variable names might be different. And I can't use the Macros Invoked Recently constraint because I have a regular interval trigger triggering every 10 secs. I though of using stopwatch but then again it would be inaccurate since I do not know if the system setting turns itself off at 7 hours or not, and I would prefer not to use a time constraint if possible so it works with all devices.

I'm currently using the following constraint to set the variable

Trigger
- System Setting Change

Actions
else if
- Power Connected
- Battery < 80%
- System Setting = 0
- Trigger Fired: System Setting Change
- Screen = ON

What constraint or condition would be best here so it doesn't set the variable when it turns off automatically and not triggered by the user so it runs the next ELSE IF statement? Sorry, I'm still noob in programming and still learning how to use MacroDroid. Thanks!
 

Qarboz

Well-known member
I have a system setting that turns off automatically every time I lock the screen or when the system setting is turned on for more than 7 hours. I need it to stay on all the time when the charger is plugged in, so I added a condition (System Setting Change Trigger) which turns it back on automatically every time it turns itself off. And I need to be able to turn it off manually when the screen is on, so I added another condition which sets a variable and prevents it from running the next ELSE IF statement which action turns it back on, since the macro I'm working on has a lot of conditions. Now, I also want the macro to be able to turn itself back on if it turned off automatically when the screen is on, the problem is it can't tell if it's triggered by a user or it turned itself off automatically so it set's the variable instead and doesn't run the next ELSE IF statement which is supposed to turn it back on.

I thought of using variables from Global/Secure/System Table so it knows that it was triggered manually through the quick setting tile or the game space while gaming but it might not work with other devices (newer models) since the variable names might be different. And I can't use the Macros Invoked Recently constraint because I have a regular interval trigger triggering every 10 secs. I though of using stopwatch but then again it would be inaccurate since I do not know if the system setting turns itself off at 7 hours or not, and I would prefer not to use a time constraint if possible so it works with all devices.

I'm currently using the following constraint to set the variable

Trigger
- System Setting Change

Actions
else if
- Power Connected
- Battery < 80%
- System Setting = 0
- Trigger Fired: System Setting Change
- Screen = ON

What constraint or condition would be best here so it doesn't set the variable when it turns off automatically and not triggered by the user so it runs the next ELSE IF statement? Sorry, I'm still noob in programming and still learning how to use MacroDroid. Thanks!
You could create a widget button or quick tile to manually change the setting, that way you know if the setting is changed automatically or by the user
 

Creeper

New member
You could create a widget button or quick tile to manually change the setting, that way you know if the setting is changed automatically or by the user
I forgot to mention that this setting is turned ON through the quick setting tile or through the game space overlay while gaming. And the variable that let's you turn on or off through the quick setting tile control both the system setting and the quick setting tile variable.

If I just use the Global system setting directly without the quick setting tile variable there is no way to turn it off manually as the quick setting tile won't light up. I need both the settings as one is used for showing the notification so I can turn it on/off through the quick setting tile and the other for turning on/off the setting.

Right now it doesn't matter if I turn it off through the quick setting tile manually or it just turned itself off automatically, it still counts as manually or the same thing so it always sets the variable. If I use the quick setting tile variable as constraint or condition it just sets the variable zero or doesn't let you turn off the setting manually at all.

Its needs a way to differentiate if it is turned off manually or automatically or now or later, but I don't want to use a time constraint as it might not be accurate. Sorry for being a noob, lol. It's so confusing.
 

Qarboz

Well-known member
I forgot to mention that this setting is turned ON through the quick setting tile or through the game space overlay while gaming. And the variable that let's you turn on or off through the quick setting tile control both the system setting and the quick setting tile variable.

If I just use the Global system setting directly without the quick setting tile variable there is no way to turn it off manually as the quick setting tile won't light up. I need both the settings as one is used for showing the notification so I can turn it on/off through the quick setting tile and the other for turning on/off the setting.

Right now it doesn't matter if I turn it off through the quick setting tile manually or it just turned itself off automatically, it still counts as manually or the same thing so it always sets the variable. If I use the quick setting tile variable as constraint or condition it just sets the variable zero or doesn't let you turn off the setting manually at all.

Its needs a way to differentiate if it is turned off manually or automatically or now or later, but I don't want to use a time constraint as it might not be accurate. Sorry for being a noob, lol. It's so confusing.
With the quick tile you can set another bool variable that stores the user's intention to true; remember to put it false if the setting is activated, either automatically or by the user.
 

Creeper

New member
With the quick tile you can set another bool variable that stores the user's intention to true; remember to put it false if the setting is activated, either automatically or by the user.
Thanks, using the quick setting tile finally did the trick but is there any way I can do this with the default or system quick setting tile? The default quick setting tile shows On or Off status and shows you a small arrow that opens a pop up or a small window like how you can choose from a list of available Wi-Fi. Idk if it is possible to make it look like that with MacroDroid's Tile. And I would like to keep the macro simple, just import and run instead of having to do all that like adding a tile, etc.
 

Qarboz

Well-known member
Thanks, using the quick setting tile finally did the trick but is there any way I can do this with the default or system quick setting tile? The default quick setting tile shows On or Off status and shows you a small arrow that opens a pop up or a small window like how you can choose from a list of available Wi-Fi. Idk if it is possible to make it look like that with MacroDroid's Tile. And I would like to keep the macro simple, just import and run instead of having to do all that like adding a tile, etc.
There is the quick tile long-press trigger, and there is also the action to change the quick tile icon and text.
More info here
 
Top