Enable/disable local webserver

I have a need to enable/disable the webserver using a binary sensor, for maintenance/adjustments to the node.

Can this be done?

When

webserver:
  local: true

is configured, does the webserver serve up the page on http://192.168.4.1/ when there is no connection to WiFi?

I’d also like to disable the captive portal with a binary sensor. Is this possible? Or at least make it hidden.

Webserver cannot be enabled/disabled dynamically