Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to wire up float switch and use in ESPHome?
#1
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
Reply
#2
float switch is "binary sensor", so you connect to board's "digital input" port is ok.
Reply
#3
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
Reply
#4
ok
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)