Motioneye + Logi USB Webcam

Setup: Raspberry Pi 5 running Home Assistant OS with MotionEye.

My webcam is working, but I need help with automation. When my alarm is disarmed, I want to fully power off the webcam (the video device itself) — not just disable motion detection. While MotionEye’s UI has a switch for this, I’d like to trigger it automatically via a Home Assistant automation.

How can I do this programmatically?