• Have you tried out dark mode?! Scroll to the bottom of any page to find a sun or moon icon to turn dark mode on or off!

diy solar

diy solar

YamBMS JK-BMS-CAN with new Cut-Off Charging Logic (open-source)

@virus100b

In the file packages/base/device_base.yaml

Remove this code block and compile again.

YAML:
external_components:
  # https://github.com/esphome/esphome/pull/7547
  # api: ensure fair network sharing + prevent lost state changes via deferred publish at high event load
  - source: github://pr#7547
    components: [ api, event ]
"I was rushing when I said that the YamBMS is working fine.

I have observed a strange behavior. The previous three days when everything was working fine; the sky was cloudy, and the production was very low, during this time i was mostly importing energy. However, yesterday it was sunny. The issue reappears when the charging or discharging power is high. I have noticed that Home Assistant freezes, and LocalTuya devices also become unavailable. I don't understand this behavior."
Previously, I was using a Hylink 48V to 5V power supply directly from the LFP pack. I have since changed that to an external power supply to test if the power supply was causing the issue, but the problem persists, so the power supply is not the cause.
Yesterday between 16-17h when discharging with over 100A the HA was unavailable and also LocalTuya.


1738760343399.png

Could be to many entities to update for the ESP32? 1738760551225.pngI have removed some of the entities in order to minimize the number but still 346 may be to much. As i said previously I have not experienced any problems before adding the Victron SmartShunt, the number of entities before adding the shunt was around 200.

Another thing: I have observed that the status balancing entities were not updating as they should. I noticed that once the cell delta dropped below the trigger value, the value in Yambms was showing "on," while in the BT app it was showing "off."

Is there anyone using an ESP32 Dev Kit with more than one JK PB and Victron SmartShut? I’m considering trimming more of the entities to reduce the load on the ESP.

I have reduce the update timing also:

# Shunt settings
shunt_update_interval: '5s' # frequency at which Shunt data is refreshed
shunt_combine_interval: '1s' # frequency at which data is combined in YamBMS
# BMS settings
bms_battery_chemistry: '1' # 1-LFP | 2-Li-ion | 3-LTO
bms_update_interval: '3s' # frequency at which BMS data is refreshed, going below '3s' can cause problems
bms_combine_interval: '1s' # frequency at which data is combined in YamBMS
bms_cutoff_timer: '60s'

I’m not sure what else I can do. Do you have any advice?
 
"I was rushing when I said that the YamBMS is working fine.

I have observed a strange behavior. The previous three days when everything was working fine; the sky was cloudy, and the production was very low, during this time i was mostly importing energy. However, yesterday it was sunny. The issue reappears when the charging or discharging power is high. I have noticed that Home Assistant freezes, and LocalTuya devices also become unavailable. I don't understand this behavior."
Previously, I was using a Hylink 48V to 5V power supply directly from the LFP pack. I have since changed that to an external power supply to test if the power supply was causing the issue, but the problem persists, so the power supply is not the cause.
Yesterday between 16-17h when discharging with over 100A the HA was unavailable and also LocalTuya.


View attachment 275808

Could be to many entities to update for the ESP32? View attachment 275811I have removed some of the entities in order to minimize the number but still 346 may be to much. As i said previously I have not experienced any problems before adding the Victron SmartShunt, the number of entities before adding the shunt was around 200.

Another thing: I have observed that the status balancing entities were not updating as they should. I noticed that once the cell delta dropped below the trigger value, the value in Yambms was showing "on," while in the BT app it was showing "off."

Is there anyone using an ESP32 Dev Kit with more than one JK PB and Victron SmartShut? I’m considering trimming more of the entities to reduce the load on the ESP.

I have reduce the update timing also:

