Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A8s v2 inputs
#1
Hello, the inputs on my a8s v2 dont work.

If i short the gnd with any of the input pins nothing happens.
All the relays work fine. Im using I2C address 0x22 for input pcf8574.

Im using the board with esphome.

Code snipet for input

binary_sensor:
   
- platform: gpio
  name: input1
  ID:”input1”
  pin:
     pcf8574: pcf8754_hub_in
     number: 0
     mode: INPUT


Please advise

Thank you
Reply
#2
do you means, all INPUT ports can't use?
you can use this yaml file directly.
Code:
esphome:
  name: a8s
  platform: ESP32
  board: esp32dev
 
 
remote_receiver:
  pin: 16
  dump:
    - rc_switch
  tolerance: 50%
  filter: 250us
  idle: 2ms
  buffer_size: 2kb



# Example configuration entry for ESP32
i2c:
  sda: 4
  scl: 5
  scan: true
  id: bus_a


# Example configuration entry
ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0


# Example configuration entry
pcf8574:
  - id: 'pcf8574_hub_out_1'  # for output channel 1-8
    address: 0x24

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

# Individual outputs
switch:
  - platform: gpio
    name: "light1"
    id: light1
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 0
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "light2"
    id: light2
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 1
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "light3"
    id: light3
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 2
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "light4"
    id: light4
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "curtain1-up"
    id: relay5
    interlock: [relay6]
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: OUTPUT
      inverted: true
     
     
     
  - platform: gpio
    name: "curtain1-down"
    id: relay6
    interlock: [relay5]
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 5
      mode: OUTPUT
      inverted: true
     

  - platform: gpio
    name: "curtain2-up"
    id: relay7
    interlock: [relay8]
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 6
      mode: OUTPUT
      inverted: true

     
  - platform: gpio
    name: "curtain2-down"
    id: relay8
    interlock: [relay7]
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 7
      mode: OUTPUT
      inverted: true

     
binary_sensor:
  - platform: gpio
    name: "input1"
    on_press:
      then:
        - switch.toggle: light1
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input2"
    on_press:
      then:
        - switch.toggle: light2
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input3"
    on_press:
      then:
        - switch.toggle: light3
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input4"
    on_press:
      then:
        - switch.toggle: light4
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input5"
    on_press:
      then:
        - switch.toggle: relay5
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input6"
    on_press:
      then:
        - switch.toggle: relay6
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input7"
    on_press:
      then:
        - switch.toggle: relay7
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "input8"
    on_press:
      then:
        - switch.toggle: relay8
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true

  - platform: remote_receiver
    name: "remoter1"
    rc_switch_raw:
      code: '001111010111001010111000'
      protocol: 1
    on_press:
      then:
        - switch.toggle: light1
    filters:
      - delayed_off: 200ms

  - platform: remote_receiver
    name: "remoter2"
    rc_switch_raw:
      code: '001111010111001010111100'
      protocol: 1
    on_press:
      then:
        - switch.toggle: light2
    filters:
      - delayed_off: 200ms
     
  - platform: remote_receiver
    name: "remoter3"
    rc_switch_raw:
      code: '001111010111001010110100'
      protocol: 1
    on_press:
      then:
        - switch.toggle: light3
    filters:
      - delayed_off: 200ms
     
  - platform: remote_receiver
    name: "remoter4"
    rc_switch_raw:
      code: '001111010111001010111001'
      protocol: 1
    on_press:
      then:
        - switch.toggle: light4
    filters:
      - delayed_off: 200ms 
   
  - platform: remote_receiver
    name: "remoter5"
    rc_switch_raw:
      code: '001111010111001010110010'
      protocol: 1
    on_press:
      then:
        - switch.toggle: relay5
    filters:
      - delayed_off: 200ms

  - platform: remote_receiver
    name: "remoter6"
    rc_switch_raw:
      code: '001111010111001010110101'
      protocol: 1
    on_press:
      then:
        - switch.toggle: relay6
    filters:
      - delayed_off: 200ms
     
  - platform: remote_receiver
    name: "remoter7"
    rc_switch_raw:
      code: '001111010111001010110001'
      protocol: 1
    on_press:
      then:
        - switch.toggle: relay7
    filters:
      - delayed_off: 200ms
     
  - platform: remote_receiver
    name: "remoter8"
    rc_switch_raw:
      code: '001111010111001010110011'
      protocol: 1
    on_press:
      then:
        - switch.toggle: relay8
    filters:
      - delayed_off: 200ms
     
  - platform: gpio
    name: "PIR1"
    pin: 14
    device_class: motion
    on_release:
       - script.execute: motion_timer

