diy solar

diy solar

Monitoring Software-Solar Assistant, JK-BMS, ESPHome and Home Assistant

ok, progress, I made a few changes and it will now restart OK, no errors
still dont see the new entity yet called energy_gridtiepv
I read somewhere that to be able to use an entity in the energy dashboard, it needs these also ??

device_class: "energy"
state_class: "total_increasing"

this now restarts


sensor:
- platform: integration
source: sensor.gridtie_totalsolar
name: energy_gridtiepv
# unit: kWh
unit_time: h
unit_prefix: k
round: 2
method: left
 
This ESP32 is monitoring the JK-BMS as is in the picture. (I'll mount it later) through bluetooth. Love ESP technology!

Hi DanF:

Would you be able to say how you got the ESP32 working with your JMS into Home Assistant? I'd love to sort that out - have the parts here!

Thanks
 
Hi DanF:

Would you be able to say how you got the ESP32 working with your JMS into Home Assistant? I'd love to sort that out - have the parts here!

Thanks
Ah, no worries figured it out, you gave me the idea!


Just for info for anyone searching (like I was)... if you're doing it via JK BMS ESPHome in Home Assistant - this will allow the BMS and the bluetooth of the ESP32 to talk to each other (and allowing you to extend the range on wifi). No wires or UART needed!!!

Go here for full source code

https://github.com/syssi/esphome-jk-bms (thanks to the authors of this, you're amazing!)

You need an ESP32 (ebay, aliexpress...etc...)


Add the ESP32 device to ESPHome (by usb is the easiest to first upload the code to it). Once you've done that you can connect and edit wirelessly.

You'll need to put this code in the ESPhome Yaml section - a section of my code below ... you'll need to add the sensors and the binary senors - if you follow the example from here and on the code, you'll see.

You'll need to scan for the bluetooth mac address of the JK BMS. Put this code in your Yaml below and remove all the parts after it
esp32_ble_tracker:

and look for the bluetooth devices it will list in the logs output - you'll see 'JK...' grab the mac of that and put it below.

example of my Yaml code that worked for me - be careful yaml is extremely syntax/case sensitve!

external_components:
- source: github://syssi/esphome-jk-bms@main
esphome:
name: 24vbms
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "removed"
ota:
password: "removed"
wifi:
ssid: "removed"
password: "removed"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "24Vbms Fallback Hotspot"
password: "removed"
captive_portal:

# if you want to use mqtt on it's own rather than Home Assistant remove the hash -
#mqtt:
# broker: your mqqt IP or name
# username: youruser
# password: yourpassword

esp32_ble_tracker: #this is the tracker that will let you find the Bluetooth devices - look for JK, remove parts after this while your scanning for it.

#add these parts once you have the mac address
ble_client:
- mac_address: put the mac address here
id: client0
jk_bms_ble:
- ble_client_id: client0
protocol_version: JK02
throttle: 5s
id: bms0

Fill in all the sensors here (see example yaml in github codes)

Hopefully you stumble across this ... and it helps!
 
Ah, no worries figured it out, you gave me the idea!


Just for info for anyone searching (like I was)... if you're doing it via JK BMS ESPHome in Home Assistant - this will allow the BMS and the bluetooth of the ESP32 to talk to each other (and allowing you to extend the range on wifi). No wires or UART needed!!!

Go here for full source code

https://github.com/syssi/esphome-jk-bms (thanks to the authors of this, you're amazing!)

You need an ESP32 (ebay, aliexpress...etc...)


Add the ESP32 device to ESPHome (by usb is the easiest to first upload the code to it). Once you've done that you can connect and edit wirelessly.

You'll need to put this code in the ESPhome Yaml section - a section of my code below ... you'll need to add the sensors and the binary senors - if you follow the example from here and on the code, you'll see.

You'll need to scan for the bluetooth mac address of the JK BMS. Put this code in your Yaml below and remove all the parts after it
esp32_ble_tracker:

and look for the bluetooth devices it will list in the logs output - you'll see 'JK...' grab the mac of that and put it below.

example of my Yaml code that worked for me - be careful yaml is extremely syntax/case sensitve!

external_components:
- source: github://syssi/esphome-jk-bms@main
esphome:
name: 24vbms
esp32:
board: esp32dev
framework:
type: arduino
# Enable logging
logger:
# Enable Home Assistant API
api:
encryption:
key: "removed"
ota:
password: "removed"
wifi:
ssid: "removed"
password: "removed"
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "24Vbms Fallback Hotspot"
password: "removed"
captive_portal:

# if you want to use mqtt on it's own rather than Home Assistant remove the hash -
#mqtt:
# broker: your mqqt IP or name
# username: youruser
# password: yourpassword

esp32_ble_tracker: #this is the tracker that will let you find the Bluetooth devices - look for JK, remove parts after this while your scanning for it.

#add these parts once you have the mac address
ble_client:
- mac_address: put the mac address here
id: client0
jk_bms_ble:
- ble_client_id: client0
protocol_version: JK02
throttle: 5s
id: bms0

Fill in all the sensors here (see example yaml in github codes)

Hopefully you stumble across this ... and it helps!
Thanks for posting that! Also ...If you have an older version (Mine is the JK-B2A24S and only monitors and balances). You would put JK04 for the protocol version. (There is an example yaml for that on the site as well).
Now I'm thinking about using the delta cell voltage reading as a shutdown switch if the difference exceeds "X" amount. I'll at least have it text notify my phone. Home Assistant has my brain now.. Hahaha
 
Last edited:
Thanks for posting that! Also ...If you have an older version (Mine is the JK-B2A24S and only monitors and balances). You would put JK04 for the protocol version. (There is an example yaml for that on the site as well).
Now I'm thinking about using the delta cell voltage reading as a shutdown switch if the difference exceeds "X" amount. I'll at least have it text notify my phone. Home Assistant has my brain now.. Hahaha

Ah yes, good to know, I had no idea which was correct, tried the JK04 part first and it was getting spurious readings - switched to JK02 and it worked (I hadn't realised it was the wrong version).

It's great isn't it, the possibilities are endless! I've just been playing with Grafana :) Thanks for your post, I had a lost cause with the UART cables (for unknown reasons) - your thread made me think 'It is possible' with bluetooth. I love Home Assistant
 
Wattmatters,
thanks for your help last night with the yaml file. I never got it quite right however.
someone else turned me on to another easier way of doing it.
most of my sensors were considered "power" sensors as they report current usage in watts.
the energy dashboard wants it all in kwh, an "energy" sensor in HA speak

there is an integration " riemann sum integral" that is easy to use and you dont need any yaml code
here is link if you are interested

https://www.home-assistant.io/integrations/integration/

so I have been able to bring in data from emporia and other data into the energy dashboard on HA

thanks
 
there is an integration " riemann sum integral" that is easy to use and you dont need any yaml code
here is link if you are interested

https://www.home-assistant.io/integrations/integration/

so I have been able to bring in data from emporia and other data into the energy dashboard on HA
Cool. I'd forgotten about the Riemann sum integration. The yaml code was trying to do the same thing but nice there was one already available to make it easier.

It's a bit of a confusing name, an integration for integration!
 
I'm using 2022.11.2

Thanks I found the problem, because don't sell energy I didn't fill Return to grid, after I put it the gauge show.

1670064662959.png
 
Lots of great information here, thanks to all involved. It's going to take me some serious reading and note taking to understand it all though haha.
I can do hardware all day long but software makes my head hurt.
 
OK so we are in the same place. sure wish the emporia would let us access the 1 second data thru HA, not just the 1 minute, 1 day data
They used to allow it but I think people were hammering their servers. I wonder if anyone has figured out how to scrape their website because you see data pretty much live when logged into the website.
Ultimately I will do local monitoring by modifying the units but I would like to keep their monitoring in place to.
 
They used to allow it but I think people were hammering their servers. I wonder if anyone has figured out how to scrape their website because you see data pretty much live when logged into the website.
Ultimately I will do local monitoring by modifying the units but I would like to keep their monitoring in place to.
yes they can be reflashed but then you will lose access to the online cloud data.
I wish I had bought Iotawatt units vs emporia, but I have 4 emporias and the iotawatt is quite a bit more money but it has local data and cloud
 
I am hoping to add the local monitoring module to the existing uart pins to retain both systems.
 
Heres a couple shots of my home assistant dashboard that I have been working on this week. Currently pulling data from Daly 16s active balancer on a 48v pack, and also have a Daly 4s BMS on a separate 12v pack. Pulling the data into Home Assistant through the UART port connected to an ESP32 chip running ESPHome. The ESP chip sends all the data from the bms over Wifi.

I have a new JK BMS coming in the mail - planning to set that up the same way this weekend with ESPHome. This one however I can connect via bluetooth instead of having to hard wire it. So the JK will connect to my ESP32 wirelessly over bluetooth and then the ESP32 will then relay that data to my computer over Wifi.
 

Attachments

  • Screenshot 2023-01-06 at 10.55.32 AM.png
    Screenshot 2023-01-06 at 10.55.32 AM.png
    640.3 KB · Views: 67
  • Screenshot 2023-01-06 at 10.56.31 AM.png
    Screenshot 2023-01-06 at 10.56.31 AM.png
    205.6 KB · Views: 63
Back
Top