Skip to content

Commit 2f72c16

Browse files
Update victron_mqtt to 2026.7.2 (#457)
## Changes - Add BMS mode metric: #455 ## Contributors @tomer-w Co-authored-by: tomer-w <57483589+tomer-w@users.noreply.github.com>
1 parent 16957b7 commit 2f72c16

9 files changed

Lines changed: 84 additions & 39 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Vendored third-party packages."""
22

3-
VICTRON_MQTT_VERSION = "2026.7.0"
3+
VICTRON_MQTT_VERSION = "2026.7.2"

custom_components/victron_mqtt/_vendor/victron_mqtt/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
ACSystemMode,
99
ActiveInputEnum,
1010
BatteryState,
11+
BMSMode,
1112
ChargerMode,
1213
ChargeSchedule,
1314
DESSErrorCode,
@@ -68,6 +69,7 @@
6869
"AcInputTypeEnum",
6970
"ActiveInputEnum",
7071
"AuthenticationError",
72+
"BMSMode",
7173
"BatteryState",
7274
"CannotConnectError",
7375
"ChargeSchedule",

custom_components/victron_mqtt/_vendor/victron_mqtt/_victron_enums.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ class ChargerMode(VictronEnum):
123123
OFF = (4, "off", "Off")
124124

125125

126+
class BMSMode(VictronEnum):
127+
"""BMS contactor mode enum."""
128+
129+
ON = (3, "on", "On")
130+
OFF = (4, "off", "Off")
131+
STANDBY = (252, "standby", "Standby")
132+
133+
126134
class InverterMode(VictronEnum):
127135
"""Inverter Mode Enum"""
128136

custom_components/victron_mqtt/_vendor/victron_mqtt/_victron_topics.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
ACSystemMode,
99
ActiveInputEnum,
1010
BatteryState,
11+
BMSMode,
1112
ChargerMode,
1213
ChargeSchedule,
1314
DESSErrorCode,
@@ -625,6 +626,15 @@
625626
value_type=ValueType.ENUM,
626627
enum=GenericOnOff,
627628
),
629+
TopicDescriptor(
630+
topic="N/{installation_id}/battery/{device_id}/Mode",
631+
message_type=MetricKind.SELECT,
632+
short_id="battery_bms_mode",
633+
name="BMS mode",
634+
value_type=ValueType.ENUM,
635+
enum=BMSMode,
636+
main_topic=True,
637+
),
628638
TopicDescriptor(
629639
topic="N/{installation_id}/battery/{device_id}/Soc",
630640
message_type=MetricKind.SENSOR,
@@ -1035,7 +1045,7 @@
10351045
TopicDescriptor(
10361046
topic="N/{installation_id}/ev/{device_id}/ChargingStarted",
10371047
depends_on=[
1038-
"ev_charging_state"
1048+
"ev_{device_id}_ev_charging_state"
10391049
], # This is just so this topic will not show up with the default value if there is no EV charger at all
10401050
message_type=MetricKind.SENSOR,
10411051
short_id="ev_charging_started",

custom_components/victron_mqtt/_vendor/victron_mqtt/data_classes.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -456,27 +456,6 @@ def unique_id(self) -> str:
456456
assert self._unique_id is not None, f"unique_id is None for topic: {self.full_topic}"
457457
return self._unique_id
458458

459-
@property
460-
def display_id(self) -> str:
461-
"""Get a display identifier with the device-type prefix de-duplicated.
462-
463-
The ``unique_id`` has a known formatting quirk: when ``short_id`` already
464-
starts with the device-type prefix (e.g. ``solarcharger_total_pv_yield``
465-
under device ``solarcharger_3``), the resulting id contains the prefix
466-
twice — ``solarcharger_3_solarcharger_total_pv_yield``. ``display_id``
467-
strips the redundant leading prefix, yielding ``solarcharger_3_total_pv_yield``.
468-
469-
``unique_id`` is intentionally left unchanged for backward compatibility
470-
with existing consumers. ``display_id`` is provided for new consumers
471-
that can adopt the cleaner form going forward.
472-
"""
473-
assert self._short_id is not None, f"short_id is None for topic: {self.full_topic}"
474-
device_prefix = f"{self.device_type.code}_"
475-
short = self._short_id
476-
if short.startswith(device_prefix):
477-
short = short[len(device_prefix):]
478-
return ParsedTopic.make_unique_id(self.get_device_unique_id(), short)
479-
480459
@property
481460
def key_values(self) -> dict[str, str]:
482461
"""Get the key values of the ParsedTopic."""

custom_components/victron_mqtt/_vendor/victron_mqtt/device.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,6 @@ def _create_metric_from_placeholder(
258258
name=name,
259259
descriptor=new_topic_desc,
260260
unique_id=metric_placeholder.parsed_topic.unique_id,
261-
display_id=metric_placeholder.parsed_topic.display_id,
262261
short_id=metric_placeholder.parsed_topic.short_id,
263262
key_values=metric_placeholder.parsed_topic.key_values,
264263
topic=metric_placeholder.parsed_topic.full_topic,
@@ -270,7 +269,6 @@ def _create_metric_from_placeholder(
270269
name=name,
271270
descriptor=new_topic_desc,
272271
unique_id=metric_placeholder.parsed_topic.unique_id,
273-
display_id=metric_placeholder.parsed_topic.display_id,
274272
short_id=metric_placeholder.parsed_topic.short_id,
275273
key_values=metric_placeholder.parsed_topic.key_values,
276274
hub=hub,

custom_components/victron_mqtt/_vendor/victron_mqtt/metric.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ def __init__(
3636
name: str | None = None,
3737
descriptor: TopicDescriptor | None = None,
3838
unique_id: str | None = None,
39-
display_id: str | None = None,
4039
short_id: str | None = None,
4140
key_values: dict[str, str] | None = None,
4241
hub: Hub | None = None,
@@ -59,7 +58,6 @@ def __init__(
5958
self._device: Device = device
6059
self._descriptor: TopicDescriptor = descriptor
6160
self._unique_id: str = unique_id
62-
self._display_id: str = display_id if display_id is not None else unique_id
6361
self._value: Any = None
6462
self._short_id: str = short_id
6563
self._name: str = name
@@ -199,17 +197,6 @@ def unique_id(self) -> str:
199197
"""Return the unique id of the metric."""
200198
return self._unique_id
201199

202-
@property
203-
def display_id(self) -> str:
204-
"""Return the display identifier with the device-type prefix de-duplicated.
205-
206-
Equal to ``unique_id`` for most metrics. Where ``short_id`` starts with
207-
the device-type prefix, the redundant copy is stripped, giving a cleaner
208-
identifier. See :attr:`ParsedTopic.display_id` for details.
209-
The ``unique_id`` is never modified.
210-
"""
211-
return self._display_id
212-
213200
@property
214201
def key_values(self) -> dict[str, str]:
215202
"""Return the key_values dictionary as read-only."""

custom_components/victron_mqtt/translations/en.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,13 @@
567567
"passthrough": "Passthrough"
568568
}
569569
},
570+
"battery_bms_mode": {
571+
"state": {
572+
"off": "Off",
573+
"on": "On",
574+
"standby": "Standby"
575+
}
576+
},
570577
"evcharger_mode": {
571578
"name": "Mode",
572579
"state": {
@@ -772,6 +779,13 @@
772779
"warning": "Warning"
773780
}
774781
},
782+
"battery_bms_mode": {
783+
"state": {
784+
"off": "Off",
785+
"on": "On",
786+
"standby": "Standby"
787+
}
788+
},
775789
"battery_capacity": {
776790
"name": "Capacity"
777791
},

victron_mqtt.json

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,33 @@
17071707
"hidden": false,
17081708
"sub_device_key": null
17091709
},
1710+
{
1711+
"topic": "N/{installation_id}/battery/{device_id}/Mode",
1712+
"message_type": "MetricKind.SELECT",
1713+
"short_id": "battery_bms_mode",
1714+
"name": "BMS mode",
1715+
"unit_of_measurement": null,
1716+
"metric_type": "MetricType.ENUM",
1717+
"metric_nature": "MetricNature.NONE",
1718+
"value_type": "ValueType.ENUM",
1719+
"precision": null,
1720+
"enum": "BMSMode",
1721+
"min_max_range": "RangeType.STATIC",
1722+
"min": null,
1723+
"max": null,
1724+
"step": null,
1725+
"is_adjustable_suffix": null,
1726+
"output_type": null,
1727+
"labels": null,
1728+
"key_values": {},
1729+
"experimental": false,
1730+
"depends_on": [],
1731+
"generic_name": "BMS mode",
1732+
"is_formula": false,
1733+
"main_topic": true,
1734+
"hidden": false,
1735+
"sub_device_key": null
1736+
},
17101737
{
17111738
"topic": "N/{installation_id}/battery/{device_id}/Soc",
17121739
"message_type": "MetricKind.SENSOR",
@@ -3186,7 +3213,7 @@
31863213
"key_values": {},
31873214
"experimental": false,
31883215
"depends_on": [
3189-
"ev_charging_state"
3216+
"ev_{device_id}_ev_charging_state"
31903217
],
31913218
"generic_name": "Charging started",
31923219
"is_formula": false,
@@ -13166,6 +13193,26 @@
1316613193
}
1316713194
]
1316813195
},
13196+
{
13197+
"name": "BMSMode",
13198+
"EnumValues": [
13199+
{
13200+
"id": "on",
13201+
"name": "On",
13202+
"value": 3
13203+
},
13204+
{
13205+
"id": "off",
13206+
"name": "Off",
13207+
"value": 4
13208+
},
13209+
{
13210+
"id": "standby",
13211+
"name": "Standby",
13212+
"value": 252
13213+
}
13214+
]
13215+
},
1316913216
{
1317013217
"name": "BatteryState",
1317113218
"EnumValues": [

0 commit comments

Comments
 (0)