diff --git a/supervisor/dbus/systemd.py b/supervisor/dbus/systemd.py index 284458f27..2f1db1d0d 100644 --- a/supervisor/dbus/systemd.py +++ b/supervisor/dbus/systemd.py @@ -70,7 +70,7 @@ class SystemdUnit(DBusInterface): @dbus_connected async def get_active_state(self) -> UnitActiveState: """Get active state of the unit.""" - return await self.connected_dbus.Unit.get("active_state") + return UnitActiveState(await self.connected_dbus.Unit.get("active_state")) @dbus_connected def properties_changed(self) -> DBusSignalWrapper: diff --git a/supervisor/dbus/udisks2/data.py b/supervisor/dbus/udisks2/data.py index e8c440603..6097b326c 100644 --- a/supervisor/dbus/udisks2/data.py +++ b/supervisor/dbus/udisks2/data.py @@ -9,7 +9,7 @@ from dbus_fast import Variant from .const import EncryptType, EraseMode -def udisks2_bytes_to_path(path_bytes: bytearray) -> Path: +def udisks2_bytes_to_path(path_bytes: bytes) -> Path: """Convert bytes to path object without null character on end.""" if path_bytes and path_bytes[-1] == 0: return Path(path_bytes[:-1].decode()) @@ -73,7 +73,7 @@ FormatOptionsDataType = TypedDict( { "label": NotRequired[str], "take-ownership": NotRequired[bool], - "encrypt.passphrase": NotRequired[bytearray], + "encrypt.passphrase": NotRequired[bytes], "encrypt.type": NotRequired[str], "erase": NotRequired[str], "update-partition-type": NotRequired[bool], diff --git a/supervisor/mounts/mount.py b/supervisor/mounts/mount.py index 5d67f186f..3c4d86144 100644 --- a/supervisor/mounts/mount.py +++ b/supervisor/mounts/mount.py @@ -135,7 +135,7 @@ class Mount(CoreSysAttributes, ABC): @property def state(self) -> UnitActiveState | None: """Get state of mount.""" - return self._state + return UnitActiveState(self._state) if self._state is not None else None @cached_property def local_where(self) -> Path: diff --git a/supervisor/utils/dbus.py b/supervisor/utils/dbus.py index 15d8f17de..e3bcbc45a 100644 --- a/supervisor/utils/dbus.py +++ b/supervisor/utils/dbus.py @@ -7,13 +7,7 @@ from collections.abc import Awaitable, Callable import logging from typing import Any, Protocol, cast -from dbus_fast import ( - ErrorType, - InvalidIntrospectionError, - Message, - MessageType, - Variant, -) +from dbus_fast import ErrorType, InvalidIntrospectionError, Message, MessageType from dbus_fast.aio.message_bus import MessageBus from dbus_fast.aio.proxy_object import ProxyInterface, ProxyObject from dbus_fast.errors import DBusError as DBusFastDBusError @@ -265,7 +259,7 @@ class DBus: """ async def sync_property_change( - prop_interface: str, changed: dict[str, Variant], invalidated: list[str] + prop_interface: str, changed: dict[str, Any], invalidated: list[str] ) -> None: """Sync property changes to cache.""" if interface != prop_interface: