DAC32 output shall be set to high impedance mode

I am new to ESPHOME. I use a ESP32 with a climate PID. Output is a DAC32. I want to deactivate the heat/DAC32 output GPIO25. This shall be not 0V but high impedance.
I tried to the pin to input using below lambda but this does not seem to work. It still behaves like 0V
Any guidance would be highly appreciated.
pinMode(25, INPUT);

I know, a bit late, but…

Your code works when switching a GPIO between digital In and out. Maybe the DAC output works differently. I don’t know how to set the “pinMode” for analog pins…

I have used this code with a “select” component, to switch 2 GPIO pins back and forth between output low, and high impedance input:

select:
  - platform: template
    name: Range Ch 1
    id: range_ch1
    options:
     #- "Auto"
     - "2,5V"
     - "16V"
     - "100V"
    initial_option: "16V"
    optimistic: true
    on_value:
      then:
        lambda: |-
          if(i==0) {
            pinMode(6, INPUT);
            pinMode(7, INPUT);
          }
          if(i==1) {
            pinMode(6, OUTPUT);
            digitalWrite(6, LOW);
            pinMode(7, INPUT);
          }
          if(i==2) {
            pinMode(7, OUTPUT);
            digitalWrite(7, LOW);
            pinMode(6, INPUT);
          }

Works on a ESP32-C3.