Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
KC868-A6v3 ESPHome yaml for home assistant
#1
Code:
esphome:
  name: a6v3
  friendly_name: a6v3

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

# Enable logging
logger:

# Enable Home Assistant API
api:

wifi:
  ssid: "KinCony"
  password: "a12345678"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "A6 Fallback Hotspot"
    password: "GLdHSsZr1p96"

captive_portal:

i2c:
  sda: 12
  scl: 11
  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 1-8
    address: 0x22

uart:
  - id: uart_1    #RS485
    baud_rate: 9600
    debug:
      direction: BOTH
      dummy_receiver: true
      after:
        timeout: 10ms
    tx_pin: 17
    rx_pin: 18

  - id: uart_2    #RS232
    baud_rate: 9600
    debug:
      direction: BOTH
      dummy_receiver: true
      after:
        timeout: 10ms
    tx_pin: 9
    rx_pin: 10

switch:
  - platform: gpio
    name: "A6v3-output1"
    id: a6v3_output1
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 0
      mode: OUTPUT
      inverted: true

  - platform: gpio
    name: "A6v3-output2"
    id: a6v3_output2
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 1
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "A6v3-output3"
    id: a6v3_output3
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 2
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "A6v3-output4"
    id: a6v3_output4
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "A6v3-output5"
    id: a6v3_output5
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "A6v3-output6"
    id: a6v3_output6
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 5
      mode: OUTPUT
      inverted: true

  - platform: uart
    uart_id: uart_1
    name: "RS485 Button"
    data: [0x11, 0x22, 0x33, 0x44, 0x55]

  - platform: uart
    uart_id: uart_2
    name: "RS232 Button"
    data: [0x55, 0x66, 0x77, 0x88, 0x99]

binary_sensor:
  - platform: gpio
    name: "A6v3-input1"
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true

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

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

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

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

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


##pull-up resistance on PCB
  - platform: gpio
    name: "A6v3-W1-io15"
    pin:
      number: 15
      inverted: true

  - platform: gpio
    name: "A6v3-W1-io16"
    pin:
      number: 16
      inverted: true

  - platform: gpio
    name: "A6v3-W1-DW"
    pin:
      number: 0
      inverted: true


sensor:
  - platform: adc
    pin: 4
    name: "A6v3 A1 Voltage"
    update_interval: 5s
    attenuation: 11db
    filters:
      - lambda:
          if (x >= 3.11) {
            return x * 1.60256;
          } else if (x <= 0.15) {
            return 0;
          } else {
            return x * 1.51;
          }
  - platform: adc
    pin: 5
    name: "A6v3 A2 Voltage"
    update_interval: 5s
    attenuation: 11db
    filters:
      # - multiply: 1.51515
      - lambda:
          if (x >= 3.11) {
            return x * 1.60256;
          } else if (x <= 0.15) {
            return 0;
          } else {
            return x * 1.51;
          }
  - platform: adc
    pin: 6
    name: "A6v3 A3 Current"
    update_interval: 5s
    unit_of_measurement: mA
    attenuation: 11db
    filters:
      - multiply: 6.66666666
  - platform: adc
    pin: 7
    name: "A6v3 A4 Current"
    update_interval: 5s
    unit_of_measurement: mA
    attenuation: 11db
    filters:
      - multiply: 6.66666666

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

display:
  - platform: ssd1306_i2c
    i2c_id: bus_a
    model: "SSD1306 128x64"
    address: 0x3C
    lambda: |-
      it.printf(0, 0, id(roboto), "KinCony A6v3");

gp8403:
  id: my_gp8403
  voltage: 10V

output:
  - platform: gp8403
    id: gp8403_output_1
    gp8403_id: my_gp8403
    channel: 0
  - platform: gp8403
    id: gp8403_output_2
    gp8403_id: my_gp8403
    channel: 1

light:
  - platform: monochromatic
    name: "A6v3-DAC-1"
    output: gp8403_output_1

  - platform: monochromatic
    name: "A6v3-DAC-2"
    output: gp8403_output_2

