Replies: 7 comments 1 reply
-
#917 is for the SensorKit part of this, but SensorKit looks like it's going to be similar to HealthKit -- something that's likely off-limits for most things :( It looks like Firefox/Mozilla found a private-ish API route to get the data, but Apple's locked it down in newer Macs. I'm not sure why they're so tightlipped about this info. Making the current screen brightness level available may be an okay analog. |
Beta Was this translation helpful? Give feedback.
-
My guess it's because of this: https://blog.lukaszolejnik.com/stealing-sensitive-browser-data-with-the-w3c-ambient-light-sensor-api/ My hope was/is that now with an "official" way it might not interfere with the Mac App store policy. |
Beta Was this translation helpful? Give feedback.
-
I think Lunar gets around this by reading the main display brightness, which is then set automatically using the sensor. In other words, the display brightness is used as a proxy. There's also an AmbientDisplay.framework being mentioned in the code, but that's way out of my depth. |
Beta Was this translation helpful? Give feedback.
-
Looks like @insidegui found a way to grab the state reliably: https://github.com/insidegui/DarkModeBuddy |
Beta Was this translation helpful? Give feedback.
-
I know it's an old thread, but did you anybody look into this since then? |
Beta Was this translation helpful? Give feedback.
-
I would really like to see this implemented if possible. Moving roller shutters and turning on lights based on the ambient light sensor of my Macbook would be awesome. |
Beta Was this translation helpful? Give feedback.
-
https://github.com/grischard/dotfiles/blob/osx-1/util/macos-ambient-light-sensor/lmutracker.mm is maybe a bit more readable than the DarkModeBuddy code - it tries to retrieve the ambient light sensor data using two APIs. In the meantime, a simple esphome ambient light sensor at my desk is providing the necessary data for my automations. |
Beta Was this translation helpful? Give feedback.
-
After searching around, it seams, that it is now possible with Mac OS Big Sur (Mac Catalyst 14.0+) to get information of the ambient light sensor in a easy way without any hacks like before.
https://developer.apple.com/documentation/sensorkit/srsensor/3377673-ambientlightsensor
Describe the solution you'd like
The ambient light sensor of the mac delivers a light level value [Lux]. A HA Automation turns on (or off) desk lights, when it is too dark(bright). Similar to motion sensor like Philips Hue ones.
Beta Was this translation helpful? Give feedback.
All reactions