Juntek KG-F Series on HA

I don’t have read errors.
Enable uart debug to see exactly what you receive from junctek

uart:
  id: uart_junctek
  tx_pin: ${tx_pin}
  rx_pin: ${rx_pin}
  baud_rate: 115200
  debug:
    direction: BOTH
    dummy_receiver: false
    after:
      delimiter: "\n"
    sequence:
      - lambda: |-
          UARTDebug::log_string(direction, bytes);

One of my friend had errors during battery charge (especially when charging also from AC). He changed ESP32 USB charger and solved.

@david_john
I tried to use shunt w/o display, no response sending R50 to same port.
I suppose you need to use display port

Thanks @pongo, i got another esp8266 and flashed tasmota using your solution. The result is better for me than esphome I was using.

Thanks @pongo for sharing your solution on how to integrate KHF shunt battery monitor with Tasmota into Home Assistant. I got mine set up and running beautifully. :+1:

That being said, I’m trying to replicate your setup as per your screenshot by adding 2 additional sensors namely “Charge Energy Today” and “Discharge Energy Today” without success.

I’m new with Home Assistant which is probably why all my attempts have failed so far. I have tried utility meter to get these energy values reset daily, which are working ok but I’m stuck when trying to add these 2 new sensors to the device. They are currently showing up on their own as separate entities.

Could you please share how did you do it? Thanks again. :pray:

Hi @pongo, i need some help if you have some time. I am trying to use Elfin EW11 instead of the ESP32 board. When I am using ESP32 as you did, the mqtt received in HA via mqtt explorer is below

 {
  "SSerialReceived": ":r50=1,5,2361,1481,15562,792845,34x134,202002,135,0,0,0,61,100,250117,95706,"
  "SSerialReceived": ":R50=1,"
}

For this, your code works very well.

 - trigger: mqtt
    topic: tele/Junctek_Monitor/RESULT
    payload: "True"
    value_template: "{{ value_json.SSerialReceived.split('=')[0] == ':r50'}}"
    variables:
      split_values: "{{ trigger.payload_json.SSerialReceived.split('=')[1].split(',')[:16] }}"

When I use my Elfin EW11, I get the below mqtt, which does not look Jason but exactly as it is in the Junctek device.

:R50=1,
:r50=1,255,2455,691,14741,791200,344400,201112,135,0,0,1,1681,100,250117,94216,
:R51=1,
:r51=1,147,0,0,0,0,0,255,0,0,2000,100,100,100,0,0,1,100,0,0,0,20,20,255,0,0,0,0

How can i rewrite your automation for both R50 and R51 to capture these values?

Meanwhile, i now see this error coming in HA logs

Logger: homeassistant.components.mqtt.client
Source: components/mqtt/client.py:1117
integration: MQTT (documentation, issues)
First occurred: 1:53:45 pm (1001 occurrences)
Last logged: 2:05:28 pm

Can't decode payload b'b\xfe100,250118,135621,\r\n' on EW11_monitor with encoding utf-8 (for <Job None HassJobType.Callback <function async_attach_trigger.<locals>.mqtt_automation_listener at 0x7fc8d1c3c680>>)
Can't decode payload b':R51=1,\n:r51=1,147,0,0,0,0,0,255,0,0,2000,100,100,100,0,0,1,100,0,0,0,20,20,255,0,0,0,0,\r\nb\xfe100,250118,135627,\r\n' on EW11_monitor with encoding utf-8 (for <Job None HassJobType.Callback <function async_attach_trigger.<locals>.mqtt_automation_listener at 0x7fc8d2dbb4c0>>)
Can't decode payload b':R51=1,\n:r51=1,147,0,0,0,0,0,255,0,0,2000,100,100,100,0,0,1,100,0,0,0,20,20,255,0,0,0,0,\r\nb\xfe100,250118,135627,\r\n' on EW11_monitor with encoding utf-8 (for <Job None HassJobType.Callback <function async_attach_trigger.<locals>.mqtt_automation_listener at 0x7fc8d1c3c680>>)
Can't decode payload b'\xff255,0,0,0,0,\r\n' on EW11_monitor with encoding utf-8 (for <Job None HassJobType.Callback <function async_attach_trigger.<locals>.mqtt_automation_listener at 0x7fc8d2dbb4c0>>)
Can't decode payload b'\xff255,0,0,0,0,\r\n' on EW11_monitor with encoding utf-8 (for <Job None HassJobType.Callback <function async_attach_trigger.<locals>.mqtt_automation_listener at 0x7fc8d1c3c680>>)

Hello,
try to replace “value_json.SSerialReceived” with “value” and “payload_json.SSerialReceived” with “payload” and see if it works

Hello,
I didn’t make any special.
I suppose UtilityMeter follows source energy device… but I’m not sure.

KMF (KM14F, KM160F) series is working without external hardware. energy_ class and state_class included, compatible the HA energy-monitoring. (need: node-red, mosquito)