Smart Home Automation Forum

Full Version: K868-E16S use digital input and I2C in the same time
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've defined the digital inputs and switches as in the example and also added a DS18B20 temp sensor to the I2C. But as soon as I add in yaml the Dallas configuration, the update_interval toggles the switches on and off at the interval set in the update_interval.
I saw that the I2C port is the same as the Dallas sensor but I don't know how I can connect them in a different way.

esphome:
  name: kincony-kc868-e16s
  friendly_name: Kincony KC868-E16S
  platform: ESP32
  board: esp32dev

logger:

captive_portal:

i2c:
  sda: 16
  scl: 15
  scan: true
  id: bus_a

pcf8574:
  - id: 'pcf8574_hub_out_1'  # for output channel 1-8
    address: 0x21

  - id: 'pcf8574_hub_out_2'  # for output channel 9-16
    address: 0x25

  - id: 'pcf8574_hub_in_1'  # for input channel 1-8
    address: 0x22

  - id: 'pcf8574_hub_in_2'  # for input channel 9-16
    address: 0x24

switch:
  - platform: gpio
    name: "e16s-output14"
    pin:
      pcf8574: pcf8574_hub_out_2
      number: 5
      mode: OUTPUT
      inverted: true
    id: output14

  - platform: gpio
    name: "e16s-output15"
    pin:
      pcf8574: pcf8574_hub_out_2
      number: 6
      mode: OUTPUT
      inverted: true
    id: output15

  - platform: gpio
    name: "e16s-output16"
    pin:
      pcf8574: pcf8574_hub_out_2
      number: 7
      mode: OUTPUT
      inverted: true
    id: output16

binary_sensor:
  - platform: gpio
    name: "DI1 - Entrance Left B1"
    pin:
      pcf8574: pcf8574_hub_in_2
      number: 7
      mode: INPUT
      inverted: true
    internal: true
    on_press:
      then:
      - switch.toggle: output14

dallas:
  - pin: 16
    update_interval: 30s

sensor:
  - platform: dallas
    address: 0x453c430457d4c928
    name: "Livingroom Temperature"
    id: livingroom_temperature
  - platform: dallas
    address: 0x9d3c450457bfc728
    name: "Bedroom Temperature"
    id: bedroom_temperature
DS18B20 can't use I2C bus pin. if you want to use DS18B20, try to use other free GPIO, such as there is a serial port extender on PCB (white 4pin socket).
Thank you for the info, it was a confirmation of what I have to do.
So, I've used RX from the extended serial pin GPIO14.
Also I've added a 4.7K resistor between data and VCC+ (3.3V) of the temp sensor. It's not working without the resistor, that's why it wasn't working yesterday.

dallas:
- pin: 14
update_interval: 10s

Thank you!
RXD:GPIO14
TXD:GPIO33
you can try to use by GPIO14 or GPIO33, if GPIO14 not work, you can try GPIO33.