Trouble inverting value from door sensor

All of the sensors for my doors read closed when they are closed except for 1. This one shows on when it is actually closed.

My intent is to reverse the state for this 1 door sensor so on=open and off=closed.

In the ESPHOME config for my konnected device, I added the following config but am getting an error during validation stating that Pin 36 is used in multiple places.
I realize that in build 2023.12.1 there is logic to prevent pin reuse and I thought I took care of that using the newer pin schema along with the allow_other_uses setting.

binary_sensor:
  - platform: gpio
    device_class: door
    name: "Zone 9"
    pin:
      number: GPIO36
      inverted: true
      allow_other_uses: true

I am on the following build versions:

  • HomeAssistant; build:2023.471; iOS 16.1.2
  • ESPHome version 2023.12.1 compiled on Dec 22 2023, 23:01:44
  • Project konnected.alarm-panel-pro-esp32-wifi version 0.4.0

Any assistance appreciated.

thanks,
John

Does GPIO36 appear anywhere else in your yaml file?

hi Nick,

No - this is the only sensor I have defined in the file

I just had a play, and with GPIO36 being the only mention it seems to throw an error as there is no other definition for GPIO36. So I am guessing allow_other_uses: true throws an error if it is not needed (because GPIO36 is not defined anywhere else.) I’ll keep playing…

I just commented out allow_other_uses and got the pin error still. I only added that b/c I got that error in the first attempt to invert the values on the door sensor.

One other possibly relevant piece of info: I read through the esphome validation log and GPIO36 is only referenced twice - both times for the same ‘zone 9’ so it doesn’t look like it’s used for anything else

Perhaps your complete yaml will reveal something. If you post it I will try it.

yep - should have added that at the beginning:
(below is the current version minus the # signs used to comment out the yaml that didn’t work and the removed encryption key value)

substitutions:
  name: alarm-panel-pro-ac9e40
  friendly_name: Alarm Panel Pro ac9e40
packages:
  konnected.alarm-panel-pro-esp32-wifi: github://konnected-io/konnected-esphome/alarm-panel-pro-esp32-ethernet.yaml@master
esphome:
  name: ${name}
  name_add_mac_suffix: false
  friendly_name: ${friendly_name}
api:
  encryption:
    key: removed_before_posting

#binary_sensor:
#  - platform: gpio
#    device_class: door
#    name: "Zone 9"
#    pin:
#      number: GPIO36
#      inverted: true
#      allow_other_uses: true```

please excuse my bad code formatting

I suspect GPIO36 is defined somewhere in github://konnected-io/konnected-esphome/alarm-panel-pro-esp32-ethernet.yaml@master and when you try and redefine it in your config it is conflicting. The package file refers to a number of other packages and I soon got confused trying to trace the code.

Perhaps a template (either in esphome or in HA) reversing the logic would be easier.

1 Like

got it - thanks for looking into it

1 Like