Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Ambient Light Sensor Mac #1333

Closed
mnium opened this issue Jan 2, 2021 · 4 comments
Closed

Using Ambient Light Sensor Mac #1333

mnium opened this issue Jan 2, 2021 · 4 comments

Comments

@mnium
Copy link

mnium commented Jan 2, 2021

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.

@zacwest
Copy link
Member

zacwest commented Jan 2, 2021

#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.

@mnium
Copy link
Author

mnium commented Jan 2, 2021

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.

@grischard
Copy link

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.

@zacwest
Copy link
Member

zacwest commented Feb 24, 2021

Looks like @insidegui found a way to grab the state reliably: https://github.com/insidegui/DarkModeBuddy

@home-assistant home-assistant locked and limited conversation to collaborators Jul 18, 2021
@zacwest zacwest closed this as completed Jul 18, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Projects
None yet
Development

No branches or pull requests

3 participants