question

hobohome avatar image
hobohome asked

Venus MQTT BMS JSON Data Errors

Hi,

I have just installed a BYD battery pack onto my off grid system, replacing my ageing Lead Acid batteries. I have run into an issue with monitoring using the MQTT capability of the Venus GX.


Once the BYD battery is connected, the Venus creates a number of new MQTT topics - these include quite a few indicating fault conditions and one called "Connected" (in my case its full topic path is N/9884e3aed7f6/battery/512/Connected).

This topic delivers a payload of {"value": 1} - which is a valid JSON formatted string - great.

However, if the RS485 cable between the venus and the BYD BMS is interrupted, you would expect this value to report {"value": 0} - sadly it does not. The payload becomes NULL (ie nothing) and this is NOT valid JSON. This causes the JSON decoder (at the subscriber end) to throw en exception and causing my alerts to fail.

If values are going to be sent using JSON encoding, ALL values should be JSON encoded.

I have no way of simulating the other fault topics so I can not say if they do the same.

BMSVenus GX - VGXMQTT
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

3 Answers
mvader (Victron Energy) avatar image
mvader (Victron Energy) answered ·

Hi @Hobohome, thanks for reporting.

There are two issues I think:

1) that “connected” topic is a bit misleading. It originates from back in the days when we kept a dbus service online when a device was disconnected. Now we take the whole driver offline.

2) because of (1), we can’t make it send a 0. Instead it should send what we call a “DBUS-INVALID”, but then in a json valid manner.

If you have an idea; welcome to test and develop a solution & put in a patch or PR.

Background info is here:

https://www.victronenergy.com/live/open_source:ccgx:d-bus

And source code of dbus-mqtt driver is on our github. Make sure to read mqtt related issues in the venus repo.

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

hobohome avatar image hobohome commented ·

Thanks @mvader (Victron Energy Staff) for the info - I understand.

I would really like to contribute to the project, but I have zero experience with python (I am a C++ / PHP programmer).

Question : Given that the "disappearance" of the BYD battery will lead to a shutdown after a few minutes, is there some way (via MQTT) that I can tell that this has happened?

I also think that this should be flagged as an error and notified via VRM.

I am seeing short duration (~5 seconds) disconnects about 4 times each day - this seems likely to be a BYD issue to me. Is this normal?

0 Likes 0 ·
hobohome avatar image
hobohome answered ·

Just an update on this for anyone who is interested.

The "connected" topic is now obsolete (thanks @mvader (Victron Energy Staff) for making that clear).

I have developed some code for my automation and monitoring system (OpenHab) that receives data from the root topic for the BYD battery, it then checks if it is valid JSON. If it is, it updates the values accordingly.

If any value is NOT valid JSON (ie a NULL or nothing), this is an indicator that the Venus has removed the driver for the BYD battery (because it has failed to communicate for a time???) . At this point, I flag a WARNING, wait a few seconds, then (if no valid data has arrived) change the warning to a FAULT.

In my system I am seeing about 5 disconnects per day, each of a duration of just a few seconds. Im not yest sure if this is normal, as unless you were monitoring the MQTT topics, you would not be aware of these disconnects.

If asked to guess, I would suggest that this is caused by the BYD BMU not communicating in the time-frame allowed OR the tolerance within the Venus is too tight.

I wonder if @BYD_service could comment?


8 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

mvader (Victron Energy) avatar image mvader (Victron Energy) ♦♦ commented ·

Hi @Hobohome, could you check the log of the byd?


Cat /data/log/dbus-canbusbms/* | tai64nlocal



(Directory names might be a bit different for real)

0 Likes 0 ·
Show more comments
Rene Mullie avatar image Rene Mullie commented ·

hi HoboHome,

I've read al the topics concerning MQTT here, on MQTT I am still a NOOB (although I have some sensors based on MySensors over MQTT up&running)

I would like to connect my Rpi based Venus to my OpenHab Rpi setup, I am struggeling to get the basics working... Based on your postings I thing you ar quite a Pro on this.

Would you be so kind to share a HowTo based on the OpenHab/MQTT 2.4 bindings/things for setting up basic connection between Venus and OpenHab?

I think there is quite some interest in this from the Victron as wel the OpenHab community.

0 Likes 0 ·
byd-service avatar image
byd-service answered ·

Hello @hobohome,


I will not comment on the details of the communication as @mvader is the expert and he will let us know if something needs to be modified.


What I can say is that even if this were happening in the background we wouldn't notice as it doesn't have any apparent impact in the function of the system.

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.