web_server:
  port: 80
esphome yaml file download:
.txt   A6v3-HA.txt (Size: 5.11 KB / Downloads: 444)
Reply
#2
It works perfectly thank you.Can you help me because my ds18b20 device is not showing up.I have 2 of them connected to the panel.
Reply
#3
take a photo, how you connect with KC868-A6v3 board. it should work with ESPHome yaml, just add DS18B20 code.
https://esphome.io/components/sensor/dallas_temp.html
Reply
#4
Could you check if my code, added to your code for this board, is causing any Wi-Fi issues?

In the ESP32 version, it caused a Wi-Fi conflict and wouldn't connect to Home Assistant. You can adapt the pins to the ESP32 S3 board.

Thanks for checking.

uart:
rx_pin: 1
tx_pin: 3
baud_rate: 9600

modbus:

one_wire:
#Zółty przewód
- platform: gpio
id: Rekuperator
pin: 18
#Pomarańczowy przewód
- platform: gpio
id: Nagrzewnica
pin: 17


time:
- platform: homeassistant
id: esp_time
on_time:
- seconds: 1
minutes: 0
hours: 0
then:
- lambda: |-
id(daily_energy_total) = 0.0;
# id(last_pzem_energy) = id(PC_PkWh).state;

# Reset miesięcznego zużycia pierwszego dnia miesiąca o 00:00:01
- seconds: 1
minutes: 0
hours: 0
days_of_month: 1
then:
- lambda: |-
id(monthly_energy_total) = 0.0;
# id(last_pzem_energy) = id(PC_PkWh).state;

- platform: sntp
id: sntp_time
timezone: Europe/Warsaw
servers:
- 0.pl.pool.ntp.org
- 1.pl.pool.ntp.org
- 2.pl.pool.ntp.org

sensor:
- platform: template
name: "Czas od ostatniego włączenia"
id: time_since_last_on
accuracy_decimals: 0
unit_of_measurement: "min"
update_interval: 1s
lambda: |-
auto now = id(esp_time).now().timestamp;
if (id(last_on_time) == 0) {
return 0;
} else {
return (now - id(last_on_time)) / 60;
}
- platform: template
name: "Dzienne zużycie energii"
id: daily_energy
unit_of_measurement: "kWh"
accuracy_decimals: 2
update_interval: 1s
lambda: |-
return id(daily_energy_total) / 1000.0;

# Miesięczny licznik energii
- platform: template
name: "Miesięczne zużycie energii"
id: monthly_energy
unit_of_measurement: "kWh"
accuracy_decimals: 2
update_interval: 1s
lambda: |-
return id(monthly_energy_total) / 1000.0;
- platform: template
name: "Podniesienie temperatury przez GWC"
id: gwc_delta_temp
unit_of_measurement: "°C"
accuracy_decimals: 1
lambda: |-
// Jeśli GWC Powietrze jest włączone, zwróć 0
if (id(Pozycja_GWC_Powietrze).state) {
return 0.0;
}

// Jeśli GWC Ziemia nie jest włączone, zwróć 0 (opcjonalne zabezpieczenie)
if (!id(Pozycja_GWC_Ziemia).state) {
return 0.0;
}
return id(CZ).state - id(temperatura_zew_HA).state;
update_interval: 15s

- platform: template
name: "Koszt całkowity"
id: koszt_calkowity
accuracy_decimals: 2
lambda: |-
// Pobierz wartość zużycia energii
float A = id(PC_PkWh).state;
// Oblicz koszt całkowity
return A * 1.0;
unit_of_measurement: "PLN"

