Which variable?

Post your questions and help other users.

Moderator: Martin

apshergill91
Posts: 18
Joined: 07 Dec 2013 05:59

Which variable?

Post by apshergill91 » 25 Sep 2015 03:00

Which variable can be used to get brightness level?

And how can it be triggered?

bogdyro
Posts: 241
Joined: 04 Apr 2015 15:14

Re: Which variable?

Post by bogdyro » 25 Sep 2015 04:22

What to you want to do in your flow? There's a trigger light sensor and an action set screen brightness.

eldron
Posts: 45
Joined: 27 Apr 2015 08:21

Re: Which variable?

Post by eldron » 25 Sep 2015 07:03

I am guessing that he means the equivalent to "store audio volumes", just for brightness. I was also looking for that action, but couldn´t find it.
When you use a flow to adjust the brightness it would be nice if you could revert it to the old settings afterwards (as you can do with volume levels).
But maybe that´s not what apshergill91 meant, so some more information on what you are planning on doing with your flow would be helpful.

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Which variable?

Post by MURTUMA » 25 Sep 2015 09:53

Init system setting action should work. I don't know the setting name, but search for something related to brightness. Value is propably between 0 and 100 or 0 and 255.

eldron
Posts: 45
Joined: 27 Apr 2015 08:21

Re: Which variable?

Post by eldron » 25 Sep 2015 11:27

I have had a look into init system settings / set system settings, but I ended up with some wierd behaviour. I have a Galaxy S4, which can switch between manual and automatic brightness control, each with it´s own brightness setting.
So there are three variables that I need: Manual brightness level, automatic brightness level and the brightness level mode (auto or manual).
I went through the list of system settings and found three variables, which change their values according to my current settings, so I am quite sure that they are the correct ones:
screen_brightness (manual brightness level), auto_brightness_detail (for auto brightness level) and screen_brightness_mode (to switch between the modes).
I then set up a flow to save these values and turn them into global variables.
Another flow picks up those global variables and sets them. This is where things turn wierd.
The manual brightness is set to the correct value, but the auto brightness doesn´t change and the phone is always set to manual mode, regardless of which mode was saved.
The strangest part is that if I check the values of the variables (through the init system setings), they were correctly set back to the saved values. But if I check the phones beightness settings I can see that they were not restored to the saved settings (apart from the manual setting).
The log of my "set brightness settings" flow says that everything went fine. It shows me that all 3 variables were set from value y(current setting) to value x (saved setting).
any idea how to solve this issue?
EDIT: I just tried the "set brightness level" action, which can sucessfully set the auto level and the brightness mode. That shows that automagic can set those values, I just don´t know how to set them to my saved values.

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

Re: Which variable?

Post by Martin » 27 Sep 2015 18:05

Setting the screen brightness can be tricky on Android since the system will usually not pick up the values when the values are directly set in the system settings database. However, Android usually picks up the new values when the screen is turned off and on again. Is this also the case on your device?
As an alternative, you could use the Init Variable System Setting to remember the values but use the regular action Set Screen Brightness to restore the values. The text fields for manual and adaptive brightness accept variables in the form {your_variable}.

eldron
Posts: 45
Joined: 27 Apr 2015 08:21

Re: Which variable?

Post by eldron » 27 Sep 2015 19:12

Hi Martin,
thanks for your input and ideas.
You are right, after locking and unlocking the screen the values are updated, but it still won´t activate the automatic mode.
I also had a look into the other option (using the "set screen brightness"). But again I don´t know how I can make it tick or untick the auto mode...?

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Which variable?

Post by MURTUMA » 28 Sep 2015 06:43

eldron wrote:I don´t know how I can make it tick or untick the auto mode...?
You can use two actions. One with auto-brightness checked and one without. Depending on how you have made your flow(s) the are a few different ways to determine which one to execute.

eldron
Posts: 45
Joined: 27 Apr 2015 08:21

Re: Which variable?

Post by eldron » 28 Sep 2015 07:10

@Murtuma
That´s a good idea. So is it possible to set up a condition that checks the global value for screen_brightness_mode (possible values are 0 and 1)? Which conditon would I have to use for that?
Thanks for your help!

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: Which variable?

Post by MURTUMA » 28 Sep 2015 09:01

One way would be as follows:
Action init system setting: "screen_brightness_mode" (I assume it shows values 1 and 0 for on and off)
Condition expression: "screen_brightness_mode == 1"
→TRUE if auto brightness is on
→FALSE if it is off


You can also create your own boolean variables somewhere in your flow and then check it with similar expression condition to decide wollowing actions. You should choose the method depending on what suits your flow best, but the latter method has more diverse use cases.

Post Reply