Esp32 GPIO Matrix and IO MUX system

Wondering if there is any development to take advantage of this functionality? Search returned nothing. In my case I’d like to be able switching pin modes in code to monitor different devices on the same pin : leak sensor and motion sensor.

Muxing is working fine on esphome, pin can be defined as I/O, uart, i2c, ledc…
Dynamic swapping can be more restricted.
You don’t specify what are you exactly after. Esphome has allow_other_uses parameter and you probably can change pinmodes on lambda.

hi, I’m running esp32 with this yaml: water leak, DS18B20 sensors, two reed switches. Also want to add HC-SR501 PIR motion sensor without opening the box just using one of the pins that is outside on terminal block (these are accessible : GPIO35- ADC leak detector, GPIO32, 33- switches, GPIO16 -one wire) . I’m thinking may be use GPIO16 for PIR? Reference to documentation or yaml example would be very helpful. Thank you

- platform: adc
    pin: GPIO35   # Heater and HVAC leak sensor
    attenuation: auto
    icon: mdi:water-alert
    name: "Heater & AC leak"
    id: water_heater_ac_leak
    unit_of_measurement: "%"
    accuracy_decimals: 0

    filters:
    - sliding_window_moving_average:
          window_size: 5
          send_every: 5
          send_first_at: 1     

    - calibrate_linear:
        - 3.0 -> 0
        - 1.5 -> 100
    
    - clamp:
        min_value: 0
        max_value: 100
        ignore_out_of_range: False
    
    #update_interval: 12s  
      
  
  #DS18B20 Actual sensor
  - platform: dallas_temp
    address: 0x6f791cd435646128
    name: "Temperature Attic"
    id: temperature_attic
    unit_of_measurement: "°C"
    icon: "mdi:thermometer"
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 2
    update_interval: 30s
  - platform: dallas_temp
    address: 0x8f161dd435646128
    name: "Temperature Garage"
    id: temperature_garage
    unit_of_measurement: "°C"
    icon: "mdi:thermometer"
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 2
    update_interval: 60s  

  - platform: dallas_temp
    address: 0x9c000000bbf38728
    name: "Temperature Water Heater"
    id: temperature_water_heater
    unit_of_measurement: "°C"
    icon: "mdi:thermometer"
    device_class: "temperature"
    state_class: "measurement"
    accuracy_decimals: 2
    update_interval: 60s  


binary_sensor:
  - platform: template
    name: "Status"
    lambda: |-
         float analog = id(water_heater_ac_leak).state;
         return analog > 60; 
    on_press:
      then:
        - switch.turn_on: buzzer_sw
        - switch.turn_on: buzzer
    on_release:
      then:
        - switch.turn_off: buzzer_sw
        - switch.turn_off: buzzer
  

  - platform: gpio
    name: "Garage door Closed"
    id: garage_door_closed
    pin:
      number: GPIO32
      mode:
        input: true
        pullup: true
    filters:
      - delayed_off: 500ms

  - platform: gpio
    name: "Garage door Open"
    id: garage_door_open
    pin:
      number: GPIO33
      mode:
        input: true
        pullup: true
    filters:
      - delayed_off: 500ms


switch:
  - platform: gpio
    name: buzzer_sw
    id: buzzer_sw
    pin:
      number: GPIO2
    inverted: false
  
  - platform: template
    name: buzzer
    id: buzzer
    optimistic: true
    turn_on_action:
    - while:
        condition:
          lambda: 'return true;'
        then:
        - switch.turn_on: buzzer_sw
        - delay: 10s 
        - switch.turn_off: buzzer_sw
        - delay: 20s
    turn_off_action:
    - switch.turn_off: buzzer_sw       

one_wire:
  - platform: gpio
    pin: 
      number: GPIO16
      mode:
        input: true
        pullup: true

I don’t see this viable. Afaik HC-SR501 has push-pull output, it will not “collaborate” with other circuits connected.

Ok, Thank you.