Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Communication between two A16 over RS485 on ESPHOME with uart not working
#1
Hello,

i would like to have two A16s communicate with uart via the RS485 in the ESPHome.
The two RS485 are cross-connected A=>B and B=>A.

One A16 is the transmitter and the other is the receiver.

When the binary sensor is triggered, a message should be sent to the receiver, which should then trigger an action.

So far the log says that the transmitter is transmitting, but according to the log nothing arrives at the receiver.

Transmitter, i have shortened the yaml to the essential parts:
Code:
substitutions:
  mydelay_on: 50ms
  mydelay_off: 300ms
  uartcommand_allup: 0xAC, 0xAB, 0x01, 0x99
  uartcommand_alldown: 0xAC, 0xAB, 0x02, 0x99

esphome:
  name: roller-shutter-2
  friendly_name: Roller_Shutter_2
  on_boot:
    priority: -100
    then:
      - lambda: |-
          id(rollershutter_2).MySetup();
          id(rollershutter_2).InitialRun();

esp32:
  board: esp32dev
  framework:
    type: esp-idf

debug:

# Logger must be at least debug (default)
logger:
  level: DEBUG
  baud_rate: 9600

uart:
  - id: rs485
    tx_pin: GPIO13
    rx_pin: GPIO16
    baud_rate: 9600
    stop_bits: 1
    parity: NONE
    data_bits: 8
    debug:
      direction: BOTH
      dummy_receiver: false
      sequence:
        - lambda: |-
            UARTDebug::log_binary(direction, bytes, ';');
button:
  - platform: uart
    id: uart_master_all_up
    uart_id: rs485
    data: $uartcommand_allup
  - platform: uart
    uart_id: rs485
    id: uart_master_all_down
    data: $uartcommand_alldown

pcf8574:
  - id: inputs_1_8
    address: 0x22
    pcf8575: false
  - id: inputs_9_16
    address: 0x21
    pcf8575: false
  - id: outputs_1_8
    address: 0x24
    pcf8575: false
  - id: outputs_9_16
    address: 0x25
    pcf8575: false

binary_sensor:
  - platform: gpio
    name: "ZEN_I_U"
    pin:
      pcf8574: inputs_9_16
      number: 2
      mode: INPUT
      inverted: true
    filters:
      - delayed_on: $mydelay_on
      - delayed_off: $mydelay_off
    on_press:
      then:
        - uart.write: [0xAC, 0xAB, 0x01, 0x99]

  - platform: gpio
    name: "ZEN_I_D"
    pin:
      pcf8574: inputs_9_16
      number: 3
      mode: INPUT
      inverted: true
    filters:
      - delayed_on: $mydelay_on
      - delayed_off: $mydelay_off
    on_press:
      then:
        - uart.write: [0xAC, 0xAB, 0x02, 0x99]

  - platform: gpio
    name: "URL_I_UD"
    pin:
      pcf8574: inputs_9_16
      number: 4
      mode: INPUT
      inverted: true
    filters:
      - delayed_on: $mydelay_on
      - delayed_off: $mydelay_off
    on_press:
      then:
        - switch.turn_on: uart_master_holiday
    on_release:
      then:
        - switch.turn_off: uart_master_holiday

switch:
  - platform: template
    id: uart_master_holiday
    optimistic: True
    on_turn_on:
      then:
        - uart.write: [0xAC, 0xAB, 0x03, 0x99]
    on_turn_off:
      then:
        - uart.write: [0xAC, 0xAB, 0x04, 0x99]

Receiver, also  shortened:

Code:
esphome:
  name: roller-shutter-1
  friendly_name: Roller_Shutter_1

esp32:
  board: esp32dev
  framework:
    type: esp-idf

debug:

# Logger must be at least debug (default)
logger:
  level: DEBUG
  baud_rate: 9600

uart:
  - id: rs485
    tx_pin: GPIO13
    rx_pin: GPIO16
    baud_rate: 9600
    stop_bits: 1
    parity: NONE
    data_bits: 8
    debug:
      direction: RX
      dummy_receiver: true
      sequence:
        - lambda: |-
            UARTDebug::log_binary(direction, bytes, ';');

Where can i search the problem?

Best regards Mario
Reply
#2
i suggest you download by KCS firmware, it will be easy.
send customize RS485 command by IFTTT.
Reply
#3
Hello,

Sending communication via IFTTT is not an alternative to native RS485 communication.
IFTTT requires a functioning network.
RS485 works without a network and is therefore much more fail-safe, similar to a PLC control system. 
My shutter control via ESPHome can be controlled via Homeassistant, but also works completely independently.

Best regards
Mario
Reply
#4
no, my means, you download KCS v2 firmware to KC868-A16, set by IFTTT, it's local IFTTT, work without network, just send command by RS485 port.
here is KCS v2 online guide: https://www.kincony.com/esp32-kcsv2-firmware.html
Reply
#5
The problem was that I ignored the RS485 interface type. With the RS485, A=>A and B=>B are connected, as opposed to a ‘normal’ UART connection.

I will not use their firmware.
I asked here because this forum is advertised as a support forum. Apparently, however, it is just an advertising and sales forum.
Reply
#6
here is RS485 modbus protocol: https://www.kincony.com/forum/showthread.php?tid=2528
here is KC868-A16 esp32 pin define: https://www.kincony.com/forum/showthread.php?tid=1666
how to modify by ESPHome yaml, your question post to esphome community is more suitable.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)