Juntek Battery Monitor Bluetooth Integration

I’m trying to add to home assistant this monitor, here i find a method using esphome but i was thinking if already have bluetooth connection why no use it. so i come across a guide for sniff the data from bluetooth and some of the code in

i rewrite the connection with bleak and added some more code, and now this is the output i get

INFO:root:{'power': 360.66, 'impedance': 10.11, 'mins_remaining': 1338, 'current': 13.61, 'discharge': 4.50254, 'ah_remaining': 307.294, 'soc': 85.35944444444445, 'voltage': 26.5}
INFO:root:{'power': 360.66, 'impedance': 10.11, 'mins_remaining': 1338, 'current': 13.61, 'discharge': 4.50264, 'ah_remaining': 307.29, 'soc': 85.35833333333333, 'voltage': 26.5}
INFO:root:{'power': 358.81, 'impedance': 10.11, 'mins_remaining': 1338, 'current': 13.54, 'discharge': 4.50264, 'ah_remaining': 307.29, 'soc': 85.35833333333333, 'voltage': 26.5}
INFO:root:{'power': 358.81, 'impedance': 10.11, 'mins_remaining': 1338, 'current': 13.54, 'discharge': 4.50274, 'ah_remaining': 307.287, 'soc': 85.3575, 'voltage': 26.5}
INFO:root:{'power': 360.4, 'impedance': 10.11, 'mins_remaining': 1338, 'current': 13.6, 'discharge': 4.50274, 'ah_remaining': 307.287, 'soc': 85.3575, 'voltage': 26.5}
INFO:root:{'power': 360.4, 'impedance': 10.11, 'mins_remaining': 1338, 'current': 13.6, 'discharge': 4.50284, 'ah_remaining': 307.283, 'soc': 85.35638888888889, 'voltage': 26.5}
INFO:root:{'power': 360.4, 'impedance': 10.29, 'mins_remaining': 1353, 'current': 13.6, 'discharge': 4.50284, 'ah_remaining': 307.283, 'soc': 85.35638888888889, 'voltage': 26.5}
INFO:root:{'power': 359.07, 'impedance': 10.29, 'mins_remaining': 1353, 'current': 13.55, 'discharge': 4.50284, 'ah_remaining': 307.283, 'soc': 85.35638888888889, 'voltage': 26.5}
INFO:root:{'power': 359.07, 'impedance': 10.29, 'mins_remaining': 1353, 'current': 13.55, 'discharge': 4.50293, 'ah_remaining': 307.279, 'soc': 85.35527777777777, 'voltage': 26.5}
INFO:root:{'power': 357.22, 'impedance': 10.29, 'mins_remaining': 1353, 'current': 13.48, 'discharge': 4.50293, 'ah_remaining': 307.279, 'soc': 85.35527777777777, 'voltage': 26.5}
INFO:root:{'power': 357.22, 'impedance': 10.29, 'mins_remaining': 1353, 'current': 13.48, 'discharge': 4.50303, 'ah_remaining': 307.275, 'soc': 85.35416666666666, 'voltage': 26.5}
INFO:root:{'power': 359.07, 'impedance': 10.29, 'mins_remaining': 1353, 'current': 13.55, 'discharge': 4.50303, 'ah_remaining': 307.275, 'soc': 85.35416666666666, 'voltage': 26.5}
INFO:root:{'power': 359.07, 'impedance': 10.29, 'mins_remaining': 1353, 'current': 13.55, 'discharge': 4.50313, 'ah_remaining': 307.272, 'soc': 85.35333333333332, 'voltage': 26.5}
INFO:root:{'power': 358.54, 'impedance': 10.29, 'mins_remaining': 1353, 'current': 13.53, 'discharge': 4.50313, 'ah_remaining': 307.272, 'soc': 85.35333333333332, 'voltage': 26.5}
INFO:root:{'power': 358.54, 'impedance': 10.29, 'mins_remaining': 1353, 'current': 13.53, 'discharge': 4.50323, 'ah_remaining': 307.268, 'soc': 85.35222222222222, 'voltage': 26.5}
INFO:root:{'power': 358.81, 'impedance': 10.29, 'mins_remaining': 1353, 'current': 13.54, 'discharge': 4.50323, 'ah_remaining': 307.268, 'soc': 85.35222222222222, 'voltage': 26.5}
INFO:root:{'power': 358.81, 'impedance': 10.29, 'mins_remaining': 1353, 'current': 13.54, 'discharge': 4.50333, 'ah_remaining': 307.264, 'soc': 85.35111111111111, 'voltage': 26.5}
INFO:root:{'power': 360.93, 'impedance': 10.29, 'mins_remaining': 1353, 'current': 13.62, 'discharge': 4.50333, 'ah_remaining': 307.264, 'soc': 85.35111111111111, 'voltage': 26.5}
INFO:root:{'power': 360.93, 'impedance': 10.27, 'mins_remaining': 1362, 'current': 13.62, 'discharge': 4.50333, 'ah_remaining': 307.264, 'soc': 85.35111111111111, 'voltage': 26.5}
INFO:root:{'power': 360.93, 'impedance': 10.27, 'mins_remaining': 1362, 'current': 13.62, 'discharge': 4.50343, 'ah_remaining': 307.26, 'soc': 85.35, 'voltage': 26.5}
INFO:root:{'power': 358.81, 'impedance': 10.27, 'mins_remaining': 1362, 'current': 13.54, 'discharge': 4.50343, 'ah_remaining': 307.26, 'soc': 85.35, 'voltage': 26.5}
INFO:root:{'power': 355.89, 'impedance': 10.27, 'mins_remaining': 1362, 'current': 13.43, 'discharge': 4.50343, 'ah_remaining': 307.26, 'soc': 85.35, 'voltage': 26.5}
INFO:root:{'power': 355.89, 'impedance': 10.27, 'mins_remaining': 1362, 'current': 13.43, 'discharge': 4.50353, 'ah_remaining': 307.257, 'soc': 85.34916666666666, 'voltage': 26.5}