- platform: wifi_signal
name: "Moc sygnału Wi-Fi"
update_interval: 60s # Aktualizacja co minutę
id: wifi_signal_sensor
# MODUŁ PZEM 004 T MIERNIK ENERGII
- platform: pzemac
id: pzemac1
current:
name: "PZEM-004T V3 Current"
id: "PC_J"
voltage:
name: "PZEM-004T V3 Voltage"
id: "PC_V"
energy:
name: "PZEM-004T V3 Energy"
id: "PC_P"
unit_of_measurement: Wh
power:
name: "PZEM-004T V3 Power"
id: "PC_W"
unit_of_measurement: W
frequency:
name: "PZEM-004T V3 Frequency"
id: "PC_Freq"
power_factor:
name: "PZEM-004T V3 Power Factor"
update_interval: 1s

- platform: pzemac
energy:
name: "PZEM-004T V3 Energy kWh"
id: "PC_PkWh"
unit_of_measurement: kWh
filters:
# Multiplication factor from Wh to kWh is 0.001
- multiply: 0.001
power:
name: "PZEM-004T V3 Power kWh"
id: "PC_WkWh"
unit_of_measurement: kW
filters:
# Multiplication factor from Wh to kWh is 0.001
- multiply: 0.001
update_interval: 1s

- platform: dht
model: AUTO_DETECT
pin: 15
temperature:
id: Temperatura
name: "Tstrych"
humidity:
id: Wilgotnosc
name: "Wstrych"
update_interval: 15min

# CZUJNIK TEMPERATURY REKUPERATOR
- platform: dallas_temp
one_wire_id: Rekuperator
address: 0x0900000083a04028
id: CZ
name: "Czerpnia"
accuracy_decimals: 1
update_interval: 15s
filters:
multiply: 1.05

- platform: dallas_temp
one_wire_id: Rekuperator
address: 0x350000006a8f2628
id: NW
name: "Nawiew"
accuracy_decimals: 1
update_interval: 15s
filters:
multiply: 0.99

- platform: dallas_temp
one_wire_id: Rekuperator
address: 0xdf00000085c2fd28
id: WYC
name: "Wyciag"
accuracy_decimals: 1
update_interval: 15s
filters:
multiply: 1.04

- platform: dallas_temp
one_wire_id: Rekuperator
address: 0xe200000069f46728
id: WYRZ
name: "Wyrzutnia"
accuracy_decimals: 1
update_interval: 15s
filters:
multiply: 1.05
#CZUJNIK TEMPERATURY NAGRZEWNICY
- platform: dallas_temp
one_wire_id: Nagrzewnica
address: 0xde0000008300b928
id: GZ
name: "GZ"
accuracy_decimals: 1
update_interval: 15s
filters:
multiply: 0.99

- platform: dallas_temp
one_wire_id: Nagrzewnica
address: 0x5200000083035c28
id: GP
name: "GP"
accuracy_decimals: 1
update_interval: 15s
filters:
multiply: 1.01

- platform: dallas_temp
one_wire_id: Nagrzewnica
address: 0xc000000082fc1428
id: TPN
name: "Teperatura Nawiew"
accuracy_decimals: 1
update_interval: 15s
filters:
multiply: 0.993

- platform: dallas_temp
one_wire_id: Nagrzewnica
address: 0x170000008807d328
id: TW
name: "Temperatura Wywiew"
accuracy_decimals: 1
update_interval: 15s

- platform: dallas_temp
one_wire_id: Nagrzewnica
address: 0x93000000854b3828
id: TK
name: "Temperatura Kompresor"
accuracy_decimals: 1
update_interval: 15s
filters:
multiply: 0.99
Reply
#5
if your yaml have issue. you can download KCS v3 firmware to esp32-s3. enable mqtt auto discovery option for home assistant. So that all hardware resource will integrate to home assistant easily.
Reply
#6
You don't understand the questions. The ten additional codes added to your code on the ESP32 board are causing a Wi-Fi conflict. I'm guessing the data packets are too large for the ESP32. Now I want to buy a board with an ESP32 S3 module from you and I'm curious if the same problem might occur. If I encounter problems that don't make sense, then I'll be buying something that doesn't meet my requirements. I'd have to check if the problem persists before purchasing.
Reply
#7
i think software will not conflict wifi. maybe you can check hardware wire. if you disconnect with the meter, whether work well.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)