HowTo: Get value of built-in light sensor

HCC

Member
Hi, I want to display the brightness value of the built-in light sensor in a "Floating Text".
I can display the battery temperature (battery_temp) and the system time (system_time)
without problems.
-How do I display the brightness value of the light sensor ?


Battery temperature ---> {battery_temp}
Time ---> {system_time}
Current value of light sensor ---> { ? }



PS:
I changed the Android Settings to "1 minute" because normally the light sensor is inactive when screen off:

Android Settings -> Trigger options -> Light sensor trigger -> Light sensor background update rate: [1 minute]

Now the light sensor provides the brightness value every minute.
 

HCC

Member
The
{current_brightness} is the brightness of the display
and not the brightness of the built-in brightness sensor.
 

sampleuserhere

Active member
Afaik there isn't any built-in magic text that could retrieve the value of light sensor.

The workaround I could think of is by using other apps to query the sensor and return back the result to MD.

with Termux, termux:tasker, and Termux:api, you may execute the following line.

Code:
termux-sensor -s "Ambient Light Sensor Non-wakeup" -n "1"

Output:

{
  "stk_stk3a5x Ambient Light Sensor Non-wakeup": {
    "values": [
      0
    ]
  }
}

Or send an intent to Tasker/Automate and have them send back the result to MD via intent, both is capable to query the light sensor. There may be a plugin that supports this as well, I don't exactly know either though.

Anyway, Someone did send a request about this a year and a half ago.

 

Xaon420

New member
Afaik there isn't any built-in magic text that could retrieve the value of light sensor.

The workaround I could think of is by using other apps to query the sensor and return back the result to MD.

with Termux, termux:tasker, and Termux:api, you may execute the following line.

Code:
termux-sensor -s "Ambient Light Sensor Non-wakeup" -n "1"

Output:

{
  "stk_stk3a5x Ambient Light Sensor Non-wakeup": {
    "values": [
      0
    ]
  }
}

Or send an intent to Tasker/Automate and have them send back the result to MD via intent, both is capable to query the light sensor. There may be a plugin that supports this as well, I don't exactly know either though.

Anyway, Someone did send a request about this a year and a half ago.

I can send my new version of autobrightness when it's done, as I have been daily driving a MD solution for a year now but it's not using sensors at all really, but it may provide some solution for you
 
Top