# Shunt settings
shunt_update_interval: '5s' # frequency at which Shunt data is refreshed
shunt_combine_interval: '1s' # frequency at which data is combined in YamBMS
# BMS settings
bms_battery_chemistry: '1' # 1-LFP | 2-Li-ion | 3-LTO
bms_update_interval: '3s' # frequency at which BMS data is refreshed, going below '3s' can cause problems
bms_combine_interval: '1s' # frequency at which data is combined in YamBMS
bms_cutoff_timer: '60s'

I’m not sure what else I can do. Do you have any advice?

This may be a lot of entities for an ESP32.

Regarding entity status there is a known bug that occurs with a large number of entities when logger is set to a level lower than DEBUG.

The PR below tries to fix this. (I added it by default but @MrPablo reported to me that this could cause other problems... which I have not noticed...)


You can also not use this PR and set your logger level to DEBUG.
 
I’ve trimmed the BMS and Shunt YAML down to 285 entities, I don’t understand why this issue occurs under higher loads. The same number of entities are refreshed every time, so it shouldn’t matter if there’s a load or not, right?

With previous version (Jk-bms-can) with the old JK B-type over UART, I had the same issue with the balancing state entities. You advised me a year ago to set the logger level to DEBUG, which i did but I completely forgot 🤭, and I haven’t had any issues since.

I’ll test for a few days and see the result. If the issue persists, I’ll order an ESP32 S3 board, which is in my cart for some time, but I’ve been postponing the purchase because I want to avoid redoing the wiring for the new board 😐.

Thank you for advise.
 
Last edited:
I know that the JK uses one set of MOSFETs for charging and a separate set for discharging. From obviously reasons only one set can be used at a time even both sets of MOSFETs are open.

After observing, I’ve noticed the charge and discharge buttons behave unpredictably. Sometimes, when charge is blocked, discharge is also blocked. As shown in the screenshot below, on the third BMS, only charge is disabled, but there’s actually no discharge either. This doesn’t always happen, and I can’t figure out why—no clear pattern so far.
1738834104291.png


And after some time, the discharge started working again. No changes were made to the settings.
1738835487804.png
 
Last edited:
@Dmode How did you achieve the colored bars from voltage? Mine are all gray :/ I also don't have the dashed Float lines
It´s appears that Dmode has set his balancing trigger to a pretty narrow value, the colors shows cells that are outside of the balancing trigger value.

The float lines are probably caused by that they are outside of the graph. You may need to adapt your vars.maxY and vars.minY depending on chemistry etc.
 
@Dmode How did you achieve the colored bars from voltage? Mine are all gray :/ I also don't have the dashed Float lines
Perhaps the voltage difference between your cells does not exceed the threshold set in the BMS (beyond which balancing begins) taken from entity:
Code:
number.yambms_jk_bms_<Your JK BMS ID>_balancing_trigger_voltage

The logic for activating the colors is shown by the arrow. If you change this line to vars.isDeltaBigger = true;, then the coloring will happen constantly. But in my opinion, this doesn’t make sense when the difference between the cells is small
1738848227095.png


As for dashed horizontal lines, check if you have the entities that form these lines:
JavaScript:
number.${ vars.bmsPrefixName }_cell_balancing_starting_voltage
number.${ vars.bmsPrefixName }_cell_request_float_voltage
number.${ vars.yamPrefixName }_float_voltage
number.${ vars.yamPrefixName }_bulk_voltage

For example, in my case, for a BMS with ID 3, it’s:
1738849186651.png

YAML:
number.yambms_jk_bms_3_cell_balancing_starting_voltage
number.yambms_jk_bms_3_cell_request_float_voltage
number.yambms_yambms_1_float_voltage
number.yambms_yambms_1_bulk_voltage


Make sure not to confuse the prefix of an individual JK BMS with the prefix of a Yam BMS, because if there’s only one Yam, then no matter how many JK BMSs you have, it will have the same prefix for all of them.

1738848879098.png

