Turn off Lights when Laptop goes to sleep

Hey there,

I am trying to utilize the “active” sensor from the HASS MacOs App to control the lights when my macbook goes into sleep / wakes up. For this I created two automations:

  • one that turns the lights on, when the active sensor from my macbook turns to “on” (works fine)
  • another that turns the lights off, when my macbook goes into sleep

The trigger on the latter automation isn’t firing as planned and I have no clue what I am doing wrong.
I want to use the “Sleeping” attribute, as shown on this screenshot of the entity:

Bildschirmfoto 2021-12-21 um 08.57.40

I tried to set it up both via Yaml and using the UI but nothing happens…
All the conditions are setup correct. I tried it without them but the automation is still not triggerd. Here is my automation:

Can someone point me in the right direction?

Sorry in advance, if I am making a major beginner mistake. I am fairly new to HA…

Thanks!

Have you tried creating a sensor from the ‘Sleeping’ attribute?
That way, you can see the status to ensure it’s actually changing.

No I have not. Sounds promising, I will try that out next. Thanks!

EDIT:
Worked like a charm. Thanks again!

1 Like

Nice!

Glad you got it working