fix: and add data to ubnteeprom (#10)

* Fixup incorrect device serial #
* Add more system info about the NVRs
* Start using ubnteeprom in more spots
* Also do some minor BT house cleaning
This commit is contained in:
Chris Blake 2024-06-15 09:49:11 -05:00 committed by GitHub
parent 9ef1a72228
commit 8e2262e121
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 163 additions and 70 deletions

View file

@ -5,17 +5,6 @@ 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
return os.popen("ubnteeprom -systeminfo -key shortname").read().rstrip("\n")