Or perhaps your current cell voltage level is too far from the horizontal lines. But you can simply drag the graph down with your mouse to see if those lines appear somewhere above.
1738849481703.png
 
Last edited:
OK



Yes the most common CAN protocols see this page.



I recommend you to use an ESP32-S3 with a CAN + RS485 interface.

This can be the LilyGo T-Connect board or AtomS3 components.

Below is an AtomS3 with a CAN base (isolated) and a RS485 unit (isolated).

View attachment 273847
Hi got the atom parts today, waiting for the bms link.

I need to prepare some YAMLs to integrate the jbd_bms_ble component developed by @syssi into YamBMS.
 
Last edited:
But I don't see anywhere that the BMS-Link supports CAN bus protocols in input...

View attachment 276123

See my message of the 28/01.
Ok, but isn't that a requirement for being able to communicate with a range of bms's? Canbus.

I have asked epever support about it, they have been somewhat responsive.

Also looking at this
 
Thought I'd share a Grafana dashboard I've been working on for YamBMS.


yambms.png

This is using Home Assistant to push the YamBMS data into InfluxDB. In my HA configuration.yaml I have:

Code:
influxdb:
  host: influx.localdomain
  database: yambms
  max_retries: 3
  override_measurement: state
  include:
    entity_globs:
       - sensor.yambms_*

This pushes all sensors titled yambms_* into Influx with the measurement name "state".

On the Grafana side, add a new datasource for the yambms influx database so you can select it from the datasource selector at the top of the dashboard.

The dashboard also has a variable for the BMS id which it should populate automatically as long as your cell sensors are named something like yambms_<bms_id>__cell_voltage_01, but you can edit the BMS variable config if needed. You can then use the BMS selector at the top of the dashboard to select the BMS you want and you can save the dashboard and tick the save variables as default box.

This only does separate BMSs at the moment, not the combined stats. The combined variables names are a little different so it wouldn't be easy to have a BMS variable for the combined stat names, eg yambms_bms_1_capacity_remaining vs yambms_yambms_1_capacity_remaining_s. One config I had tried did not have the s on the end for the combined stats, though, so somewhere it's possible to drop that suffix and then you could have the combined variable name as a BMS choice. I only have one BMS so this isn't an issue for me, but if someone figures out an elegant solution to this let me know and I'll update this.

Dashboard JSON:

