This is the ESPHome configuration I use for my two Kincony N30 energy monitors, along with a full reference of the N30's Modbus registers and coils.
For updating the N30's ARM firmware from Linux, see Flashing the Kincony N30 ARM Firmware from Linux.

ESPHome Configuration
Kincony provides an ESPHome YAML for the N30:
- Kincony Forum - N30 configure yaml for ESPhome 0.001kwh precision - current version, for ARM firmware V20_260305SP or newer.
- Kincony Forum - N30 configure yaml for ESPhome - original version, for older firmware.
My configuration is based on the newer version. The differences:
- The shared settings (Wi-Fi, API, OTA, MQTT, time, restart buttons, etc.) come from my common package. See ESPHome Common for how that is laid out.
- Buttons to clear the energy counters on each chip (coils 520-522).
- No
command_throttle. - The 30 channels are templated, instead of written out one sensor at a time.
Templating
ESPHome YAML does not have loops. But, !include with vars, plus math in substitutions, gets close. The config is split into four files:
| File | Contents |
|---|---|
components/kincony-n30-channel.yaml |
Current, power and energy for one channel. |
components/kincony-n30-chip.yaml |
One BL0910 chip: includes the channel file 10 times, plus the sum, voltage, frequency, temperature and power factor, and the clear-energy button. |
devices/kincony-n30.yaml |
The N30 board: ESP32-S3, UART to the ARM CPU, OLED display, Modbus controller, and the chip file 3 times. |
n30.yaml |
One device. Just the substitutions, and the device file. |
The register addresses are calculated from the chip's base address. For channel ch on a chip starting at base:
- Current:
base + (ch - 1) * 2 - Power:
base + 20 + (ch - 1) * 2 - Energy:
base + 40 + (ch - 1) * 2
The device file includes each chip, with its number and base address:
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 } }
And, the config for each board is just this (plus the commented-out override examples below):
substitutions:
devicename: n30
friendly_name: n30
packages:
device: !include devices/kincony-n30.yaml
My second N30 is the same file, with n31 instead of n30.
esphome config on the templated version resolves to the same 107 sensors and 5 buttons as the original, hand-written file. Both boards are running it.
components/kincony-n30-channel.yaml
# One CT channel. vars: prefix, chip, ch, base
sensor:
- platform: modbus_controller
address: ${ base + (ch - 1) * 2 }
register_type: holding
name: ${prefix|upper}_${chip}_${ch}_current
id: ${prefix}_${chip}_${ch}_current
unit_of_measurement: A
device_class: current
accuracy_decimals: 3
value_type: U_DWORD_R
filters:
- multiply: 0.001
- platform: modbus_controller
address: ${ base + 20 + (ch - 1) * 2 }
register_type: holding
name: ${prefix|upper}_${chip}_${ch}_power
id: ${prefix}_${chip}_${ch}_power
unit_of_measurement: W
device_class: power
accuracy_decimals: 1
value_type: S_DWORD_R
filters:
- multiply: 0.1
- platform: modbus_controller
address: ${ base + 40 + (ch - 1) * 2 }
register_type: holding
name: ${prefix|upper}_${chip}_${ch}_energy
id: ${prefix}_${chip}_${ch}_energy
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
accuracy_decimals: 3
value_type: FP32_R
components/kincony-n30-chip.yaml
# One BL0910 chip: 10 channels plus chip-level readings. vars: prefix, chip, base
packages:
ch1: !include
file: kincony-n30-channel.yaml
vars:
prefix: ${prefix}
chip: ${chip}
ch: 1
base: ${base}
ch2: !include
file: kincony-n30-channel.yaml
vars:
prefix: ${prefix}
chip: ${chip}
ch: 2
base: ${base}
ch3: !include
file: kincony-n30-channel.yaml
vars:
prefix: ${prefix}
chip: ${chip}
ch: 3
base: ${base}
ch4: !include
file: kincony-n30-channel.yaml
vars:
prefix: ${prefix}
chip: ${chip}
ch: 4
base: ${base}
ch5: !include
file: kincony-n30-channel.yaml
vars:
prefix: ${prefix}
chip: ${chip}
ch: 5
base: ${base}
ch6: !include
file: kincony-n30-channel.yaml
vars:
prefix: ${prefix}
chip: ${chip}
ch: 6
base: ${base}
ch7: !include
file: kincony-n30-channel.yaml
vars:
prefix: ${prefix}
chip: ${chip}
ch: 7
base: ${base}
ch8: !include
file: kincony-n30-channel.yaml
vars:
prefix: ${prefix}
chip: ${chip}
ch: 8
base: ${base}
ch9: !include
file: kincony-n30-channel.yaml
vars:
prefix: ${prefix}
chip: ${chip}
ch: 9
base: ${base}
ch10: !include
file: kincony-n30-channel.yaml
vars:
prefix: ${prefix}
chip: ${chip}
ch: 10
base: ${base}
sensor:
- platform: modbus_controller
address: ${ base + 60 }
register_type: holding
name: ${prefix|upper}_${chip}_11_energy_d
id: ${prefix}_${chip}_11_energy_d
unit_of_measurement: kWh
device_class: energy
state_class: total_increasing
accuracy_decimals: 3
value_type: FP32_R
- platform: modbus_controller
address: ${ base + 62 }
register_type: holding
name: bl0910_${chip}_voltage
id: ${prefix}_${chip}_voltage
unit_of_measurement: V
device_class: voltage
accuracy_decimals: 1
value_type: U_WORD
filters:
- multiply: 0.01
- platform: modbus_controller
address: ${ base + 63 }
register_type: holding
name: bl0910_${chip}_frequency
id: ${prefix}_${chip}_period
unit_of_measurement: Hz
device_class: frequency
accuracy_decimals: 2
value_type: U_WORD
filters:
- multiply: 0.01
- platform: modbus_controller
address: ${ base + 64 }
register_type: holding
name: bl0910_${chip}_tps1
id: ${prefix}_${chip}_tps_1
unit_of_measurement: "°C"
device_class: temperature
accuracy_decimals: 1
value_type: FP32_R
- platform: modbus_controller
address: ${ base + 66 }
register_type: holding
name: bl0910_${chip}_power_factor
id: ${prefix}_${chip}_power_factor
device_class: power_factor
accuracy_decimals: 2
value_type: FP32_R
button:
- platform: template
name: ${prefix|upper}_${chip}_clear_energy
entity_category: config
on_press:
- lambda: |-
id(${prefix}_modbus)->queue_command(modbus_controller::ModbusCommandItem::create_write_single_coil(id(${prefix}_modbus), ${ 519 + chip }, true));
devices/kincony-n30.yaml
# 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
n30.yaml
substitutions:
devicename: n30
friendly_name: n30
packages:
device: !include devices/kincony-n30.yaml
# Per-channel overrides. Uncomment and edit; !extend merges into the templated
# sensor by id (${devicename}_<chip>_<channel>_<current|power|energy>). Filters are appended
# after the template's own (multiply 0.001 for current, 0.1 for power).
# sensor:
# # Offset one channel's power reading.
# - id: !extend ${devicename}_1_5_power
# filters:
# - offset: -2.0
#
# # Scale one channel's current (CT calibration).
# - id: !extend ${devicename}_2_3_current
# filters:
# - multiply: 1.02
#
# # Rename a channel.
# - id: !extend ${devicename}_1_7_power
# name: Office Power
#
# # Hide an unused channel from Home Assistant.
# - id: !extend ${devicename}_3_10_power
# internal: true
#
# # Average a noisy channel over 30s before publishing.
# - id: !extend ${devicename}_1_2_power
# filters:
# - throttle_average: 30s
Downloads: n30.yaml, devices/kincony-n30.yaml, kincony-n30-chip.yaml, kincony-n30-channel.yaml
Overriding a single channel
To change one channel, without touching the template, add an !extend with the sensor's id to the board file. The id format is ${devicename}_<chip>_<channel>_<current|power|energy>.
Filters are added after the template's own filters (multiply: 0.001 for current, multiply: 0.1 for power).
sensor:
# Offset one channel's power reading.
- id: !extend ${devicename}_1_5_power
filters:
- offset: -2.0
# Scale one channel's current (CT calibration).
- id: !extend ${devicename}_2_3_current
filters:
- multiply: 1.02
# Rename a channel.
- id: !extend ${devicename}_1_7_power
name: Office Power
# Hide an unused channel from Home Assistant.
- id: !extend ${devicename}_3_10_power
internal: true
# Average a noisy channel over 30s before publishing.
- id: !extend ${devicename}_1_2_power
filters:
- throttle_average: 30s
Each of these was checked with esphome config. My board files have this block at the bottom, commented out.
The N30 also has a calibration factor for each channel, stored on the board itself (see the coefficients table below). That one only scales the reading. It cannot add an offset.
Modbus Reference
Everything below is from Kincony's N30 Energy RS485 Modbus Protocol, using the updated revision for ARM firmware V20_260305SP or newer. Where something is from my own boards, rather than the document, it is noted.
Communication
| Setting | Value | Source |
|---|---|---|
| Protocol | Modbus RTU over RS485 | Kincony |
| Baud (RS485) | 38400 | Kincony |
| Baud (ESP32 to ARM UART, internal) | 115200 | Kincony's ESPHome YAML, and mine |
| Framing | 8N1 | My boards (not in the document) |
| Slave address | 1 | My boards (not in the document) |
| Read registers | FC 0x03 (holding registers) | Kincony |
| Write coil | FC 0x05 | Kincony |
| Write register | FC 0x06 (single), FC 0x10 (multiple) | Kincony |
Measurement registers
Read with FC 0x03. Each chip has a 68 register block. Chip 1 starts at 100, chip 2 at 200, and chip 3 at 300. Chip 1 is the P1 connector, chip 2 is P2, and chip 3 is P3.
The doc does not explain “CDBA” float order. In ESPHome, these read correctly with U_DWORD_R (current), S_DWORD_R (power) and FP32_R (energy, temperature, power factor), which is what my config uses.
| Offset | Name | Type | Words | Unit | Scale | Chip 1 | Chip 2 | Chip 3 | Description |
|---|---|---|---|---|---|---|---|---|---|
| 0 | RMS_1 | uint32 | 2 | A | 0.001 | 100 | 200 | 300 | Channel 1 RMS current |
| 2 | RMS_2 | uint32 | 2 | A | 0.001 | 102 | 202 | 302 | Channel 2 RMS current |
| 4 | RMS_3 | uint32 | 2 | A | 0.001 | 104 | 204 | 304 | Channel 3 RMS current |
| 6 | RMS_4 | uint32 | 2 | A | 0.001 | 106 | 206 | 306 | Channel 4 RMS current |
| 8 | RMS_5 | uint32 | 2 | A | 0.001 | 108 | 208 | 308 | Channel 5 RMS current |
| 10 | RMS_6 | uint32 | 2 | A | 0.001 | 110 | 210 | 310 | Channel 6 RMS current |
| 12 | RMS_7 | uint32 | 2 | A | 0.001 | 112 | 212 | 312 | Channel 7 RMS current |
| 14 | RMS_8 | uint32 | 2 | A | 0.001 | 114 | 214 | 314 | Channel 8 RMS current |
| 16 | RMS_9 | uint32 | 2 | A | 0.001 | 116 | 216 | 316 | Channel 9 RMS current |
| 18 | RMS_10 | uint32 | 2 | A | 0.001 | 118 | 218 | 318 | Channel 10 RMS current |
| 20 | WATT_1 | int32 (uint32 before V20_260305SP) | 2 | W | 0.1 | 120 | 220 | 320 | Channel 1 active power. Negative = reverse power |
| 22 | WATT_2 | int32 (uint32 before V20_260305SP) | 2 | W | 0.1 | 122 | 222 | 322 | Channel 2 active power. Negative = reverse power |
| 24 | WATT_3 | int32 (uint32 before V20_260305SP) | 2 | W | 0.1 | 124 | 224 | 324 | Channel 3 active power. Negative = reverse power |
| 26 | WATT_4 | int32 (uint32 before V20_260305SP) | 2 | W | 0.1 | 126 | 226 | 326 | Channel 4 active power. Negative = reverse power |
| 28 | WATT_5 | int32 (uint32 before V20_260305SP) | 2 | W | 0.1 | 128 | 228 | 328 | Channel 5 active power. Negative = reverse power |
| 30 | WATT_6 | int32 (uint32 before V20_260305SP) | 2 | W | 0.1 | 130 | 230 | 330 | Channel 6 active power. Negative = reverse power |
| 32 | WATT_7 | int32 (uint32 before V20_260305SP) | 2 | W | 0.1 | 132 | 232 | 332 | Channel 7 active power. Negative = reverse power |
| 34 | WATT_8 | int32 (uint32 before V20_260305SP) | 2 | W | 0.1 | 134 | 234 | 334 | Channel 8 active power. Negative = reverse power |
| 36 | WATT_9 | int32 (uint32 before V20_260305SP) | 2 | W | 0.1 | 136 | 236 | 336 | Channel 9 active power. Negative = reverse power |
| 38 | WATT_10 | int32 (uint32 before V20_260305SP) | 2 | W | 0.1 | 138 | 238 | 338 | Channel 10 active power. Negative = reverse power |
| 40 | Energy_1 | float CDBA (uint32 1 kWh/LSB before V20_260305SP) | 2 | kWh | 140 | 240 | 340 | Channel 1 accumulated energy | |
| 42 | Energy_2 | float CDBA (uint32 1 kWh/LSB before V20_260305SP) | 2 | kWh | 142 | 242 | 342 | Channel 2 accumulated energy | |
| 44 | Energy_3 | float CDBA (uint32 1 kWh/LSB before V20_260305SP) | 2 | kWh | 144 | 244 | 344 | Channel 3 accumulated energy | |
| 46 | Energy_4 | float CDBA (uint32 1 kWh/LSB before V20_260305SP) | 2 | kWh | 146 | 246 | 346 | Channel 4 accumulated energy | |
| 48 | Energy_5 | float CDBA (uint32 1 kWh/LSB before V20_260305SP) | 2 | kWh | 148 | 248 | 348 | Channel 5 accumulated energy | |
| 50 | Energy_6 | float CDBA (uint32 1 kWh/LSB before V20_260305SP) | 2 | kWh | 150 | 250 | 350 | Channel 6 accumulated energy | |
| 52 | Energy_7 | float CDBA (uint32 1 kWh/LSB before V20_260305SP) | 2 | kWh | 152 | 252 | 352 | Channel 7 accumulated energy | |
| 54 | Energy_8 | float CDBA (uint32 1 kWh/LSB before V20_260305SP) | 2 | kWh | 154 | 254 | 354 | Channel 8 accumulated energy | |
| 56 | Energy_9 | float CDBA (uint32 1 kWh/LSB before V20_260305SP) | 2 | kWh | 156 | 256 | 356 | Channel 9 accumulated energy | |
| 58 | Energy_10 | float CDBA (uint32 1 kWh/LSB before V20_260305SP) | 2 | kWh | 158 | 258 | 358 | Channel 10 accumulated energy | |
| 60 | Energy_Sum | float CDBA (uint32 before V20_260305SP) | 2 | kWh | 160 | 260 | 360 | Sum of the chip's channels | |
| 62 | RMS_V | uint16 | 1 | V | 0.01 | 162 | 262 | 362 | Voltage |
| 63 | Period | uint16 | 1 | Hz | 0.01 | 163 | 263 | 363 | Line frequency |
| 64 | TPS1 | float | 2 | °C | 164 | 264 | 364 | Temperature | |
| 66 | PF | float | 2 | 166 | 266 | 366 | Power factor, 0-1 |
The document also lists aggregate data starting at register 1000 (sums for current, power and energy, averages for voltage and frequency, max for temperature), but does not give a layout for it.
Configuration register
| Register | Hex | Function | Read / Write | Values |
|---|---|---|---|---|
| 30 | 0x1E | Bidirectional CT mode | FC 0x03 / FC 0x06 | 0 = Disabled, 1 = Enabled |
Coils
Written with FC 0x05. The document does not give the value to write. FF 00 works on mine (see the logs in the flashing post). The per-channel clear coils are given as ranges; 526 being channel 1 is implied, but not stated.
| Address | Hex | Function |
|---|---|---|
| 500 | 0x1F4 | Warm reset |
| 501 | 0x1F5 | Save communication parameters to flash |
| 503 | 0x1F7 | Save calibration coefficients to flash |
| 504 | 0x1F8 | Clear coefficients (resets all to 1.0) |
| 510 | 0x1FE | Restore factory communication parameters |
| 520 | 0x208 | Clear all energy, chip 1 |
| 521 | 0x209 | Clear all energy, chip 2 |
| 522 | 0x20A | Clear all energy, chip 3 |
| 526-535 | 0x20E-0x217 | Clear energy, chip 1 channels 1-10 |
| 536-545 | 0x218-0x221 | Clear energy, chip 2 channels 1-10 |
| 546-555 | 0x222-0x22B | Clear energy, chip 3 channels 1-10 |
| 586 | 0x24A | Clear sum energy, chip 1 |
| 587 | 0x24B | Clear sum energy, chip 2 |
| 588 | 0x24C | Clear sum energy, chip 3 |
Calibration coefficients
Float (CDBA), 2 words each, default 1.0. Read with FC 0x03, written with FC 0x10. Write coil 503 afterwards to save them to flash.
Chip 1 is listed below. The document gives the chip 2 base as 3064, and chip 3 as 3128, with the same layout.
| Address (chip 1) | Hex | Coefficient |
|---|---|---|
| 3000 | 0xBB8 | RMS1 factor |
| 3002 | 0xBBA | RMS2 factor |
| 3004 | 0xBBC | RMS3 factor |
| 3006 | 0xBBE | RMS4 factor |
| 3008 | 0xBC0 | RMS5 factor |
| 3010 | 0xBC2 | RMS6 factor |
| 3012 | 0xBC4 | RMS7 factor |
| 3014 | 0xBC6 | RMS8 factor |
| 3016 | 0xBC8 | RMS9 factor |
| 3018 | 0xBCA | RMS10 factor |
| 3020 | 0xBCC | WATT1 factor |
| 3022 | 0xBCE | WATT2 factor |
| 3024 | 0xBD0 | WATT3 factor |
| 3026 | 0xBD2 | WATT4 factor |
| 3028 | 0xBD4 | WATT5 factor |
| 3030 | 0xBD6 | WATT6 factor |
| 3032 | 0xBD8 | WATT7 factor |
| 3034 | 0xBDA | WATT8 factor |
| 3036 | 0xBDC | WATT9 factor |
| 3038 | 0xBDE | WATT10 factor |
| 3040 | 0xBE0 | ENERGY1 factor |
| 3042 | 0xBE2 | ENERGY2 factor |
| 3044 | 0xBE4 | ENERGY3 factor |
| 3046 | 0xBE6 | ENERGY4 factor |
| 3048 | 0xBE8 | ENERGY5 factor |
| 3050 | 0xBEA | ENERGY6 factor |
| 3052 | 0xBEC | ENERGY7 factor |
| 3054 | 0xBEE | ENERGY8 factor |
| 3056 | 0xBF0 | ENERGY9 factor |
| 3058 | 0xBF2 | ENERGY10 factor |
| 3060 | 0xBF4 | ENERGY SUM factor |
Changes in V20_260305SP
- Power (WATT) changed from uint32 to int32. Negative values are reverse power.
- Energy changed from uint32 (1 kWh per count, max 65535 kWh) to float.
- Added FC 0x06, and register 30 (bidirectional CT mode).
Bank 1 reads negative? L and N are backwards
This happened on both of my N30s.
The symptom
Every loaded channel on bank 1 reads negative watts. Bank 2 on the same board is positive. Volts and amps look normal. The CTs are all clamped the same direction, and the CT connectors are all plugged in the same way.
My N30, reading raw signed power (W), before the fix:
| Ch | Bank 1 | Bank 2 |
|---|---|---|
| 4 | 0.0 | 6.8 |
| 5 | -94.0 | 0.0 |
| 6 | 0.0 | 78.1 |
| 7 | -389.9 | 0.0 |
Why it happens
Each BL0910 chip calculates real power from its CT current and its own voltage input. If L and N are swapped on a chip's voltage input, the voltage waveform it sees is upside down. The RMS volts still read a normal ~123 V, but every power reading on that chip comes out negated. From the readings alone, that looks the same as every CT on the bank being reversed.
I don't know if this is the board's terminal layout, or something else. Both boards, wired the same way, had bank 1 inverted and bank 2 correct.
The fix
With the power off, swap L and N on bank 1's voltage input.
These are the voltage inputs, one L / N pair per bank:

Same N30, same ports, after the swap:
| Ch | Bank 1 | Bank 2 |
|---|---|---|
| 4 | 0.0 | 6.8 |
| 5 | 188.8 | 0.0 |
| 6 | 0.0 | 138.2 |
| 7 | 316.9 | 0.0 |
And the second board, bank 1, before and after the same swap:
| Ch | Before | After |
|---|---|---|
| 2 | -244.5 | 243.3 |
| 3 | -81.7 | 89.5 |
| 5 | -157.1 | 156.3 |
The loads stayed on the same ports. Only the sign changed.