PCF8574 driver - setup not getting called
- Dominant language
- No language data
- Stars
- 313
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Description
### The problem
I am using a PCF8575 with all 16 pins configured as inputs. My testing (modifying the code with inline logging statements) indicates that PCF8574Component::setup() and PCF8574GPIOPin::setup() are never getting called at startup (or ever).
The net of that is that PCF8574Component::write_gpio_() never gets called, so the pins never get a "1" written to them as is required for them to function correctly as inputs.
[TL;DR: In my circuit, the inputs are floating normally, sometimes get shorted to ground. My device is a NXP PCF8575 with the internal 100 uA current source that performs a weak pull-up function.]
The device works okay. I was able to force configuration of the pins at the end of config by hacking dump_summary(), and I see that gpio_write_() does get called in this case:
std::string PCF8574GPIOPin::dump_summary() const {
char buffer[32];
snprintf(buffer, sizeof(buffer), "%u via PCF8574", pin_);
if (pin_==15) parent_->setup();
return buffer;
}
Is there something I need to do to cause setup() to get called? Or is this a bug?
### Which version of ESPHome has the issue?
2023.4.0
### What type of installation are you using?
Docker
### Which version of Home Assistant has the issue?
Not using Home Assistant in this test
### What platform are you using?
ESP32
### Board
ESP32-DevKitC V4
### Component causing the issue
PCF8574
### Example YAML snippet
_No response_
### Anything in the logs that might be useful for us?
_No response_
### Additional information
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.