mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-11-08 10:29:30 +00:00
Cleanups
This commit is contained in:
14
hassio/dbus/utils.py
Normal file
14
hassio/dbus/utils.py
Normal file
@@ -0,0 +1,14 @@
|
||||
"""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
|
||||
Reference in New Issue
Block a user