mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-10-17 23:59:42 +00:00
15 lines
431 B
Python
15 lines
431 B
Python
"""Utils for dbus."""
|
|
|
|
from ..exceptions import HassioNotSupportedError
|
|
|
|
|
|
def dbus_connected(method):
|
|
"""Wrapper for check if dbus is connected."""
|
|
def wrap_dbus(self, *args, **kwargs):
|
|
"""Check if dbus is connected before call a method."""
|
|
if self.dbus is None:
|
|
raise HassioNotSupportedError(f"{self!s} not connected to dbus!")
|
|
return self.method(*args, **kwargs)
|
|
|
|
return wrap_dbus
|