Smart Home Automation Forum
KC868-M16 configure yaml for ESPhome - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-M16 / M1 / MB / M30 (https://www.kincony.com/forum/forumdisplay.php?fid=50)
+--- Thread: KC868-M16 configure yaml for ESPhome (/showthread.php?tid=2829)

Pages: 1 2


KC868-M16 configure yaml for ESPhome - admin - 04-26-2023

   


.txt   KC868-M16-ESPHome.txt (Size: 7.98 KB / Downloads: 281)

esphome:
  name: m16

esp32:
  board: esp32dev
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "D69bY/GXlmjYkovak6WIhgmbOH8vwyqvMxIHBriYoaY="


# Example configuration entry
ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0

  manual_ip:
    static_ip: 192.168.1.186
    gateway: 192.168.1.1
    subnet: 255.255.255.0 

cd74hc4067:
  - id: cd74hc4067_1
    pin_s0: 32
    pin_s1: 33
    pin_s2: 13
    pin_s3: 16



# Example configuration entry
sensor:

  - platform: adc
    pin: 35
    id: adc35
    update_interval: never
    attenuation: 11db

  - platform: adc
    name: "m16--AI-1"
    pin: 36
    id: adc36
    update_interval: 15s
    attenuation: 11db

  - platform: adc
    pin: 34
    name: "m16--AI-2"
    id: adc34
    update_interval: 15s
    attenuation: 11db

  - platform: adc
    pin: 39
    name: "m16--AI-3"
    id: adc39
    update_interval: 15s
    attenuation: 11db




  - platform: cd74hc4067
    id: ai1
    number: 0
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai2
    number: 1
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai3
    number: 2
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai4
    number: 3
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai5
    number: 4
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai6
    number: 5
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai7
    number: 6
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai8
    number: 7
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai9
    number: 8
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai10
    number: 9
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai11
    number: 10
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai12
    number: 11
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai13
    number: 12
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai14
    number: 13
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai15
    number: 14
    sensor: adc35
    update_interval: 5s

  - platform: cd74hc4067
    id: ai16
    number: 15
    sensor: adc35
    update_interval: 5s


  - platform: ct_clamp
    sensor: ai1
    id: Measured_Current_1
    name: "Measured Current-1"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0.0034 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: template
    id: power1
    name: "power1"
    lambda: return id(Measured_Current_1).state * 220;
    device_class: power
    unit_of_measurement: 'W'
    update_interval: 5s

  - platform: total_daily_energy
    name: "Total Daily Energy1"
    power_id: power1
    filters:
        - multiply: 0.001
    unit_of_measurement: kWh
    accuracy_decimals: 3
    icon: mdi:clock-alert
    device_class: energy


  - platform: ct_clamp
    sensor: ai2
    name: "Measured Current-2"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: ct_clamp
    sensor: ai3
    name: "Measured Current-3"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: ct_clamp
    sensor: ai4
    name: "Measured Current-4"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: ct_clamp
    sensor: ai5
    name: "Measured Current-5"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: ct_clamp
    sensor: ai6
    name: "Measured Current-6"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: ct_clamp
    sensor: ai7
    name: "Measured Current-7"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: ct_clamp
    sensor: ai8
    name: "Measured Current-8"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: ct_clamp
    sensor: ai9
    name: "Measured Current-9"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: ct_clamp
    sensor: ai10
    name: "Measured Current-10"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: ct_clamp
    sensor: ai11
    name: "Measured Current-11"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: ct_clamp
    sensor: ai12
    name: "Measured Current-12"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: ct_clamp
    sensor: ai13
    name: "Measured Current-13"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: ct_clamp
    sensor: ai14
    name: "Measured Current-14"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: ct_clamp
    sensor: ai15
    name: "Measured Current-15"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

  - platform: ct_clamp
    sensor: ai16
    name: "Measured Current-16"
    update_interval: 5s
    filters:
      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.31749 -> 8.95608

time:
  - platform: sntp
    id: my_time


RE: KC868-M16 configure yaml for ESPhome - nuovapentecoste - 10-12-2023

Hi,
The product works correctly but in Home assistant the "Total Daily Energy1" does not reset every day, but continues to count continuously.
How can I solve it?
Thank you


RE: KC868-M16 configure yaml for ESPhome - admin - 10-13-2023

there is "Utility meter" can be used. here someone have asked this question:
https://community.home-assistant.io/t/make-energy-sensor-showing-total-daily-use/391257


RE: KC868-M16 configure yaml for ESPhome - marcel - 10-19-2023

(10-13-2023, 04:15 AM)admin Wrote: there is "Utility meter" can be used. here someone have asked this question:
https://community.home-assistant.io/t/make-energy-sensor-showing-total-daily-use/391257

Hello, do we have a yaml for esphome for KC868-M16 V2.1 including all the features, screen, sensors and sd recording?
I have searched but I wasn't able to find


RE: KC868-M16 configure yaml for ESPhome - admin - 10-19-2023

if you want to use SSD1306 or SHT31 i2c sensor, you can see this demo yaml, have included this function:
https://www.kincony.com/forum/showthread.php?tid=3088


RE: KC868-M16 configure yaml for ESPhome - nuovapentecoste - 10-21-2023

What is the best setting for this clip?
I did various tests with zero load and with known load and I found these parameters to be very close to reality

      - calibrate_linear:
          # Measured value of 0 maps to 0A
          - 0.004 -> 0
          # Known load: 4.0A
          # Value shown in logs: 0.1333A
          - 0.61 -> 100

But it is not precise and is very variable.

Am I doing something wrong? Can I improve the accuracy?
[Image: IMG-9467.jpg]


RE: KC868-M16 configure yaml for ESPhome - admin - 10-22-2023

what's your load current you are testing?


RE: KC868-M16 configure yaml for ESPhome - nuovapentecoste - 10-22-2023

as in your YouTube video, I used a hairdryer, whose consumption I know exactly as I used a sample current clamp.
The value was exactly 2.6 Amperes.
I then varied the second parameter until I found the match on Home Assistant.


RE: KC868-M16 configure yaml for ESPhome - admin - 10-22-2023

if you test 2.6A or <10A current load, suggest chose 10A/50mA CT sensor, not use 100A version, it's too large.


RE: KC868-M16 configure yaml for ESPhome - nuovapentecoste - 10-22-2023

Since it is a very complex system, where the loads can exceed 40A, I bought all 100A clamps.
Do you recommend buying different power clamps and using them based on the maximum load expected for each line?