what is the idea? i wanna create a Custom Integrations, but my knowles about this topic is basically null, and the documentation is too dense. maybe i can use some of the code from the AC Infinity Bluetooth integration, that my next step but if anyone can help o guide me to the right path.

I’ve been waiting for something like this and glad to see your progress! Thanks for pointing to Chriskomus page. Previously I was having to use RS485 tied to ESP32 or something Arduino and gave up.
One method we could try could be using command line sensors, but I don’t know how to run your script as a service. Command Line - Home Assistant, others use MQTT, another with pyscript.
Your output looks to be json already which can go right into mqtt topics or the command line method

# Example configuration.yaml entry
command_line:
  - sensor:
      name: JSON time
      json_attributes:
        - date
        - milliseconds_since_epoch
      command: "python3 /home/pi/.homeassistant/scripts/datetime.py"
      value_template: "{{ value_json.time }}"

GitHub - fl4p/batmon-ha: Add-on for Home Assistant to connect JK, JBD, Daly, ANT, SOK and Supervolt BMS via Bluetooth

A client of mine has a need for the Renogy controllers, while I have the Junctek K140f so I could test both actually. I need to go configure MQTT first though.

Ard00d has done the later half with setting up bt2-mqtt that maybe will be compatible to our Volts,Amps,watts, but need the amp hour section.

Hi. Has the project moved forward?

I am in the same boat. I do have a Renogy Rover and a Juntek KF series.

At this point, I was able to make a fork from ard00d to make the MQTT push a bit more relevant to the Rover, so it could have the same dataset as the app.

However I am running into issue, as there is no access to systemd from HASSIO, so the last part to turn it into a service doesn’t work, it basically only works if I manually run the bt2.py, which is not an option.

If anyone has any idea, I’m all ears!

As for the KF series Coulometer, I will start working on it this weekend and report back!

Edit :
I found the Bluteooth way was the worst idea with this device.
Juntek’s Bluteooth is plain bad (random value broadcast, no consistency, constant disconnect issues).

I have wrote a fork that is now working very well for my Juntek. I have mine on a RPi, and works on both Blutetooth and RS485. Although I would discourage you to use bluetooth as the Juntek’s implementation is reqlly dirty, the option is there.
The RS485 however is accurate, consistent and easy.
I used one of those USB to RS485 from Amazon for about $10. It then pushes the data to MQQT.

Project and details available on the github : GitHub - AnalogThinker/junctek_monitor: A Python program to pull Juntek Battery Monitor Data over BT or RS485 and post on MQTT