mirror of
https://github.com/riptidewave93/UNVR-NAS.git
synced 2025-02-15 03:51:54 +00:00
* Write a mock ustorage tool to parse disk info for ulcmd * Pass system temp info from unvr-fan-daemon to mock-ubnt-api via tmp file * add mock ubnt-tools to make ulcmd happy and report our SN * code cleanup and documentation update
21 lines
573 B
Python
21 lines
573 B
Python
#!/usr/bin/python3
|
|
from functools import lru_cache
|
|
|
|
"""
|
|
A handful of Ubiquiti Unifi device specific functions
|
|
"""
|
|
|
|
UBNTHAL_PATH = "/proc/ubnthal/system.info"
|
|
|
|
|
|
@lru_cache(None)
|
|
def get_ubnt_shortname() -> str:
|
|
try:
|
|
with open(UBNTHAL_PATH, "r") as f:
|
|
ubnthal_model = [i for i in f.readlines() if i.startswith("shortname=")][0]
|
|
return ubnthal_model.lstrip("shortname=").rstrip("\n")
|
|
except FileNotFoundError:
|
|
print(
|
|
f"Error: unable to open {UBNTHAL_PATH}; is the ubnthal kernel module loaded?!"
|
|
)
|
|
raise
|