Get the Sleep/Wake Status of the Screen?

Is it possible to get the status of the screen? I know I could hack around things by either keeping my screen always on with energy preferences, or always using the "wake" action, but I'm trying to add my Mac Screen to HomeKit via the HTTP Switch plugin and it would be nice to check the status (as that is supported).

Good heavens ... this is two years old, but have the issues really gone away ?

[Apple Is Struggling To Stop A 'Skeleton Key' Hack On Home Wi-Fi](Apple Is Struggling To Stop A 'Skeleton Key' Hack On Home Wi-Fi)

I appreciate the concern, but this doesn't solve the problem I have :wink:

Yes, there is, although it's a little confusing SCREENSAVER will tell you if the screensaver is on or if the display is asleep.

(I don't think it's possible to check for just the screen being asleep vs the screen saver being on.)

To use it, add an IF/ELSE block and set "the calculation" "SCREENSAVER()" is true, like so:

ScreenSaverKM

1 Like

@peternlewis

Please consider changing SCREENSAVER() to:

SCREENSAVERSTATUS()

or

SCREENSAVERRUNNING()

So the function is perfectly clear.

-Chris

I'm unlikely to make that change. The advantage is insufficient to incur the cost in terms of backwards compatibility.

1 Like