esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
292 stars 36 forks source link

MCP23017 inputs aren't properly configured on boot #2775

Closed ficueu closed 2 years ago

ficueu commented 2 years ago

The problem

If previous firmware set pullup: true - pullup is enabled, next while trying to upload new firmware with changed pullup: false input has still enabled pullup resistor. Looks like MCP remember last set registers while ESPHome not setting those properly after reboot.

Steps to reproducing this problem:

  1. Measured voltage after uploading - pin 0 to GND - should be ~VCC
mcp23017:
  - id: 'mcp23017_hub'
    address: 0x20

binary_sensor:
  - platform: gpio
    name: "MCP23017 Pin #1"
    pin:
      mcp23xxx: mcp23017_hub
      number: 0
      mode:
        input: true
        pullup: true
      inverted: false
  1. Measured voltage after uploading - pin 0 to GND - should be 0.
mcp23017:
  - id: 'mcp23017_hub'
    address: 0x20

binary_sensor:
  - platform: gpio
    name: "MCP23017 Pin #1"
    pin:
      mcp23xxx: mcp23017_hub
      number: 0
      mode:
        input: true
        pullup: false
      inverted: false

Next I wrote sample sketch with Arduino and execute command to disable pullup on pin 0 then measured voltage and it was 0V.

Which version of ESPHome has the issue?

2021.11.4

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

core-2021.11.5

What platform are you using?

ESP32

Board

esp32-dev

Component causing the issue

mcp23017

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

oxan commented 2 years ago

Can you try esphome/esphome#2855?

external_components:
- source: github://pr#2855
  components: [ mcp23x17_base ]
probot-esphome[bot] commented 2 years ago

Hey there @jesserockz, mind taking a look at this issue as it has been labeled with an integration (mcp23x17_base) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)

ficueu commented 2 years ago

@oxan, tried, working great. Tested on few gpios.