Closed meijerwynand closed 3 years ago
Well, did not test this but ESPHome measures time between sending a trigger and receiving an echo, while this could be done via a port expansor, getting reliable results will be a nightmare, so I recommend you to not use port expansion pins in this case.
ultrasonic source ultrasonic issues ultrasonic recent changes (message by IssueLinks)
Well, did not test this but ESPHome measures time between sending a trigger and receiving an echo, while this could be done via a port expansor, getting reliable results will be a nightmare, so I recommend you to not use port expansion pins in this case.
That is what I was testing with, a port expander. The chip is supported as per documentation.
As you mentioned results may not be as reliable, however, for the use case I have in mind should not be an issue. Using a distance sensor to check whether a vehicle is present in the garage. Thus nano second response time is not high on the requirements list.
Thank you for taking the time to look into the issue and giving feedback. It is much appreciated.
The echo_pin is defined in the config to only accept a gpio pin, not a general pin config. As already mentioned, this is due to the timing requirements and it most likely also uses an interrupt. If your timing requirements are that flexible, you could implement it yourself with a switch:
and binary_sensor:
using a global variable to measure the time.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Operating environment/Installation (Hass.io/Docker/pip/etc.):
pip
ESP8266 (NodeMCU):
EPS8266 NodeMCU
ESPHome version (latest production, beta, dev branch)
ESPHome v1.15.2
Affected component:
https://esphome.io/components/sensor/ultrasonic.html
Description of problem: When attempting to add an ultrasonic distance sensor on a PCF8574, I am unable to specify the
echo_pin
as an "i2c" pin. The compiler stops with an error message[pcf8574] is an invalid option for [echo_pin].
Problem-relevant YAML-configuration entries:
Expected config to work:
Expected config to work log:
Expected config to work note:
The
trigger_pin
option does not appear to be subjected to this issue / limitationAdditional information and things you've tried:
Alternative test
Here I set the
echo_pin
to a "normal pin" (non-i2c), keeptrigger_pin
as an i2c pin and I am able to compileAlternative test log
Observation:
It appears the
echo_pin
does not honor the Pin Schema as in the documentation.Thanks