I connected my ESP32 to a LED on a PCB board. The AC is around 1,5v when it’s blinking and 1,1v when it’s not (multimeter readings). I’m trying to find out how to translate this into a (binary-)sensor when it’s blinking within Hassio. I tried many ideas but most are for HIGH.
I got my ESP connected to the LED with a 10k resistor and to the GND
This is my current set-up:
binary_sensor:
- platform: gpio
id: watertank
name: Water Tank
pin:
# Connected to GPIO
number: GPIO19
mode: INPUT_PULLUP
# inverted: true
filters:
# Small filter, to debounce the button press.
# - delayed_on: 1s
# - delayed_off: 1s
Is there an ADC input on your esp32 device that you could use instead of the GPIO pin? You could then get the voltage into HA and make a template sensor for the logic.
[09:45:55][D][adc:056]: 'Water Tank': Got voltage=1.50V
[09:45:55][D][sensor:092]: 'Water Tank': Sending state 1.50000 V with 2 decimals of accuracy
[09:46:05][D][adc:056]: 'Water Tank': Got voltage=1.50V
[09:46:05][D][sensor:092]: 'Water Tank': Sending state 1.50000 V with 2 decimals of accuracy
[09:46:15][D][adc:056]: 'Water Tank': Got voltage=1.50V
[09:46:15][D][sensor:092]: 'Water Tank': Sending state 1.50000 V with 2 decimals of accuracy
[09:46:25][D][adc:056]: 'Water Tank': Got voltage=1.50V
[09:46:25][D][sensor:092]: 'Water Tank': Sending state 1.50000 V with 2 decimals of accuracy
[09:46:35][D][adc:056]: 'Water Tank': Got voltage=0.00V
[09:46:35][D][sensor:092]: 'Water Tank': Sending state 0.00000 V with 2 decimals of accuracy
[09:46:45][D][adc:056]: 'Water Tank': Got voltage=0.01V
[09:46:45][D][sensor:092]: 'Water Tank': Sending state 0.01245 V with 2 decimals of accuracy
[09:46:55][D][adc:056]: 'Water Tank': Got voltage=0.00V
[09:46:55][D][sensor:092]: 'Water Tank': Sending state 0.00000 V with 2 decimals of accuracy
[09:47:05][D][adc:056]: 'Water Tank': Got voltage=0.34V
[09:47:05][D][sensor:092]: 'Water Tank': Sending state 0.33626 V with 2 decimals of accuracy
[09:47:15][D][adc:056]: 'Water Tank': Got voltage=0.00V
[09:47:15][D][sensor:092]: 'Water Tank': Sending state 0.00000 V with 2 decimals of accuracy
[09:47:25][D][adc:056]: 'Water Tank': Got voltage=1.50V
[09:47:25][D][sensor:092]: 'Water Tank': Sending state 1.50000 V with 2 decimals of accuracy
[09:47:35][D][adc:056]: 'Water Tank': Got voltage=1.50V
[09:47:35][D][sensor:092]: 'Water Tank': Sending state 1.50000 V with 2 decimals of accuracy
LED on
[10:00:53][D][adc:056]: 'Water Tank': Got voltage=0.00V
[10:00:53][D][sensor:092]: 'Water Tank': Sending state 0.00000 V with 2 decimals of accuracy
[10:01:03][D][adc:056]: 'Water Tank': Got voltage=1.50V
[10:01:03][D][sensor:092]: 'Water Tank': Sending state 1.50000 V with 2 decimals of accuracy
[10:01:13][D][adc:056]: 'Water Tank': Got voltage=0.00V
[10:01:13][D][sensor:092]: 'Water Tank': Sending state 0.00000 V with 2 decimals of accuracy
[10:01:23][D][adc:056]: 'Water Tank': Got voltage=0.00V
[10:01:23][D][sensor:092]: 'Water Tank': Sending state 0.00000 V with 2 decimals of accuracy
[10:01:33][D][adc:056]: 'Water Tank': Got voltage=0.92V
[10:01:33][D][sensor:092]: 'Water Tank': Sending state 0.91502 V with 2 decimals of accuracy
[10:01:43][D][adc:056]: 'Water Tank': Got voltage=0.00V
[10:01:43][D][sensor:092]: 'Water Tank': Sending state 0.00000 V with 2 decimals of accuracy
[10:01:53][D][adc:056]: 'Water Tank': Got voltage=0.00V
[10:01:53][D][sensor:092]: 'Water Tank': Sending state 0.00000 V with 2 decimals of accuracy
[10:02:03][D][adc:056]: 'Water Tank': Got voltage=1.50V
[10:02:03][D][sensor:092]: 'Water Tank': Sending state 1.50000 V with 2 decimals of accuracy
[10:02:13][D][adc:056]: 'Water Tank': Got voltage=0.00V
[10:02:13][D][sensor:092]: 'Water Tank': Sending state 0.00000 V with 2 decimals of accuracy
[10:02:23][D][adc:056]: 'Water Tank': Got voltage=0.00V
[10:02:23][D][sensor:092]: 'Water Tank': Sending state 0.00000 V with 2 decimals of accuracy
[10:02:33][D][adc:056]: 'Water Tank': Got voltage=1.50V
[10:02:33][D][sensor:092]: 'Water Tank': Sending state 1.50000 V with 2 decimals of accuracy