script:
  - id: motion_timer
    mode: restart
    then:
      - delay: 10s
      - switch.turn_off: light1
      - switch.turn_off: light2
      - switch.turn_off: light3
      - switch.turn_off: light4


# Enable logging
logger:

# Enable Home Assistant API
api:
Reply
#3
Hi, I tested with you code, still nothing.

What can I test?

Here is my code:

Code:
esphome:
  friendly_name : Green House
  name: "green-house"

esp32:
  board: esp32dev

# Enable logging
logger:

# Enable Home Assistant API

api:

ota:
 

web_server:
  port: 80
  auth:
    username: admin
    password: !secret web_server_password

modbus:
  id: modbus1
  uart_id: mod_bus

modbus_controller:
  - id: a8s
    address: 0x01
    modbus_id: modbus1
    setup_priority: -10
    update_interval: 5s

uart:
  id: mod_bus
  tx_pin: 33
  rx_pin: 32
  baud_rate: 9600
  stop_bits: 1
  parity: NONE

ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0

sensor:

  - platform: modbus_controller
    modbus_controller_id: a8s
    name: "Box Temp"
    id: modbus_temp
    register_type: holding
    address: 0
    unit_of_measurement: "°C"
    value_type: S_WORD
    accuracy_decimals: 1
    filters:
      - lambda: return x / 10.0;

  - platform: modbus_controller
    modbus_controller_id: a8s
    name: "Box Hum"
    id: modbus_Hum
    register_type: holding
    address: 1
    unit_of_measurement: "%"
    value_type: S_WORD
    accuracy_decimals: 1
    filters:
      - lambda: return x / 10.0;

  - platform: dht
    pin: 14
    temperature:
      name: "Green House Temperature"
    humidity:
      name: "Green House Humidity"
    update_interval: 10s 
   

  #- platform: adc
  #  pin: 36
  #  name: "analog-1"
  #  update_interval: 10s
  #  attenuation: auto
  #  id: "analog1"

  #- platform: adc
  #  pin: 39
  #  name: "analog-2"
  #  update_interval: 10s
  #  attenuation: auto

  #- platform: adc
  #  pin: 34
  #  name: "analog-3"
  #  update_interval: 10s
  #  attenuation: auto

  #- platform: adc
  #  pin: 35
  #  name: "analog-4"
  #  update_interval: 10s
  #  attenuation: auto

i2c:
  sda: 4
  scl: 5
  scan: true
  id: bus_a

pcf8574:
- id: "pcf8574_hub_out_1" # for output channel 1-8
  address: 0x24

- id: "pcf8574_hub_in_1" # for input channel 9-16
  address: 0x22

# Individual outputs
switch:
- platform: gpio
  name: “(8) Pump”
  id: "relay_8"
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 7
    mode: OUTPUT
    inverted: true

- platform: gpio
  name: “(7) Sud”
  id: "relay_7"
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 6
    mode: OUTPUT
    inverted: true

- platform: gpio
  name: “(6) Z14 Zahon 2”
  id: "relay_6"
  interlock: &interlock_group [relay_1, relay_2, relay_3, relay_4, relay_5, relay_6]
  interlock_wait_time: 0.5s
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 5
    mode: OUTPUT
    inverted: true

- platform: gpio
  name: “(5) Z13 Zahon 1”
  id: "relay_5"
  interlock: *interlock_group
  interlock_wait_time: 0.5s
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 4
    mode: OUTPUT
    inverted: true

- platform: gpio
  name: “(4) Z12 Green House 2”
  id: "relay_4"
  interlock: *interlock_group
  interlock_wait_time: 0.5s
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 3
    mode: OUTPUT
    inverted: true

- platform: gpio
  name: “(3) Z11 Green House 1”
  id: "relay_3"
  interlock: *interlock_group
  interlock_wait_time: 0.5s
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 2
    mode: OUTPUT
    inverted: true

- platform: gpio
  name: “(2) Z10 od chodnika (T)”
  id: "relay_2"
  interlock: *interlock_group
  interlock_wait_time: 0.5s
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 1
    mode: OUTPUT
    inverted: true

- platform: gpio
  name: “(1) Z9 od plota (T)”
  id: "relay_1"
  interlock: *interlock_group
  interlock_wait_time: 0.5s
  pin:
    pcf8574: pcf8574_hub_out_1
    number: 0
    mode: OUTPUT
    inverted: true

binary_sensor:

- platform: gpio
  name: “10%”
  id: "Input_1"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 0
    mode: INPUT
    inverted: true

- platform: gpio
  name: “25%”
  id: "Input_2"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 1
    mode: INPUT
    inverted: true

- platform: gpio
  name: “50%”
  id: "Input_3"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 2
    mode: INPUT
    inverted: true

- platform: gpio
  name: “75%”
  id: "Input_4"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 3
    mode: INPUT
    inverted: true

- platform: gpio
  name: “100%”
  id: "Input_5"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 4
    mode: INPUT
    inverted: true

- platform: gpio
  name: “input6”
  id: "Input_6"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 5
    mode: INPUT
    inverted: true

- platform: gpio
  name: “input7”
  id: "Input_7"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 6
    mode: INPUT
    inverted: true

- platform: gpio
  name: “input8”
  id: "Input_8"
  pin:
    pcf8574: pcf8574_hub_in_1
    number: 7
    mode: INPUT
    inverted: false

- platform: status
  id: ha_conected
  name: "Green House Status"
  on_state:
    then:
      - if:
          condition:
            binary_sensor.is_on: ha_conected
          then:
            - light.turn_on:
                id: RGB_LED
                red: 0
                green: 1
                blue: 0
      - light.turn_on:
            id: RGB_LED
            red: 1
            green: 0
            blue: 0
            flash_length: 1s


button:
  - platform: restart
    name: "Restart Green House"

  - platform: safe_mode
    name: "Restart Green House(Safe Mode)"

  - platform: template
    name: LED Red
    id: LED_R
    on_press:
    - light.turn_on:
        id: RGB_LED
        brightness: 100%
        red: 1
        green: 0
        blue: 0

  - platform: template
    name: LED Blue
    id: LED_B
    on_press:
    - light.turn_on:
        id: RGB_LED
        brightness: 100%
        red: 0
        green: 0
        blue: 1
  - platform: template
    name: LED Green
    id: LED_G
    on_press:
    - light.turn_on:
        id: RGB_LED
        brightness: 100%
        red: 0
        green: 1
        blue: 0
  - platform: template
    name: LED White
    id: LED_w
    on_press:
    - light.turn_on:
        id: RGB_LED
        brightness: 100%
        red: 1
        green: 1
        blue: 1

light:
  - platform: neopixelbus
    id: RGB_LED
    type: GRB
    variant: WS2811
    pin: 12
    num_leds: 1
    name: "NeoPixel Light"
    effects:
           - pulse:
              name: "Slow Pulse"
              update_interval: 2s
Reply
#4
all INPUT ports can't use? or only some channel can't use.
i suggest you download our KCS firmware to test whether hardware PCB work well.
here is KCS firmware online guide: https://www.kincony.com/esp32-kcsv2-firmware.html
Reply
#5
(06-17-2024, 10:23 AM)admin Wrote: all INPUT ports can't use? or only some channel can't use.
i suggest you download our KCS firmware to test whether hardware PCB work well.
here is KCS firmware online guide: https://www.kincony.com/esp32-kcsv2-firmware.html

Yes all ports dont work as if the pcf doesnt work
Reply
#6
you can test with KCS firmware, if can't work , tell me.
Reply
#7
Tongue 
Tested with KCS firmware and not working:

https://share.icloud.com/photos/0ddXMAIf...a5eeZ0d98A
Reply
#8
sorry, i can't download video file from Apple iCloud. when you config by ESPHome. after download firmware, can you check the i2c bus after scanned, which device i2c address have found by ESPHome LOG? maybe it's not 0x22, we can change address for you.
Reply
#9
Sorry couldn't test sooner


result of scan:

C][i2c.arduino:071]: I2C Bus:
[C][i2c.arduino:072]:  SDA Pin: GPIO4
[C][i2c.arduino:073]:  SCL Pin: GPIO5
[C][i2c.arduino:074]:  Frequency: 50000 Hz
[C][i2c.arduino:086]:  Recovery: bus successfully recovered
[I][i2c.arduino:096]: Results from i2c bus scan:
[I][i2c.arduino:102]: Found i2c device at address 0x22
[I][i2c.arduino:102]: Found i2c device at address 0x24

[C][pcf8574:021]: PCF8574:
[C][pcf8574:022]:  Address: 0x24
[C][pcf8574:023]:  Is PCF8575: NO
[C][pcf8574:021]: PCF8574:
[C][pcf8574:022]:  Address: 0x22
[C][pcf8574:023]:  Is PCF8575: NO


If needed I can upload the video to a different platform just recommend one
Reply
#10
add whatsapp number: +86-15381188302 we use ANYDESK remote control your computer to help you.
Reply


Forum Jump:


Users browsing this thread: