Smart Home Automation Forum
How to wire up float switch and use in ESPHome? - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-A8S (https://www.kincony.com/forum/forumdisplay.php?fid=24)
+--- Thread: How to wire up float switch and use in ESPHome? (/showthread.php?tid=3189)



How to wire up float switch and use in ESPHome? - Vendril - 08-23-2023

Hi,

Using ESPHOME in Home Assistant.

I have 2 of these float sensor switches. How should I be wiring them up to the board and coding in ESPHome to get an "open/closed"? I thought that they would be an analog device but am not getting any readings.

Or am I using the wrong input?

Code:
##################### Analog Inputs

# 2 x DC 0-5V (AI1, AI2)
# 2 x 4-20mA (AI3, AI4)

# GPIO36      ANALOG_A1
# GPIO39      ANALOG_A2
# GPIO34      ANALOG_A3
# GPIO35      ANALOG_A4


# DC 0-5v - ANALOG_A1
  - platform: gpio
    name: "ANALOG_A1"
    id: ANALOG_A1
    pin:
      number: GPIO36
#      inverted: true


# DC 0-5v - ANALOG_A2
  - platform: gpio
    name: "ANALOG_A2"
    id: ANALOG_A2
    pin:
      number: GPIO39
#      inverted: true

# 4-20mA ANALOG_A3
  - platform: gpio
    name: "ANALOG_A3"
    id: ANALOG_A3
    pin:
      number: GPIO34
#      inverted: true

# 4-20mA ANALOG_A4
  - platform: gpio
    name: "ANALOG_A4"
    id: ANALOG_A4
    pin:
      number: GPIO35
#      inverted: true


Thanks


RE: How to wire up float switch and use in ESPHome? - admin - 08-23-2023

float switch is "binary sensor", so you connect to board's "digital input" port is ok.


RE: How to wire up float switch and use in ESPHome? - Vendril - 08-24-2023

Thanks,

Got it hooked up and working now.


Code:
####### START digital inputs / physical buttons on board
binary_sensor:
  - platform: gpio
    name: "digital input1"
    id: digitalinput1_physicalbutton
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true



RE: How to wire up float switch and use in ESPHome? - admin - 08-24-2023

ok