question

stevie avatar image
stevie asked

Cerbox GX MQTT - no topics (except $SYS)

Hi *,

I have a problem to setup mqtt on a Cerbo GX with firmware 2.90.

The MQTT Settings are enabled:

1663700545704.png

If I connect via MQTT Explorer, I can only see the "$SYS" topic.

1663700622479.png

Also if I send the keepalive message ("R/<Your_VRM_Portal_ID>/keepalive" ), like in this post ( https://community.victronenergy.com/questions/153464/mqtt-cerbo-gx-sendet-nur-die-seriennummer.html ), this does not change.


I found a log maybe this helps an expert in this forum ( /data/log/dbus-mqtt/current ) :

@4000000063244d9f1cd56a94 *** starting dbus-mqtt ***
@4000000063244da23a1f18d4 -------- dbus_mqtt, v1.30 is starting up --------
@4000000063244da23a3c1a9c INFO:logger:Loglevel set to INFO
@4000000063244da32419f374 INFO:mosquitto_bridge_registrator:[InitBroker] Reading config file
@4000000063244da32442b124 INFO:mosquitto_bridge_registrator:[InitBroker] Registering CCGX at VRM portal
@4000000063244da3333ad864 INFO:mosquitto_bridge_registrator:[InitBroker] Not updating config file and not restarting Mosquitto, because config is correct.
@4000000063244da33359b6bc INFO:mosquitto_bridge_registrator:[InitBroker] Registration successful
@4000000063244da3342e064c INFO:dbus_mqtt:[Scanning] service: com.victronenergy.hub4
@4000000063244da334a2ff9c INFO:dbus_mqtt:[Scanning] service: com.victronenergy.qwacs
@4000000063244da3358cc744 /opt/victronenergy/dbus-mqtt/dbus_mqtt.py:402: DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead
@4000000063244da3358cf23c   logging.warn('[Scanning] {} does not provide an item listing'.format(service))
@4000000063244da3359ab1c4 WARNING:dbus_mqtt:[Scanning] com.victronenergy.qwacs does not provide an item listing
@4000000063244da335c1296c INFO:dbus_mqtt:[Scanning] service: com.victronenergy.pvinverter.pv_1992110506
@4000000063244da336695c04 INFO:dbus_mqtt:[Scanning] service: com.victronenergy.settings
@4000000063244da33a52debc INFO:dbus_mqtt:[Scanning] service: com.victronenergy.battery.socketcan_can1
@4000000063244da33b1cce0c INFO:dbus_mqtt:[Scanning] service: com.victronenergy.vecan.can0
@4000000063244da33b87f7a4 INFO:dbus_mqtt:[Scanning] service: com.victronenergy.system
@4000000063244da402158fcc INFO:dbus_mqtt:[Scanning] service: com.victronenergy.fronius
@4000000063244da402909bcc INFO:dbus_mqtt:[Scanning] service: com.victronenergy.vebus.ttyS4
@4000000063244da4049b9e6c INFO:dbus_mqtt:[Scanning] service: com.victronenergy.grid.cgwacs_ttyUSB0_di30_mb1
@4000000063244da4058bf5c4 Traceback (most recent call last):
@4000000063244da4058e66c4   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 397, in _scan_dbus_service
@4000000063244da405af67fc     items = self._get_dbus_value(service, '/')
@4000000063244da405b10ddc   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 533, in _get_dbus_value
@4000000063244da405d683b4     return self._dbus_conn.call_blocking(service, path, None, 'GetValue', '', [])
@4000000063244da405d8066c   File "/usr/lib/python3.8/site-packages/dbus/connection.py", line 652, in call_blocking
@4000000063244da4061b58cc     reply_message = self.send_message_with_reply_and_block(
@4000000063244da4061dcdb4 dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Unknown / invalid method
@4000000063244da4062134cc 
@4000000063244da406213c9c During handling of the above exception, another exception occurred:
@4000000063244da406214c3c 
@4000000063244da406215024 Traceback (most recent call last):
@4000000063244da406227134   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 602, in <module>
@4000000063244da4066bd644     main()
@4000000063244da4066bf96c   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 584, in main
@4000000063244da406972c04     handler = DbusMqtt(
@4000000063244da406999534   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 217, in __init__
@4000000063244da406b7a484     self._scan_dbus_service(service)
@4000000063244da406b9cb4c   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 401, in _scan_dbus_service
@4000000063244da406d970dc     self._introspect(service, device_instance, '/', publish)
@4000000063244da406db0b04   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 441, in _introspect
@4000000063244da406fae35c     self._introspect(service, device_instance, p, publish=publish)
@4000000063244da406fc98dc   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 423, in _introspect
@4000000063244da4071cee34     value = self._dbus_conn.call_blocking(service, path, None, 'Introspect', '', [])
@4000000063244da4071ea3b4   File "/usr/lib/python3.8/site-packages/dbus/connection.py", line 652, in call_blocking
@4000000063244da407515444     reply_message = self.send_message_with_reply_and_block(
@4000000063244da40753639c dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Unknown / invalid method


I also tried to Update the firmware via SD - without success.

Does anyone have an idea how to get the mqtt running on my system?


BR
Stefan

cerbo gxMQTT
1663700545704.png (53.5 KiB)
1663700622479.png (20.7 KiB)
2 |3000

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

8 Answers
dominik-feser avatar image
dominik-feser answered ·

Same here with 2.91.

/var/log/dbus-mqtt/current shows:

@40000000633977463001833c -------- dbus_mqtt, v1.30 is starting up --------
@400000006339774630197424 INFO:logger:Loglevel set to INFO
@40000000633977463390d034 INFO:mosquitto_bridge_registrator:[InitBroker] Reading config file
@400000006339774633a9846c INFO:mosquitto_bridge_registrator:[InitBroker] Registering CCGX at VRM portal
@4000000063397747013a8d64 INFO:mosquitto_bridge_registrator:[InitBroker] Not updating config file and not restarting Mosquitto, because config is correct.
@400000006339774701473b7c INFO:mosquitto_bridge_registrator:[InitBroker] Registration successful
@400000006339774701ba19bc INFO:dbus_mqtt:[Scanning] service: com.victronenergy.hub4
@4000000063397747020cb62c INFO:dbus_mqtt:[Scanning] service: com.victronenergy.qwacs
@400000006339774702bc012c /opt/victronenergy/dbus-mqtt/dbus_mqtt.py:402: DeprecationWarning: The 'warn' function is deprecated, use 'warning' instead
@400000006339774702bc2454   logging.warn('[Scanning] {} does not provide an item listing'.format(service))
@400000006339774702c55bb4 WARNING:dbus_mqtt:[Scanning] com.victronenergy.qwacs does not provide an item listing
@400000006339774702e13c6c INFO:dbus_mqtt:[Scanning] service: com.victronenergy.settings
@400000006339774705d78d54 INFO:dbus_mqtt:[Scanning] service: com.victronenergy.pvinverter.pv_3010544110
@4000000063397747065475e4 INFO:dbus_mqtt:[Scanning] service: com.victronenergy.system
@4000000063397747085be28c INFO:dbus_mqtt:[Scanning] service: com.victronenergy.fronius
@400000006339774708a5f37c INFO:dbus_mqtt:[Scanning] service: com.victronenergy.temprelay
@40000000633977470916a70c INFO:dbus_mqtt:[Scanning] service: com.victronenergy.grid.cgwacs_ttyUSB0_di30_mb1
@400000006339774709d1d11c Traceback (most recent call last):
@400000006339774709d3f7e4   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 397, in _scan_dbus_service
@400000006339774709f268dc     items = self._get_dbus_value(service, '/')
@400000006339774709f3bcb4   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 533, in _get_dbus_value
@40000000633977470a15f284     return self._dbus_conn.call_blocking(service, path, None, 'GetValue', '', [])
@40000000633977470a16d12c   File "/usr/lib/python3.8/site-packages/dbus/connection.py", line 652, in call_blocking
@40000000633977470a429064     reply_message = self.send_message_with_reply_and_block(
@40000000633977470a454b9c dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Unknown / invalid method
@40000000633977470a464d6c 
@40000000633977470a46553c During handling of the above exception, another exception occurred:
@40000000633977470a4664dc 
@40000000633977470a4668c4 Traceback (most recent call last):
@40000000633977470a475edc   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 602, in <module>
@40000000633977470a6c3c5c     main()
@40000000633977470a6d51b4   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 584, in main
@40000000633977470a90c004     handler = DbusMqtt(
@40000000633977470a91c9a4   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 217, in __init__
@40000000633977470aa230dc     self._scan_dbus_service(service)
@40000000633977470aa2f42c   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 401, in _scan_dbus_service
@40000000633977470abd2734     self._introspect(service, device_instance, '/', publish)
@40000000633977470abe01f4   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 441, in _introspect
@40000000633977470adc6f04     self._introspect(service, device_instance, p, publish=publish)
@40000000633977470adde9ec   File "/opt/victronenergy/dbus-mqtt/dbus_mqtt.py", line 423, in _introspect
@40000000633977470af95574     value = self._dbus_conn.call_blocking(service, path, None, 'Introspect', '', [])
@40000000633977470afa3034   File "/usr/lib/python3.8/site-packages/dbus/connection.py", line 652, in call_blocking
@40000000633977470b23ebcc     reply_message = self.send_message_with_reply_and_block(
@40000000633977470b2508f4 dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Unknown / invalid method
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) answered ·

Hi both, VictronConnect remote view, I think we call that VC-R in the VictronConnect manual, as well as the real-time mode of the VRM Dashboard, also use MQTT.

And that is used a lot: by thousands of users at a time.

So you could check if those things work for you.

And otherwise, I’d start searching elsewhere: perhaps you’re using the wrong mqtt broker in the farm? Or some perhaps making a mistake elsewhere. I’m quite sure many people are using MQTT, also on v2.91.



2 |3000

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

dominik-feser avatar image
dominik-feser answered ·

Hi @mvader (Victron Energy)!

My understanding is, that dbus-mqtt connects to the local mqtt broker running on VenusOS. As soon as it sees an empty payload on topic /R/<sysid>/system/0/serial it sends the serial to that topic and keeps on sending all available values to all topics.

The local mqtt broker has two bridges configured, one of them connects to mqtt<xx>.victronenergy.com and bridges all topics.

My assumption is, that once I have sent the keep alive to the named topic above, I should even see topics and values on the local mqtt broker.

Anyhow, I tried both, local mqtt broker and the mqtt<xx>.victronenergy.com but in both cases there is literally nothing happening accept the serial being sent back.

How can I troubleshoot this?

2 |3000

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

dominik-feser avatar image
dominik-feser answered ·

@stevie @mvader (Victron Energy)

I found the issue. I am using https://github.com/mitchese/shm-et340 to read my SMA SunnyHomeManager 2.0. This executable seems to send data to dbus that breaks dbus-mqtt.

I am aware, that Victron is not supporting this. I raised an issue with the developer of shm-et340.

2 |3000

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

stevie avatar image
stevie answered ·

Thanks for the information. Since I use the same script, it is quite likely exactly the same error.

How did you find out?

Hopefully the developer of shm-et340 finds a soloution.

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.

dominik-feser avatar image dominik-feser commented ·

Yeah, it was driving me nuts! I first set up a fresh VenusOS to check if I do have a misunderstanding but it then worked. After that, I added modification by modification until the issue occurred again, then isolated it.

Sadly the maintainer of https://github.com/mitchese/shm-et340 doesn't seem to react on my contact attempts so I am now looking to either fix it myself or find another integration for SHM2.0 :-(

0 Likes 0 ·
dominik-feser avatar image
dominik-feser answered ·

@stevie @mvader (Victron Energy)

I found a solution to this issue. After ending up in the python code of python package "dbus", I got the impression that maybe the fact, shm-et340 being the last registration to dbus causes the issue. So I flipped the rc.local entries and it works!

Now my rc.local with shm-et340 & dbus-serialbattery looks like this:

root@raspberrypi2:~# cat /data/rc.local
#!/bin/bash
sleep 10
setsid /data/shm-et340 > /dev/null 2>/dev/null &
sh /data/etc/dbus-serialbattery/reinstalllocal.sh

Now I can see the topics being published after keepaliving dbus-mqtt like described in the git documentation.

2 |3000

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

stevie avatar image
stevie answered ·

@Dominik Feser Thanks for sharing this. Unfortunatelly I couldn't find /data/etc/dbus-serialbattery/reinstalllocal.sh. So I started playing with the rc.local, I found another even simpler way to fix my issue: I just increased the sleep time.

My rc.local now looks like this and MQTT / shm-et340 are working fine (together):

#!/bin/bash
sleep 25
setsid /data/home/root/shm-et340 > /dev/null 2>/dev/null &
2 |3000

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

dominik-feser avatar image
dominik-feser answered ·

@stevie you are probably not using dubs-serial battery at all ☺️

Glad shm-et340 now works with mqtt!

2 |3000

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