Skip to content

Commit

Permalink
don't crash if a dbus scan fails at startup
Browse files Browse the repository at this point in the history
If a service does not implement the required interface(s)
to be scanned, instead of crashing, rather just ignore that
service.
  • Loading branch information
izak committed Feb 13, 2023
1 parent 227dace commit 11d0d95
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dbus_mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,10 @@ def __init__(self, mqtt_server=None, ca_cert=None, user=None, passwd=None, dbus_
for service in services:
if service.startswith('com.victronenergy.'):
self._service_ids[self._dbus_conn.get_name_owner(service)] = service
self._scan_dbus_service(service)
try:
self._scan_dbus_service(service)
except:
logging.exception("_scan_dbus_service")

self._keep_alive_interval = keep_alive_interval
MqttGObjectBridge.__init__(self, mqtt_server, "ve-dbus-mqtt-py", ca_cert, user, passwd, debug)
Expand Down

0 comments on commit 11d0d95

Please sign in to comment.