Disable ESP CAM32 feed from sensor

Hello, I am trying to set up a function on an AI Thinker ESP CAM. What I want to do is be able to have the camera to have its own “privacy” mode. That is, the ESP will disable its own feed based upon the status of a sensor.
I have the camera working fine, I have the sensor working fine, but I can’t see how to have the camera suspend its own feed.

I can see that there is a power_down_pin on GPIO32, so I assume that I can manipulate that? However, I then tried creating a GPIO switch using the GPIO but, quite logically, I’m not allowed as the GPIO is being used as part of the camera entity.

So, is there a way? Am I heading in the right direction?

It’s worth saying that I know that I could do this in HA, but I really want the camera to handle the control internally, if possible.

TIA

Gpio pins have option:
allow_other_uses: true
Not sure if that’s the most elegant way here though.
Feel free to post your yaml…

Thank you. The camera is just bog standard as:

esp32_camera:
  external_clock:
    pin: GPIO0
    frequency: 20MHz
  i2c_pins:
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: GPIO32
  resolution: 1280x1024

What I then tried to add, was simply

switch:
  - platform: gpio
    pin: GPIO32
    name: "Privacy mode"

It feels as if I’m close to being able to do what I need, but I’m stuck at this hurdle.

Have you tried, as @Karosm suggested, allow_other_uses?

I hadn’t (due to the comments), but I now have and it works perfectly! I can now toggle the camera feed on and off as I needed.

Thanks to both of you!

In case anyone else has the same problem:

esp32_camera:
  external_clock:
    pin: GPIO0
    frequency: 20MHz
  i2c_pins:
    sda: GPIO26
    scl: GPIO27
  data_pins: [GPIO5, GPIO18, GPIO19, GPIO21, GPIO36, GPIO39, GPIO34, GPIO35]
  vsync_pin: GPIO25
  href_pin: GPIO23
  pixel_clock_pin: GPIO22
  power_down_pin: 
    number: GPIO32
    allow_other_uses: true
  resolution: 1280x1024

and

switch:        
- platform: gpio
  name: "Flash"
  pin: GPIO4  
- platform: gpio
  pin: 
    number: GPIO32
    allow_other_uses: true
  name: "Privacy mode"