mirror of
https://github.com/home-assistant/supervisor
synced 2024-09-07 16:20:07 +02:00
16 lines
388 B
Python
16 lines
388 B
Python
"""Utils for D-Bus."""
|
|
|
|
from ..exceptions import DBusNotConnectedError
|
|
|
|
|
|
def dbus_connected(method):
|
|
"""Wrap check if D-Bus is connected."""
|
|
|
|
def wrap_dbus(api, *args, **kwargs):
|
|
"""Check if D-Bus is connected before call a method."""
|
|
if api.dbus is None:
|
|
raise DBusNotConnectedError()
|
|
return method(api, *args, **kwargs)
|
|
|
|
return wrap_dbus
|