Controlling a Light when using a webcam

Hi,
I would like to make an automation to switch on a light when my webcam on my PC will be on.
Is there a way to expose a handle of when the webcam is on?

EDIT:
PC is windows 10 and camera connected via usb and it will be used for MS Teams and Zoom.
HA is running on a different server (debian + docker)

Soooo many unknowns. To start with, what operating system are you running on the PC, and is HA running on the same machine?

you are right and sorry for that.
PC is windows 10 and camera connected via usb and it will be used for MS Teams and Zoom.
HA is running on a different server (debian + docker)

Have a look at the Windows Event Viewer and see if you can work out if any activity aligns to your web cam going on and off.

You can certainly tap into Teams status: I’ve seen projects where people have created “on air” lights like this one.

will take a look … is there a way to expose the windows events?
I was hoping there is an app that once can install on the PC, and once the webcam is active it will change it status or send a trigger. anyway will take a look

Do you have an update on this? I want to do the same with a light.

unfortunately no

I stumbled across this:

So far I installed it and together with the Mosquitto Broker Add-on from Supervisor I now have a sensor entity that shows me if the webcam is on/off (and the same for the microphone).

No long-term experience yet, but so far it looks promising.

I’m using HASS Workstation Service too.

I don’t have a webcam but I use the microphone sensor in order to mute my music when I am talking on the computer (phone or Microsoft Teams).

For Microsoft Teams I use the following as well: