Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
KCS + modbus + HA
#1
Hello,
do you have training / description / example focused to modbus ussage in KCS and commnucation implementable to HomeAssistant? I would like to read data over RS485 (ideally more register addressess) via KC868-A8S and transfer them to HomeAssistant. 

Regards
Radovan
Reply
#2
here is video tour about it: https://youtu.be/xmBWzVGpggo
Reply
#3
This is with ESPHome, is it possible also with KCS FW?
Reply
#4
Hello,
i did try to configure using ESPHome. Working ok, configuration via KCS is no more needed. Input / output are the same as on KC868-A8, right? I have downloaded IO pin description from ESPHome from file ( Made_for_ESPHome_KC868-A8.zip ) in this thread - https://www.kincony.com/forum/showthread.php?tid=1745
Below attaching configuration for A02 ultrasonic distance sensor + KC868-A8S connected via ethernet, maybe this will be useful also for anybody else who want to measure water level in tank :-)

Code:
esphome:
  name: kc868-a8s-venku
  platform: ESP32
  board: esp32dev

# 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

  # Optional manual IP
  manual_ip:
    static_ip: 192.168.1.17
    gateway: 192.168.1.1
    subnet: 255.255.255.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 9-16
    address: 0x22

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

  - platform: gpio
    name: "a8s-output2"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 1
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "a8s-output3"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 2
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "a8s-output4"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "a8s-output5"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "a8s-output6"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 5
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "a8s-output7"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 6
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "a8s-output8"
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 7
      mode: OUTPUT
      inverted: true
     
binary_sensor:
  - platform: gpio
    name: "a8s-input1"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "a8s-input2"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "a8s-input3"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "a8s-input4"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "a8s-input5"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "a8s-input6"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "a8s-input7"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true

  - platform: gpio
    name: "a8s-input8"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true


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

modbus:
  id: modbus1
  uart_id: mod_bus

modbus_controller:
  - id: kc868_a8s
    address: 0x01
    modbus_id: modbus1
    setup_priority: -10
    update_interval: 30s


sensor:
  - platform: modbus_controller
    modbus_controller_id: kc868_a8s
    name: "Distance"
    id: modbus_distance
    register_type: holding
    address: 0x0101
    unit_of_measurement: "m"
    value_type: U_WORD
    accuracy_decimals: 0

  - platform: modbus_controller
    modbus_controller_id: kc868_a8s
    name: "Temperature"
    id: modbus_current
    register_type: holding
    address: 0x0102
    unit_of_measurement: "°C"
    value_type: U_WORD
    accuracy_decimals: 0
    filters:
      - multiply: .1


# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: VerySecretPassword
.
Reply
#5
thanks, exactly you not need to use KCS, only use ESPHome to config is enough.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)