mirror of
https://github.com/home-assistant/core.git
synced 2025-07-12 15:57:06 +00:00
Add missing disks to Systemmonitor (#106541)
This commit is contained in:
parent
0de6030911
commit
227a69da65
@ -11,13 +11,15 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
def get_all_disk_mounts() -> list[str]:
|
def get_all_disk_mounts() -> list[str]:
|
||||||
"""Return all disk mount points on system."""
|
"""Return all disk mount points on system."""
|
||||||
disks: list[str] = []
|
disks: list[str] = []
|
||||||
for part in psutil.disk_partitions(all=False):
|
for part in psutil.disk_partitions(all=True):
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
if "cdrom" in part.opts or part.fstype == "":
|
if "cdrom" in part.opts or part.fstype == "":
|
||||||
# skip cd-rom drives with no disk in it; they may raise
|
# skip cd-rom drives with no disk in it; they may raise
|
||||||
# ENOENT, pop-up a Windows GUI error for a non-ready
|
# ENOENT, pop-up a Windows GUI error for a non-ready
|
||||||
# partition or just hang.
|
# partition or just hang.
|
||||||
continue
|
continue
|
||||||
|
usage = psutil.disk_usage(part.mountpoint)
|
||||||
|
if usage.total > 0 and part.device != "":
|
||||||
disks.append(part.mountpoint)
|
disks.append(part.mountpoint)
|
||||||
_LOGGER.debug("Adding disks: %s", ", ".join(disks))
|
_LOGGER.debug("Adding disks: %s", ", ".join(disks))
|
||||||
return disks
|
return disks
|
||||||
|
Loading…
x
Reference in New Issue
Block a user