Is it possible to enable/disable a camera component with a service?

I have a custom camera that grabs screenshots from my TV over http. I’d like to only do these queries when the TV is on (which should be available in an entity called sensor.tv_living_powerstate).
I’d like to create an automation so that when the powerstate changes to off, the camera which requests screenshots is disabled as well. So - how do I enable/disable a component at runtime?