Unlock Ubuntu as automation trigger

I am running home assistant core I think (whatever hassio is now) on a pi. My main PC runs Ubuntu and I have a light strip behind the monitor. I’d like to turn on the light strip whenever my PC is unlocked. How can I use the locked/unlocked status of Ubuntu to trigger an automation in HA?

Home Assistant Core is Home Assistant running in a python virtual environment. Hassio became ‘Home Assistant OS’.

1 Like

I’ve not tried this, but the idea from the links below is that Ubuntu’s dbus subsystem run the shown script on lock or unlock, in this script run the hass cli utility showing in the 2nd link below to turn the light on or off, depending on if screen is locking or unlocking.

Good hunting!

https://askubuntu.com/questions/858236/how-do-i-call-dbus-code-that-monitors-when-screen-is-locked-unlocked

```

```
https://github.com/home-assistant-ecosystem/home-assistant-cli
```