Code:
{
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "datasource",
          "uid": "grafana"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "editable": true,
  "fiscalYearStartMonth": 0,
  "graphTooltip": 0,
  "id": 31,
  "links": [],
  "liveNow": false,
  "panels": [
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-RdYlGr"
          },
          "decimals": 2,
          "mappings": [],
          "max": 55,
          "min": 48.5,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "volt"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 0,
        "y": 0
      },
      "id": 58,
      "options": {
        "displayMode": "lcd",
        "maxVizHeight": 300,
        "minVizHeight": 75,
        "minVizWidth": 75,
        "namePlacement": "auto",
        "orientation": "vertical",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "sizing": "auto",
        "text": {},
        "valueMode": "color"
      },
      "pluginVersion": "10.2.3",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "limit": "1",
          "measurement": "state",
          "orderByTime": "DESC",
          "policy": "default",
          "query": "SELECT last(\"value\") FROM \"state\" WHERE (\"entity_id\"::tag = 'yambms_yambms_jbd_1_total_voltage') AND $timeFilter GROUP BY time($__interval) fill(none) ORDER BY time DESC LIMIT 1",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_total_voltage"
            }
          ]
        }
      ],
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${datasource}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-GrYlRd"
          },
          "decimals": 2,
          "mappings": [],
          "max": 440,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "super-light-orange",
                "value": 180
              },
              {
                "color": "light-orange",
                "value": 280
              },
              {
                "color": "red",
                "value": 360
              }
            ]
          },
          "unit": "amp"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 4,
        "y": 0
      },
      "id": 33,
      "options": {
        "displayMode": "lcd",
        "maxVizHeight": 300,
        "minVizHeight": 75,
        "minVizWidth": 75,
        "namePlacement": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "sizing": "auto",
        "valueMode": "color"
      },
      "pluginVersion": "10.2.3",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": true,
          "limit": "1",
          "measurement": "state",
          "orderByTime": "DESC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_current"
            }
          ]
        },
        {
          "datasource": {
            "name": "Expression",
            "type": "__expr__",
            "uid": "__expr__"
          },
          "expression": "abs($A)",
          "hide": false,
          "refId": "B",
          "type": "math"
        }
      ],
      "title": "Battery Current",
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${datasource}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-GrYlRd"
          },
          "decimals": 0,
          "mappings": [],
          "max": 120,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "light-red",
                "value": null
              },
              {
                "color": "red",
                "value": 10
              },
              {
                "color": "semi-dark-red",
                "value": 20
              },
              {
                "color": "dark-red",
                "value": 30
              }
            ]
          },
          "unit": "fahrenheit"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 8,
        "w": 4,
        "x": 8,
        "y": 0
      },
      "id": 35,
      "options": {
        "displayMode": "lcd",
        "maxVizHeight": 300,
        "minVizHeight": 20,
        "minVizWidth": 20,
        "namePlacement": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "sizing": "auto",
        "text": {
          "titleSize": 16
        },
        "valueMode": "color"
      },
      "pluginVersion": "10.2.3",
      "targets": [
        {
          "alias": "BMS",
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "limit": "1",
          "measurement": "state",
          "orderByTime": "DESC",
          "policy": "default",
          "query": "SELECT last($temp) FROM \"pack_health\" WHERE (\"meter\"::tag =~ /^${bms}$/) AND $timeFilter GROUP BY time($__interval) fill(none) ORDER BY time DESC LIMIT 1",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_temperature_1"
            }
          ]
        },
        {
          "alias": "Cells 1",
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "limit": "1",
          "measurement": "state",
          "orderByTime": "DESC",
          "policy": "default",
          "query": "SELECT last($temp) FROM \"pack_health\" WHERE (\"meter\"::tag =~ /^${bms}$/) AND $timeFilter GROUP BY time($__interval) fill(none) ORDER BY time DESC LIMIT 1",
          "rawQuery": false,
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_temperature_2"
            }
          ]
        },
        {
          "alias": "Cells 2",
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "limit": "1",
          "measurement": "state",
          "orderByTime": "DESC",
          "policy": "default",
          "query": "SELECT last($temp) FROM \"pack_health\" WHERE (\"meter\"::tag =~ /^${bms}$/) AND $timeFilter GROUP BY time($__interval) fill(none) ORDER BY time DESC LIMIT 1",
          "rawQuery": false,
          "refId": "C",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_temperature_3"
            }
          ]
        }
      ],
      "title": "Temperatures",
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${datasource}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisBorderShow": false,
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "amps",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 100,
            "gradientMode": "opacity",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "insertNulls": false,
            "lineInterpolation": "stepAfter",
            "lineStyle": {
              "fill": "solid"
            },
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "log": 2,
              "type": "symlog"
            },
            "showPoints": "never",
            "spanNulls": true,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "amp"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Charge"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "super-light-yellow",
                  "mode": "fixed"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "C"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "dark-orange",
                  "mode": "fixed"
                }
              },
              {
                "id": "displayName",
                "value": "Discharge"
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 12,
        "x": 12,
        "y": 0
      },
      "id": 2,
      "options": {
        "legend": {
          "calcs": [
            "max",
            "min",
            "last"
          ],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "none"
        }
      },
      "pluginVersion": "10.2.3",
      "targets": [
        {
          "alias": "Charge",
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "measurement": "state",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_yam${bms}_current_s"
            },
            {
              "condition": "AND",
              "key": "value::field",
              "operator": ">=",
              "value": "0"
            }
          ]
        },
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "0"
              ],
              "type": "fill"
            }
          ],
          "hide": true,
          "measurement": "state",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_yam${bms}_current_s"
            },
            {
              "condition": "AND",
              "key": "value::field",
              "operator": "<=",
              "value": "0"
            }
          ]
        },
        {
          "datasource": {
            "name": "Expression",
            "type": "__expr__",
            "uid": "__expr__"
          },
          "expression": "$B * -1",
          "hide": false,
          "refId": "C",
          "type": "math"
        }
      ],
      "title": "Battery Current",
      "transformations": [],
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-RdYlGr"
          },
          "mappings": [],
          "max": 100,
          "min": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "orange",
                "value": 25
              },
              {
                "color": "yellow",
                "value": 50
              },
              {
                "color": "green",
                "value": 75
              }
            ]
          },
          "unit": "percent"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 4,
        "y": 4
      },
      "id": 4,
      "options": {
        "displayMode": "lcd",
        "maxVizHeight": 300,
        "minVizHeight": 75,
        "minVizWidth": 75,
        "namePlacement": "auto",
        "orientation": "horizontal",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "sizing": "auto",
        "valueMode": "color"
      },
      "pluginVersion": "10.2.3",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "limit": "1",
          "measurement": "state",
          "orderByTime": "DESC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_battery_soc"
            }
          ]
        }
      ],
      "title": "Battery Remaining",
      "type": "bargauge"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${datasource}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "custom": {
            "axisBorderShow": false,
            "axisCenteredZero": false,
            "axisColorMode": "text",
            "axisLabel": "amps",
            "axisPlacement": "auto",
            "barAlignment": 0,
            "drawStyle": "line",
            "fillOpacity": 100,
            "gradientMode": "opacity",
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "insertNulls": false,
            "lineInterpolation": "stepAfter",
            "lineStyle": {
              "fill": "solid"
            },
            "lineWidth": 1,
            "pointSize": 5,
            "scaleDistribution": {
              "type": "linear"
            },
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "group": "A",
              "mode": "none"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "decimals": 2,
          "mappings": [],
          "max": 55,
          "min": 48,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "volt"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Voltage"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "fixedColor": "red",
                  "mode": "fixed"
                }
              },
              {
                "id": "displayName",
                "value": "V"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Charge"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percent"
              },
              {
                "id": "custom.fillOpacity",
                "value": 0
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "max",
                "value": 100
              },
              {
                "id": "custom.axisLabel"
              },
              {
                "id": "custom.axisPlacement",
                "value": "hidden"
              },
              {
                "id": "decimals",
                "value": 0
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Capacity"
            },
            "properties": [
              {
                "id": "custom.fillOpacity",
                "value": 0
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "max",
                "value": 200
              },
              {
                "id": "unit",
                "value": "amph"
              },
              {
                "id": "custom.axisPlacement",
                "value": "hidden"
              },
              {
                "id": "color",
                "value": {
                  "fixedColor": "super-light-green",
                  "mode": "fixed"
                }
              },
              {
                "id": "decimals",
                "value": 0
              }
            ]
          }
        ]
      },
      "gridPos": {
        "h": 6,
        "w": 12,
        "x": 12,
        "y": 6
      },
      "id": 103,
      "interval": "10s",
      "options": {
        "legend": {
          "calcs": [
            "lastNotNull",
            "max",
            "min"
          ],
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "none"
        }
      },
      "pluginVersion": "10.2.3",
      "targets": [
        {
          "alias": "Voltage",
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "previous"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "state",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_total_voltage"
            }
          ]
        },
        {
          "alias": "Charge",
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "previous"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "state",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_battery_soc"
            }
          ]
        },
        {
          "alias": "Capacity",
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "previous"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "state",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "C",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_capacity_remaining"
            }
          ]
        }
      ],
      "title": "Battery Charge",
      "type": "timeseries"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "fixedColor": "yellow",
            "mode": "palette-classic"
          },
          "custom": {
            "fillOpacity": 70,
            "hideFrom": {
              "legend": false,
              "tooltip": false,
              "viz": false
            },
            "insertNulls": false,
            "lineWidth": 0,
            "spanNulls": false
          },
          "mappings": [
            {
              "options": {
                "1": {
                  "color": "super-light-green",
                  "index": 0
                },
                "2": {
                  "color": "super-light-red",
                  "index": 1
                },
                "3": {
                  "color": "super-light-purple",
                  "index": 2
                },
                "4": {
                  "color": "semi-dark-orange",
                  "index": 3
                },
                "5": {
                  "color": "dark-orange",
                  "index": 4
                },
                "6": {
                  "color": "dark-orange",
                  "index": 5
                },
                "7": {
                  "color": "dark-yellow",
                  "index": 6
                },
                "8": {
                  "color": "dark-green",
                  "index": 7
                },
                "9": {
                  "color": "dark-blue",
                  "index": 8
                },
                "10": {
                  "color": "dark-purple",
                  "index": 9
                },
                "11": {
                  "color": "red",
                  "index": 10
                },
                "12": {
                  "color": "orange",
                  "index": 11
                },
                "13": {
                  "color": "yellow",
                  "index": 12
                },
                "14": {
                  "color": "green",
                  "index": 13
                },
                "15": {
                  "color": "blue",
                  "index": 14
                },
                "16": {
                  "color": "purple",
                  "index": 15
                }
              },
              "type": "value"
            }
          ],
          "thresholds": {
            "mode": "percentage",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "string"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 0,
        "y": 8
      },
      "id": 127,
      "options": {
        "alignValue": "left",
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": false
        },
        "mergeValues": true,
        "rowHeight": 0.9,
        "showValue": "auto",
        "tooltip": {
          "mode": "single",
          "sort": "none"
        }
      },
      "targets": [
        {
          "alias": "Min Cell",
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "previous"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "state",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_min_voltage_cell"
            }
          ]
        },
        {
          "alias": "Max Cell",
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "previous"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "measurement": "state",
          "orderByTime": "ASC",
          "policy": "default",
          "refId": "B",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_max_voltage_cell"
            }
          ]
        }
      ],
      "type": "state-timeline"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-RdYlGr"
          },
          "displayName": "Capacity Remaining",
          "mappings": [],
          "max": 180,
          "min": 0,
          "thresholds": {
            "mode": "percentage",
            "steps": [
              {
                "color": "super-light-orange",
                "value": null
              },
              {
                "color": "red",
                "value": 80
              }
            ]
          },
          "unit": "amph"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 4,
        "y": 8
      },
      "id": 143,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto",
        "wideLayout": true
      },
      "pluginVersion": "10.2.3",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "limit": "1",
          "measurement": "state",
          "orderByTime": "DESC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_capacity_remaining"
            }
          ]
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${datasource}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 3,
          "displayName": "cell minimum",
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "#EAB839",
                "value": ""
              },
              {
                "color": "orange",
                "value": 2.8
              },
              {
                "color": "super-light-orange",
                "value": 3
              },
              {
                "color": "orange",
                "value": 3.5
              },
              {
                "color": "red",
                "value": 3.651
              }
            ]
          },
          "unit": "volt"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 6,
        "y": 8
      },
      "id": 64,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto",
        "wideLayout": true
      },
      "pluginVersion": "10.2.3",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "limit": "1",
          "measurement": "state",
          "orderByTime": "DESC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_min_cell_voltage"
            }
          ]
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${datasource}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "decimals": 3,
          "displayName": "cell maximum",
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "orange",
                "value": 2.8
              },
              {
                "color": "super-light-orange",
                "value": 3
              },
              {
                "color": "orange",
                "value": 3.5
              },
              {
                "color": "red",
                "value": 3.651
              }
            ]
          },
          "unit": "volt"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 8,
        "y": 8
      },
      "id": 66,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto",
        "wideLayout": true
      },
      "pluginVersion": "10.2.3",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "limit": "1",
          "measurement": "state",
          "orderByTime": "DESC",
          "policy": "default",
          "query": "SELECT last(\"cellsmax\") FROM \"cell_data\" WHERE $timeFilter GROUP BY time($__interval) fill(null)",
          "rawQuery": false,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_max_cell_voltage"
            }
          ]
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${datasource}"
      },
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "displayName": "delta",
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "super-light-orange",
                "value": null
              },
              {
                "color": "orange",
                "value": 15
              },
              {
                "color": "red",
                "value": 50
              }
            ]
          },
          "unit": "volt"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 4,
        "w": 2,
        "x": 10,
        "y": 8
      },
      "id": 62,
      "options": {
        "colorMode": "value",
        "graphMode": "none",
        "justifyMode": "auto",
        "orientation": "auto",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "text": {},
        "textMode": "auto",
        "wideLayout": true
      },
      "pluginVersion": "10.2.3",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "none"
              ],
              "type": "fill"
            }
          ],
          "hide": false,
          "limit": "1",
          "measurement": "state",
          "orderByTime": "DESC",
          "policy": "default",
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "last"
              }
            ]
          ],
          "tags": [
            {
              "key": "entity_id::tag",
              "operator": "=",
              "value": "yambms_${bms}_delta_cell_voltage"
            }
          ]
        }
      ],
      "type": "stat"
    },
    {
      "datasource": {
        "type": "influxdb",
        "uid": "${datasource}"
      },
      "description": "",
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "continuous-RdYlGr"
          },
          "decimals": 3,
          "displayName": "Cell ${cell}",
          "mappings": [],
          "max": 3.45,
          "min": 3.1,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "unit": "volt"
        },
        "overrides": []
      },
      "gridPos": {
        "h": 6,
        "w": 3,
        "x": 0,
        "y": 12
      },
      "id": 10,
      "maxPerRow": 8,
      "options": {
        "displayMode": "lcd",
        "maxVizHeight": 300,
        "minVizHeight": 75,
        "minVizWidth": 75,
        "namePlacement": "auto",
        "orientation": "vertical",
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "showUnfilled": true,
        "sizing": "auto",
        "text": {},
        "valueMode": "color"
      },
      "pluginVersion": "10.2.3",
      "repeat": "cell",
      "repeatDirection": "h",
      "targets": [
        {
          "datasource": {
            "type": "influxdb",
            "uid": "${datasource}"
          },
          "groupBy": [
            {
              "params": [
                "$__interval"
              ],
              "type": "time"
            },
            {
              "params": [
                "null"
              ],
              "type": "fill"
            }
          ],
          "measurement": "/^$measurement$/",
          "orderByTime": "ASC",
          "policy": "default",
          "query": "SELECT last(\"value\") FROM \"state\" WHERE \"entity_id\" = 'yambms_${bms}_cell_voltage_$cell'",
          "rawQuery": true,
          "refId": "A",
          "resultFormat": "time_series",
          "select": [
            [
              {
                "params": [
                  "value"
                ],
                "type": "field"
              },
              {
                "params": [],
                "type": "mean"
              }
            ]
          ],
          "tags": []
        }
      ],
      "transformations": [],
      "type": "bargauge"
    }
  ],
  "refresh": "1m",
  "schemaVersion": 39,
  "tags": [],
  "templating": {
    "list": [
      {
        "current": {
          "selected": false,
          "text": "influxdb-yambms",
          "value": "ceaeb552-cabc-4621-98fe-75a7b8b89284"
        },
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "datasource",
        "options": [],
        "query": "influxdb",
        "queryValue": "",
        "refresh": 1,
        "regex": "",
        "skipUrlSync": false,
        "type": "datasource"
      },
      {
        "current": {
          "selected": false,
          "text": "bms_1",
          "value": "bms_1"
        },
        "datasource": {
          "type": "influxdb",
          "uid": "${datasource}"
        },
        "definition": "SHOW TAG VALUES FROM \"state\" WITH KEY = \"entity_id\" WHERE \"entity_id\" =~ /cell_voltage_01/",
        "hide": 0,
        "includeAll": false,
        "multi": false,
        "name": "bms",
        "options": [],
        "query": "SHOW TAG VALUES FROM \"state\" WITH KEY = \"entity_id\" WHERE \"entity_id\" =~ /cell_voltage_01/",
        "refresh": 1,
        "regex": "/yambms_(.*)_cell_voltage_/",
        "skipUrlSync": false,
        "sort": 0,
        "type": "query"
      },
      {
        "allValue": "",
        "current": {
          "selected": false,
          "text": "All",
          "value": "$__all"
        },
        "datasource": {
          "type": "influxdb",
          "uid": "${datasource}"
        },
        "definition": "SHOW TAG VALUES FROM \"state\" WITH KEY = \"entity_id\" WHERE \"entity_id\" =~ /${bms}_cell_voltage/",
        "hide": 2,
        "includeAll": true,
        "multi": false,
        "name": "cell",
        "options": [],
        "query": "SHOW TAG VALUES FROM \"state\" WITH KEY = \"entity_id\" WHERE \"entity_id\" =~ /${bms}_cell_voltage/",
        "refresh": 2,
        "regex": ".*_([0-9]+)$",
        "skipUrlSync": false,
        "sort": 3,
        "type": "query"
      }
    ]
  },
  "time": {
    "from": "now-24h",
    "to": "now"
  },
  "timepicker": {},
  "timezone": "",
  "title": "YamBMS",
  "uid": "bede1bf7-bc74-478a-bd4f-95baa98eb06f",
  "version": 40,
  "weekStart": ""
}
 
Last edited:
hi again, yes you are correct epever confirmed that they do not support canbus.

then i guess i have to check out some other project or adopt this to work with rs485

Yes currently not possible with YamBMS.

PYLON RS485 protocol support is in my todo list but I can't say when this will be done.
 
I have seen this avesome tool

I have 3 pieces JK PB2A16S20P and 1 Seplos 2.0 bms

I want them to communcate with my deye inveter

I have a Lillygo V1.1. and home assistant

IS there a very good tutorial how to do it, maybe a video. At the moment i cant see what i has to do :-D
 
Last edited:
I have seen this avesome tool

I have 3 pieces JK PB2A16S20P and 1 Seplos 2.0 bms

I want them to communcate with my deye inveter

I have a Lillygo V1.1. and home assistant

IS there a very good tutorial how to do it, maybe a video. At the moment i cant see what i has to do :-D

I think the best for your case would be to use the LilyGo T-Connect (ESP32-S3) board with 3x RS485 and 1x CAN like @rasterer did.

You need to specify 3x RS485 modules and 1x CAN module when ordering.
@MrPablo can help you as he has already ordered several boards.

Otherwise you can build your PCB with 2x RS485 + 1x CAN interfaces.

For the configuration it is not very complicated, when you have the material I can prepare the YAML adapted to your case.


1738938399628.png
 
I think the best for your case would be to use the LilyGo T-Connect (ESP32-S3) board with 3x RS485 and 1x CAN like @rasterer did.

You need to specify 3x RS485 modules and 1x CAN module when ordering.
@MrPablo can help you as he has already ordered several boards.

Otherwise you can build your PCB with 2x RS485 + 1x CAN interfaces.

For the configuration it is not very complicated, when you have the material I can prepare the YAML adapted to your case.


View attachment 276340
@MrPablo where do you ordre from
 

diy solar

diy solar
Back
Top