# Kincony N30: ESP32-S3 + ARM CPU with 3 BL0910 chips (30 CT channels).
# Requires substitutions: devicename, friendly_name.
# Register map: https://www.kincony.com/forum/showthread.php?tid=8644
packages:
  common: !include ../common/package-common.yaml
  chip1: !include { file: ../components/kincony-n30-chip.yaml, vars: { prefix: "${devicename}", chip: 1, base: 100 } }
  chip2: !include { file: ../components/kincony-n30-chip.yaml, vars: { prefix: "${devicename}", chip: 2, base: 200 } }
  chip3: !include { file: ../components/kincony-n30-chip.yaml, vars: { prefix: "${devicename}", chip: 3, base: 300 } }

esp32:
  board: esp32-s3-devkitc-1
  framework:
    type: arduino

logger:
  # baud_rate: 0

# Network: Wi-Fi uses DHCP through the shared common package.
# Ethernet is preserved here for later hardware testing:
# ethernet:
#   type: W5500
#   clk_pin: GPIO42
#   mosi_pin: GPIO43
#   miso_pin: GPIO44
#   cs_pin: GPIO41
#   interrupt_pin: GPIO2
#   reset_pin: GPIO1

# Board pin map (vendor documentation):
#   I2C: SDA GPIO18, SCL GPIO17
#   LoRa SPI: SCK GPIO13, MOSI GPIO12, MISO GPIO11, CS GPIO14,
#             RST GPIO21, DIO0 GPIO47
#   SD SPI: MOSI GPIO40, SCK GPIO39, MISO GPIO38, CS GPIO48, CD GPIO8
#   ARM CPU UART: TX GPIO9, RX GPIO10
#   Unassigned GPIO: GPIO15, GPIO16

uart:
  rx_pin: 9
  tx_pin: 10
  baud_rate: 115200
  stop_bits: 1
  data_bits: 8
  parity: NONE

text_sensor:
  - platform: wifi_info
    ip_address:
      name: ESP IP Address
      id: eth_ip

font:
  - file: "gfonts://Roboto"
    id: roboto
    size: 15

i2c:
  sda: 18
  scl: 17

display:
  - platform: ssd1306_i2c
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.printf(0, 15, id(roboto), "IP: %s", id(eth_ip).state.c_str());

modbus:

modbus_controller:
  - id: ${devicename}_modbus
    address: 1
    update_interval: 5s
