Juntek KG-F Series on HA

Hi all,

I am looking to get a shunt KG140F to monitor my battery voltage, current, and SOC. It supports modbus over rs485. The problem is the manufacturer’s implementation of modbus. They have provided the documentation but i don’t know how to get HA to read register 50 which contains voltage, current, and SOC.

Someone has writen a code (not pyton) but i dont know how to convert to something HA can read.

Processing: juntek modbus.txt…

Any help appreciated.

Manufacturer’s manual
http://68.168.132.244/KG-F_EN_manual.pdf

Someone code
https://drive.google.com/file/d/1-SebfO9lf3YwsWZK1gilc8lOESgRYZeb/view?usp=sharing

3 Likes

Hi, I’m also interested in the integration of this component, I have no idea of ​​programming, I can’t help much, do you have any progress?
I also have a pzem through esphome and this works well since esphome has it integrated.
Thanks

I don’t have a solution yet. I have also ordered a PZEM-017 which I intend to use with elfin ew11.

1 Like

hi, i have an elfin ew11, do you have any progress with the junctek or pzem?

I think i found something

1 Like

I also found this tutorial

1 Like

Had any luck getting this working properly?

good morning
Someone has managed to communicate the KG-F100 with an EW11 over Wi-Fi to a home assistant. Could you explain the steps and configuration in EW11, and in HA.

Thank you.

Why not use the already working solution posted by @mjanicek. That is what I am using and works well.

What card do I need, I have no experience with transmoting

Hello .mjanicek. I have a KG-F 100 meter for the photovoltaic panels and battery of my motorhome and I want to connect it with Home Assistant. Could you give me more information about the material you needed (communication cards, wiring and programming in home assistant)?

Thank you very much in advance

Antonio Orduña

He used Wemos mini R1. Just follow the link @marcinek posted.

I used an esp32 but the process is the same.

Junteks shunt http://www.junteks.com/productinfo/226165.html
RS485 > LAN NB114-

The display must be disconnected!

configuration.yaml

sensor:
  # Example configuration.yaml entry
  - platform: tcp
    name: VoltageMeter
    host: 192.168.0.200
    port: 8887
    timeout: 2
    payload: ":R50=1,\r\n"
  - platform: template
    sensors:
      voltage_meter_volts:
        friendly_name:  Battery Monitor - Volts
        unique_id: voltage_meter_volts
        value_template: "{{ float( states('sensor.VoltageMeter').split(',')[2] ) / 100.0 }}"
        unit_of_measurement: "V"
      voltage_meter_amps:
        friendly_name:  Battery Monitor - Amps
        unique_id: voltage_meter_amps
        value_template: "{{ float( states('sensor.VoltageMeter').split(',')[3] ) / 100.0 * ( 1.0 if ( states('sensor.VoltageMeter').split(',')[11] == '1' ) else -1.0 ) }}"
        unit_of_measurement: "A"
      voltage_meter_direction:
        friendly_name:  Battery Monitor - Direction
        unique_id: voltage_meter_direction
        value_template: "{{ 'Charging' if ( states('sensor.VoltageMeter').split(',')[11] == '1' ) else 'Discharging' }}"
      voltage_meter_battery_remaining_capacity:
        friendly_name:  Battery Monitor - Remaining Capacity
        unique_id: voltage_meter_remaining_capacity
        value_template: "{{ float( states('sensor.VoltageMeter').split(',')[4] ) / 1000.0 }}"
        unit_of_measurement: "Ah"
      voltage_meter_battery_capacity:
        friendly_name:  Battery Monitor - Elapsed Ah
        unique_id: voltage_meter_Ah
        value_template: "{{ float( states('sensor.VoltageMeter').split(',')[5] ) / 1000.0 }}"
        unit_of_measurement: "Ah"
      voltage_meter_battery_charged:
        friendly_name:  Battery Monitor - Charged
        unique_id: voltage_meter_charged
        value_template: "{{ float( states('sensor.VoltageMeter').split(',')[6] ) / 100000.0 }}"
        unit_of_measurement: "kWh"
        
      voltage_meter_battery_remaining_capacity_percentage:
        friendly_name:  Battery Monitor - Remaining Capacity Percentage
        unique_id: voltage_meter_remaining_capacity_percentage
        value_template: "{{ int( float( states('sensor.VoltageMeter').split(',')[4] ) / 2800.0 ) }}"
        unit_of_measurement: "%"
        
      voltage_meter_battery_remaining_capacity_time:
        friendly_name:  Battery Monitor - Remaining Capacity Time
        unique_id: voltage_meter_remaining_capacity_time
        value_template: "{{ float(states('sensor.voltage_meter_battery_remaining_capacity')|float(0)) / 10.0 / float(states('sensor.voltage_meter_amps')|float(0)) }}"
        unit_of_measurement: "H"
      voltage_meter_battery_power:
        friendly_name:  Battery Monitor - Power
        unique_id: voltage_meter_power
        value_template: "{{ float(states('sensor.voltage_meter_amps')|float(0)) * float(states('sensor.voltage_meter_volts')|float(0)) }}"
        unit_of_measurement: "W"
      voltage_meter_battery_temperature:
        friendly_name:  Battery Monitor - Temperature
        unique_id: voltage_meter_temperature
        value_template: "{{ float( states('sensor.VoltageMeter').split(',')[8] ) - 100.0 }}"
        unit_of_measurement: "C"

   
      voltage_meter_battery_power_in:
        friendly_name:  Battery Monitor - Power IN
        unique_id: voltage_meter_power_in
        unit_of_measurement: "kW"
        device_class: power
        value_template: >
          {% set power = states('sensor.voltage_meter_amps')|float(0) * states('sensor.voltage_meter_volts')|float(0) / 1000 %}
          {% if power >= 0 %}
            {{ power }}
          {% else %}
            0
          {% endif %}
        availability_template: "{{ states('sensor.voltage_meter_amps')|is_number and states('sensor.voltage_meter_volts')|is_number }}"

      voltage_meter_battery_power_out:
        friendly_name:  Battery Monitor - Power OUT
        unique_id: voltage_meter_power_out
        unit_of_measurement: "kW"
        device_class: power
        value_template: >
          {% set power = states('sensor.voltage_meter_amps')|float(0) * states('sensor.voltage_meter_volts')|float(0) / 1000 %}
          {% if power < 0 %}
            {{ power|abs }}
          {% else %}
            0
          {% endif %}
        availability_template: "{{ states('sensor.voltage_meter_amps')|is_number and states('sensor.voltage_meter_volts')|is_number }}"

Integration - Riemann sum integral

sensor:
  - platform: integration
    name: Battery Energy In
    source: sensor.battery_power_in
	method: left
  - platform: integration
    name: Battery Energy Out
    source: sensor.battery_power_out
	method: left
1 Like

@DeadmaroZ-TLOTL, this seems neater in my view. Can you share a picture of your connection between NB114 and Juntek shunt?

1 Like

1 Like

Hello chukaonline. Do you have more information to make the connection with the ESP32, could you provide some photographs and video so that I can become familiar with this device and how to interconnect it to the KG-F through the RS 485 port…
Antonio Orduña

:see_no_evil: :see_no_evil: :see_no_evil: :see_no_evil: Juntek KG-F Series on HA - #5 by ronnyd23

Mine is quite an untidy mess.

1 Like

Hola Chukaonline.

Podrias pasar mas fotos o un esquema a mano alzada entre el cableado del RS-485 LINK y la tarjeta EspHome?
Antentamente. Antonio