Replace junctek_kgf with junctek_khf, there was an error on YAML example (now it’s fixed).
Now kWh precision is 3 digits.
Wow, now even all settings are readable!!!
Energy is still 0.1
Well not for me even in web server? Where is the changes, in external components? I reflashed esp but still getting 0.1
How do I get energy today? With additional config in config.yaml?
Yes, also on webserver I can see 3 digits.
Try to clean build files and install again.
Today energy are Utility Meter created on HA (Helpers) with cycle: daily and source kWh from shunt.
Well I’m stuck for now, there is failing supervisor update for all my HA devices, it is not allowing to install samba or any addon without it. I can’t get to build files…
Well I didn’t know that under three dots now there is function to clear build files…
But unfortunately even after clearing them and updating esp there is still no charge for energy, it is still 0.1
Not sure how to force it to update…
If you click on entity Energy you can adjust precision:
Try also in file yaml:
external_components:
- source: github://gianfrdp/esphome-junctek_khf@junctek_khf
components: [ junctek_khf ]
refresh: 60s
One question: is charging active? I mean, if you don’t charge your battery, “Charging Energy” won’t update, it will remain on last value.
Yes, I have done it before and it is updating but only 0.1 the rest stays 00
I will try to set yaml to update external config.
Is it in config.yaml or device.yaml?
yaml for EspHome.
Have you checked EspHome junctek log? If you can see precision?
As shown here https://community-assets.home-assistant.io/original/4X/f/4/c/f4c31d85e4a276a5e022c48c113751ac2d8fb6cd.png
logger:
level: DEBUG
Yes, in logs it was still showing 0.1
Finally with yaml trick I got 0.001
Now it is almost perfect!!! Thank you for your help!!!
I guess last bit is to get warnings about classes away from HA logs, I guess Ah as battery storage is tricky since it is expecting in kW
External components config link is different on git yaml example and in the one with 60s refresh version. Maybe that was my problem before?
They are equivalent, compact or full expanded form.
The relevant difference is refresh.
For HA log… they don’t have yet Ah for energy_storage device_class, this is the issue cause Energy Storage should be Ah not Wh · Issue #1733 · home-assistant/developers.home-assistant · GitHub
But when I talked about log, I was referring to EspHome logs (from webserver for instance).
Hi @pongo
I don’t have a monitor, can I use you solution?
I have tried but I don’t get data
Thank you
@david_john I think it won’t work without screen because screen is that request data, ESP is just listening, kinda one way only. It would be really great if this could work in both situations, but so far it works with screen connected only.
Base module needs requests:
:R50=1,2,1,
:R51=1,2,1,
otherwise it doesn’t send data on Link-Data port (usually it’s done by display).
You can simulate display trying to send them via “uart.write” esphome command.
For testing purpose, try using 2 buttons:
button:
- platform: template
name: "Request data R50"
on_press:
then:
- uart.write:
id: uart_junctek
data: ':R50=1,2,1,\n'
- platform: template
name: "Request data R51"
on_press:
then:
- uart.write:
id: uart_junctek
data: ':R51=1,2,1,\n'
If doesn’t work, then you need to add a second cable connected to RS485 Display port and configure a second uart for this (change “uart_junctek” id with new one). But I’m not sure if RS485 adapter is needed in this case (I didn’t try).
When buttons work, then you can convert into an interval, like:
- interval:
- interval: 10sec
then:
- uart.write:
id: uart_junctek
data: ':R50=1,2,1,\n'
- uart.write:
id: uart_junctek
data: ':R51=1,2,1,\n'
so periodically base module sends data. I’m not 100% sure that new line (\n) is required.
Please, pay attention, my repository works with KH-F models. KL-F and KG-F models could ave different registers (for sure KG-F last registers are different).
I’m going to do those tests you propose. Thank you!
Sorry im not active on this forum. But just wanted to remind - there is no any RS485 on this device, it just simple UART, serial data.
Love your hardware solution to attach esp32 inside and use board’s voltage not external. MAYBE you also know what can be damaged or where to connect to bluetooth module on this device to be able to read serial data not from rj9 connector but from some contacts on the board?
My connection have dead. i have no data comming to rj9 ports, monitor, and esp dont work, but bluetooth does. So i guess some microchip have died. Maybe you know pinout of bluetooth module it still reads data, so i would connect to it instead of non working rj9 pin
You can use solution but you need to use other repo. He ( @incar ) dont have version with no monitor, i do, GitHub - Tommixoft/esphome-junctek_kgf at nomonitor
not tested but should work for people with no monitor. it still have same code that @incar already , lets say, fixed. So if this code will be good for you you can just fork @incar code go to file components/junctek_kgf/junctek_kgf.cpp search for loop function and replace code with this: Code will send needed command to device, just like monitor does adn will read responses.
const unsigned long start_time = esphome::millis();
if (!this->last_settings_ || (*this->last_settings_ + this->update_settings_interval_) < start_time)
{
this->last_settings_ = start_time;
char buffer[20];
sprintf(buffer, ":R51=%d,2,1,\r\n", this->address_);
write_str(buffer);
}
if (!this->last_stats_ || (*this->last_stats_ + this->update_stats_interval_) < start_time)
{
this->last_stats_ = start_time;
char buffer[20];
sprintf(buffer, ":R50=%d,2,1,\r\n", this->address_);
write_str(buffer);
}
if (readline())
{
handle_line();
}
ESPHOMEneeds to get this code from girhub that’s why you have to fork, edit and only than be able to put new github repo into ESPHOME config. I will not do any tutorials here, too lazy, but you will get the idea if you look at current esphome yaml and just replace with new edited repo address.
EDIT i see there may be problem with this code because if settings and data request will be send - program only will read the last response. but as i said im lazy right now to do fixes. i think somebody will help if there will be problems.
Or @incar just could add new property to expose it in ESPHOME config and let people set have they monitor or not and change loop accordingly to what user have set.
Unfortunately it doesn’t work for me. I don’t get data.
Maybe I need an RS485 to TTL adapter?
@pongo Do you get erros during chargining? I am using esphome and I find that when the battery is charging (direction=1), values don’t update. I will like to switch to Tasmota if this issue is not there.
|Time|level|Tag|Message|
| — | — | — | — |
|15:31:42|[D]|[JunkTekKGF:099]|Status 1,42,2804,1094,200000,3549759,4375�016,999999,137,0,99,1,0,100,241211,145336,|
|15:31:42|[E]|[JunkTekKGF:027]|Error no coma 3549759,4375�016,999999,137,0,99,1,0,100,241211,145336,|
|15:31:42|[D]|[JunkTekKGF:235]|Recv checksum 42 total 203898 valid 0|
|15:32:27|[D]|[JunkTekKGF:063]|Settings 1,147,0,0,0,0�0,255,0,�l2000,100,10,100,0,0,1,100,0,0,0,20,20,255,0,0,1,0,|
|15:32:27|[E]|[JunkTekKGF:027]|Error no coma 0�0,255,0,�l2000,100,10,100,0,0,1,100,0,0,0,20,20,255,0,0,1,0,|
|15:32:27|[D]|[JunkTekKGF:235]|Recv checksum 147 total 0 valid 0|