This commit is contained in:
jaydee
2023-01-27 06:35:04 +01:00
parent b04a0fcd34
commit 0dede0a032
10 changed files with 44 additions and 61 deletions

View File

@@ -309,12 +309,6 @@
('multiprocessing', ('multiprocessing',
'C:\\Program Files\\Python310\\lib\\multiprocessing\\__init__.py', 'C:\\Program Files\\Python310\\lib\\multiprocessing\\__init__.py',
'PYMODULE'), 'PYMODULE'),
('stringprep',
'C:\\Program Files\\Python310\\lib\\stringprep.py',
'PYMODULE'),
('tracemalloc',
'C:\\Program Files\\Python310\\lib\\tracemalloc.py',
'PYMODULE'),
('_py_abc', 'C:\\Program Files\\Python310\\lib\\_py_abc.py', 'PYMODULE'), ('_py_abc', 'C:\\Program Files\\Python310\\lib\\_py_abc.py', 'PYMODULE'),
('getpass', 'C:\\Program Files\\Python310\\lib\\getpass.py', 'PYMODULE'), ('getpass', 'C:\\Program Files\\Python310\\lib\\getpass.py', 'PYMODULE'),
('nturl2path', ('nturl2path',
@@ -327,6 +321,12 @@
('http.cookiejar', ('http.cookiejar',
'C:\\Program Files\\Python310\\lib\\http\\cookiejar.py', 'C:\\Program Files\\Python310\\lib\\http\\cookiejar.py',
'PYMODULE'), 'PYMODULE'),
('stringprep',
'C:\\Program Files\\Python310\\lib\\stringprep.py',
'PYMODULE'),
('tracemalloc',
'C:\\Program Files\\Python310\\lib\\tracemalloc.py',
'PYMODULE'),
('ping3', ('ping3',
'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\ping3\\__init__.py', 'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\ping3\\__init__.py',
'PYMODULE'), 'PYMODULE'),
@@ -807,12 +807,12 @@
('_asyncio.pyd', ('_asyncio.pyd',
'C:\\Program Files\\Python310\\DLLs\\_asyncio.pyd', 'C:\\Program Files\\Python310\\DLLs\\_asyncio.pyd',
'EXTENSION'), 'EXTENSION'),
('libssl-1_1.dll',
'C:\\Program Files\\Python310\\DLLs\\libssl-1_1.dll',
'BINARY'),
('libcrypto-1_1.dll', ('libcrypto-1_1.dll',
'C:\\Program Files\\Python310\\DLLs\\libcrypto-1_1.dll', 'C:\\Program Files\\Python310\\DLLs\\libcrypto-1_1.dll',
'BINARY'), 'BINARY'),
('libssl-1_1.dll',
'C:\\Program Files\\Python310\\DLLs\\libssl-1_1.dll',
'BINARY'),
('python3.dll', 'C:\\Program Files\\Python310\\python3.dll', 'BINARY'), ('python3.dll', 'C:\\Program Files\\Python310\\python3.dll', 'BINARY'),
('libffi-7.dll', ('libffi-7.dll',
'C:\\Program Files\\Python310\\DLLs\\libffi-7.dll', 'C:\\Program Files\\Python310\\DLLs\\libffi-7.dll',
@@ -822,10 +822,10 @@
[('base_library.zip', [('base_library.zip',
'X:\\__GITLAB\\python\\build\\mqtt_srv\\base_library.zip', 'X:\\__GITLAB\\python\\build\\mqtt_srv\\base_library.zip',
'DATA'), 'DATA'),
('certifi\\cacert.pem',
'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\certifi\\cacert.pem',
'DATA'),
('certifi\\py.typed', ('certifi\\py.typed',
'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\certifi\\py.typed', 'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\certifi\\py.typed',
'DATA'),
('certifi\\cacert.pem',
'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\certifi\\cacert.pem',
'DATA')], 'DATA')],
[]) [])

View File

@@ -88,12 +88,12 @@
('_asyncio.pyd', ('_asyncio.pyd',
'C:\\Program Files\\Python310\\DLLs\\_asyncio.pyd', 'C:\\Program Files\\Python310\\DLLs\\_asyncio.pyd',
'EXTENSION'), 'EXTENSION'),
('libssl-1_1.dll',
'C:\\Program Files\\Python310\\DLLs\\libssl-1_1.dll',
'BINARY'),
('libcrypto-1_1.dll', ('libcrypto-1_1.dll',
'C:\\Program Files\\Python310\\DLLs\\libcrypto-1_1.dll', 'C:\\Program Files\\Python310\\DLLs\\libcrypto-1_1.dll',
'BINARY'), 'BINARY'),
('libssl-1_1.dll',
'C:\\Program Files\\Python310\\DLLs\\libssl-1_1.dll',
'BINARY'),
('python3.dll', 'C:\\Program Files\\Python310\\python3.dll', 'BINARY'), ('python3.dll', 'C:\\Program Files\\Python310\\python3.dll', 'BINARY'),
('libffi-7.dll', ('libffi-7.dll',
'C:\\Program Files\\Python310\\DLLs\\libffi-7.dll', 'C:\\Program Files\\Python310\\DLLs\\libffi-7.dll',
@@ -101,16 +101,16 @@
('base_library.zip', ('base_library.zip',
'X:\\__GITLAB\\python\\build\\mqtt_srv\\base_library.zip', 'X:\\__GITLAB\\python\\build\\mqtt_srv\\base_library.zip',
'DATA'), 'DATA'),
('certifi\\cacert.pem',
'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\certifi\\cacert.pem',
'DATA'),
('certifi\\py.typed', ('certifi\\py.typed',
'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\certifi\\py.typed', 'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\certifi\\py.typed',
'DATA'),
('certifi\\cacert.pem',
'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\certifi\\cacert.pem',
'DATA')], 'DATA')],
[], [],
False, False,
False, False,
1671871456, 1672427170,
[('runw.exe', [('runw.exe',
'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\bootloader\\Windows-64bit-intel\\runw.exe', 'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\PyInstaller\\bootloader\\Windows-64bit-intel\\runw.exe',
'EXECUTABLE')]) 'EXECUTABLE')])

View File

@@ -81,12 +81,12 @@
('_asyncio.pyd', ('_asyncio.pyd',
'C:\\Program Files\\Python310\\DLLs\\_asyncio.pyd', 'C:\\Program Files\\Python310\\DLLs\\_asyncio.pyd',
'EXTENSION'), 'EXTENSION'),
('libssl-1_1.dll',
'C:\\Program Files\\Python310\\DLLs\\libssl-1_1.dll',
'BINARY'),
('libcrypto-1_1.dll', ('libcrypto-1_1.dll',
'C:\\Program Files\\Python310\\DLLs\\libcrypto-1_1.dll', 'C:\\Program Files\\Python310\\DLLs\\libcrypto-1_1.dll',
'BINARY'), 'BINARY'),
('libssl-1_1.dll',
'C:\\Program Files\\Python310\\DLLs\\libssl-1_1.dll',
'BINARY'),
('python3.dll', 'C:\\Program Files\\Python310\\python3.dll', 'BINARY'), ('python3.dll', 'C:\\Program Files\\Python310\\python3.dll', 'BINARY'),
('libffi-7.dll', ('libffi-7.dll',
'C:\\Program Files\\Python310\\DLLs\\libffi-7.dll', 'C:\\Program Files\\Python310\\DLLs\\libffi-7.dll',
@@ -94,11 +94,11 @@
('base_library.zip', ('base_library.zip',
'X:\\__GITLAB\\python\\build\\mqtt_srv\\base_library.zip', 'X:\\__GITLAB\\python\\build\\mqtt_srv\\base_library.zip',
'DATA'), 'DATA'),
('certifi\\cacert.pem',
'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\certifi\\cacert.pem',
'DATA'),
('certifi\\py.typed', ('certifi\\py.typed',
'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\certifi\\py.typed', 'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\certifi\\py.typed',
'DATA'),
('certifi\\cacert.pem',
'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\certifi\\cacert.pem',
'DATA')], 'DATA')],
False, False,
False, False,

Binary file not shown.

View File

@@ -281,12 +281,6 @@
('multiprocessing', ('multiprocessing',
'C:\\Program Files\\Python310\\lib\\multiprocessing\\__init__.py', 'C:\\Program Files\\Python310\\lib\\multiprocessing\\__init__.py',
'PYMODULE'), 'PYMODULE'),
('stringprep',
'C:\\Program Files\\Python310\\lib\\stringprep.py',
'PYMODULE'),
('tracemalloc',
'C:\\Program Files\\Python310\\lib\\tracemalloc.py',
'PYMODULE'),
('_py_abc', 'C:\\Program Files\\Python310\\lib\\_py_abc.py', 'PYMODULE'), ('_py_abc', 'C:\\Program Files\\Python310\\lib\\_py_abc.py', 'PYMODULE'),
('getpass', 'C:\\Program Files\\Python310\\lib\\getpass.py', 'PYMODULE'), ('getpass', 'C:\\Program Files\\Python310\\lib\\getpass.py', 'PYMODULE'),
('nturl2path', ('nturl2path',
@@ -299,6 +293,12 @@
('http.cookiejar', ('http.cookiejar',
'C:\\Program Files\\Python310\\lib\\http\\cookiejar.py', 'C:\\Program Files\\Python310\\lib\\http\\cookiejar.py',
'PYMODULE'), 'PYMODULE'),
('stringprep',
'C:\\Program Files\\Python310\\lib\\stringprep.py',
'PYMODULE'),
('tracemalloc',
'C:\\Program Files\\Python310\\lib\\tracemalloc.py',
'PYMODULE'),
('ping3', ('ping3',
'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\ping3\\__init__.py', 'C:\\Users\\jaydee\\AppData\\Roaming\\Python\\Python310\\site-packages\\ping3\\__init__.py',
'PYMODULE'), 'PYMODULE'),

Binary file not shown.

Binary file not shown.

BIN
dist/mqtt_srv.exe vendored

Binary file not shown.

View File

@@ -149,6 +149,7 @@ def check_router():
# if output == "allow":\ # if output == "allow":\
writeLog("Payload : " + str(json.dumps(stats))) writeLog("Payload : " + str(json.dumps(stats)))
''' '''
stats["status"] = "on"
client.publish("home-assistant/router/hwstats", json.dumps(stats), qos=0, retain=True) client.publish("home-assistant/router/hwstats", json.dumps(stats), qos=0, retain=True)
#client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=True) #client.publish("sectorq/systems/router/stats", payload=json.dumps(stats), qos=0, retain=True)
#else: #else:
@@ -916,22 +917,14 @@ def on_message(client, userdata, msg):
print("not a json!") print("not a json!")
client = mqtt.Client() client = mqtt.Client()
payload = "off"
client.username_pw_set("jaydee", password="jaydee1") client.username_pw_set("jaydee", password="jaydee1")
client.will_set("sectorq/systems/" + host.lower() + "/stat", payload=payload, qos=0, retain=True) client.will_set("home-assistant/" + host + "/hwstats", payload='{"status":"off"}', qos=0, retain=True)
client.on_connect = on_connect client.on_connect = on_connect
client.on_message = on_message client.on_message = on_message
writeLog(MQTT_HOST) writeLog(MQTT_HOST)
client.connect(MQTT_HOST, MQTT_PORT, 25) client.connect(MQTT_HOST, MQTT_PORT, 25)
# client.publish("sectorq/status", payload="{'action':'connect', 'system':'" + host + "', 'ip': '" + IP + "', 'mac':'" + mac + "', 'ver':'?'}", qos=0, retain=False)
# Blocking call that processes network traffic, dispatches callbacks and
# handles reconnecting.
# Other loop*() functions are available that give a threaded interface and a
# manual interface.
def checkIfProcessRunning(processName): def checkIfProcessRunning(processName):
''' '''
Check if there is any running process that contains the given name processName. Check if there is any running process that contains the given name processName.
@@ -994,6 +987,7 @@ if curos == "Windows":
results[aide_refs[k]] = value[0] results[aide_refs[k]] = value[0]
except: except:
pass pass
results["status"] = "on"
except: except:
print("aida initializing...") print("aida initializing...")
results = {} results = {}
@@ -1018,12 +1012,11 @@ if curos == "Windows":
print(psutil.sensors_fans()) print(psutil.sensors_fans())
except: except:
pass pass
results = {"version":VERSION,"MB_TEMP":"NA", "MEM_UTIL":str(mem_data.percent), "CPU_TEMP":"NA", "FAN_CPU":"NA", "VMEM_UTIL":swap_data.percent, "CPU_UTIL":cpu_usage, "GPU_TEMP":"NA", "GPU_UTIL":"NA"} results = {"status":"on", "version":VERSION,"MB_TEMP":"NA", "MEM_UTIL":str(mem_data.percent), "CPU_TEMP":"NA", "FAN_CPU":"NA", "VMEM_UTIL":swap_data.percent, "CPU_UTIL":cpu_usage, "GPU_TEMP":"NA", "GPU_UTIL":"NA"}
print(json.dumps(results)) print(json.dumps(results))
r = json.dumps(results) r = json.dumps(results)
#client.publish("home-assistant/" + host + "/hwstats", payload='{"TPCHDIO":"' + str(results["TPCHDIO"]) + '", "SMEMUTI":"' + str(results["SMEMUTI"]) + '", "TCPU":"' + str(results["TCPU"]) + '", "TGPU1DIO":"' + str(results["TGPU1DIO"]) + '", "SGPU1BIUTI":"' + str(results["SGPU1BIUTI"]) + '", "FCPU":"' + str(results["FCPU"]) + '", "SVIRTMEMUTI":"' + str(results["SVIRTMEMUTI"]) + '", "SCPUUTI":"' + str(results["SCPUUTI"]) + '"}', qos=0, retain=False) #client.publish("home-assistant/" + host + "/hwstats", payload='{"TPCHDIO":"' + str(results["TPCHDIO"]) + '", "SMEMUTI":"' + str(results["SMEMUTI"]) + '", "TCPU":"' + str(results["TCPU"]) + '", "TGPU1DIO":"' + str(results["TGPU1DIO"]) + '", "SGPU1BIUTI":"' + str(results["SGPU1BIUTI"]) + '", "FCPU":"' + str(results["FCPU"]) + '", "SVIRTMEMUTI":"' + str(results["SVIRTMEMUTI"]) + '", "SCPUUTI":"' + str(results["SCPUUTI"]) + '"}', qos=0, retain=False)
client.publish("home-assistant/" + host + "/hwstats", payload=r, qos=0, retain=False) client.publish("home-assistant/" + host + "/hwstats", payload=r, qos=0, retain=False)
client.publish("sectorq/systems/" + host.lower() + "/stat", payload="on", qos=0, retain=True)
#print(json.dumps(stats)) #print(json.dumps(stats))
#writeLog(json.dumps(stats)) #writeLog(json.dumps(stats))
else: else:
@@ -1070,8 +1063,7 @@ else:
#print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"])) #print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"]))
#print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"])) #print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"]))
#client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False) #client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
client.publish("home-assistant/" + host + "/hwstats", payload='{"version":"' + VERSION + '","MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":' + str(fan_data.current) + ', "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False) client.publish("home-assistant/" + host + "/hwstats", payload='{"status":"on","version":"' + VERSION + '","MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":' + str(fan_data.current) + ', "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False)
client.publish("sectorq/systems/" + host.lower() + "/stat", payload="on", qos=0, retain=True)
elif host.lower() == "openmediavault" or host.lower() == "omv": elif host.lower() == "openmediavault" or host.lower() == "omv":
#print(psutil.sensors_temperatures()) #print(psutil.sensors_temperatures())
#print(psutil.sensors_fans()) #print(psutil.sensors_fans())
@@ -1112,7 +1104,7 @@ else:
#print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"])) #print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"]))
#print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"])) #print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"]))
#client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False) #client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
client.publish("home-assistant/" + host + "/hwstats", payload='{"version":"' + VERSION + '","reboot":"' + str(reboot_pending) + '", "uptime":"' + str(sys_uptime) + '", "raid_usage": ' + str(disk_usage) + ',"rsync":"' + str(stat_rsync) +'", "MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":0, "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False) client.publish("home-assistant/" + host + "/hwstats", payload='{"status":"on", "version":"' + VERSION + '","reboot":"' + str(reboot_pending) + '", "uptime":"' + str(sys_uptime) + '", "raid_usage": ' + str(disk_usage) + ',"rsync":"' + str(stat_rsync) +'", "MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":0, "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False)
elif host.lower() == "router": elif host.lower() == "router":
check_router() check_router()
elif host.lower() == "nas": elif host.lower() == "nas":

View File

@@ -916,22 +916,14 @@ def on_message(client, userdata, msg):
print("not a json!") print("not a json!")
client = mqtt.Client() client = mqtt.Client()
payload = "off"
client.username_pw_set("jaydee", password="jaydee1") client.username_pw_set("jaydee", password="jaydee1")
client.will_set("sectorq/systems/" + host.lower() + "/stat", payload=payload, qos=0, retain=True) client.will_set("home-assistant/" + host + "/hwstats", payload='{"status":"off"}', qos=0, retain=True)
client.on_connect = on_connect client.on_connect = on_connect
client.on_message = on_message client.on_message = on_message
writeLog(MQTT_HOST) writeLog(MQTT_HOST)
client.connect(MQTT_HOST, MQTT_PORT, 25) client.connect(MQTT_HOST, MQTT_PORT, 25)
# client.publish("sectorq/status", payload="{'action':'connect', 'system':'" + host + "', 'ip': '" + IP + "', 'mac':'" + mac + "', 'ver':'?'}", qos=0, retain=False)
# Blocking call that processes network traffic, dispatches callbacks and
# handles reconnecting.
# Other loop*() functions are available that give a threaded interface and a
# manual interface.
def checkIfProcessRunning(processName): def checkIfProcessRunning(processName):
''' '''
Check if there is any running process that contains the given name processName. Check if there is any running process that contains the given name processName.
@@ -994,6 +986,7 @@ if curos == "Windows":
results[aide_refs[k]] = value[0] results[aide_refs[k]] = value[0]
except: except:
pass pass
results["status"] = "on"
except: except:
print("aida initializing...") print("aida initializing...")
results = {} results = {}
@@ -1018,12 +1011,11 @@ if curos == "Windows":
print(psutil.sensors_fans()) print(psutil.sensors_fans())
except: except:
pass pass
results = {"version":VERSION,"MB_TEMP":"NA", "MEM_UTIL":str(mem_data.percent), "CPU_TEMP":"NA", "FAN_CPU":"NA", "VMEM_UTIL":swap_data.percent, "CPU_UTIL":cpu_usage, "GPU_TEMP":"NA", "GPU_UTIL":"NA"} results = {"status":"on", "version":VERSION,"MB_TEMP":"NA", "MEM_UTIL":str(mem_data.percent), "CPU_TEMP":"NA", "FAN_CPU":"NA", "VMEM_UTIL":swap_data.percent, "CPU_UTIL":cpu_usage, "GPU_TEMP":"NA", "GPU_UTIL":"NA"}
print(json.dumps(results)) print(json.dumps(results))
r = json.dumps(results) r = json.dumps(results)
#client.publish("home-assistant/" + host + "/hwstats", payload='{"TPCHDIO":"' + str(results["TPCHDIO"]) + '", "SMEMUTI":"' + str(results["SMEMUTI"]) + '", "TCPU":"' + str(results["TCPU"]) + '", "TGPU1DIO":"' + str(results["TGPU1DIO"]) + '", "SGPU1BIUTI":"' + str(results["SGPU1BIUTI"]) + '", "FCPU":"' + str(results["FCPU"]) + '", "SVIRTMEMUTI":"' + str(results["SVIRTMEMUTI"]) + '", "SCPUUTI":"' + str(results["SCPUUTI"]) + '"}', qos=0, retain=False) #client.publish("home-assistant/" + host + "/hwstats", payload='{"TPCHDIO":"' + str(results["TPCHDIO"]) + '", "SMEMUTI":"' + str(results["SMEMUTI"]) + '", "TCPU":"' + str(results["TCPU"]) + '", "TGPU1DIO":"' + str(results["TGPU1DIO"]) + '", "SGPU1BIUTI":"' + str(results["SGPU1BIUTI"]) + '", "FCPU":"' + str(results["FCPU"]) + '", "SVIRTMEMUTI":"' + str(results["SVIRTMEMUTI"]) + '", "SCPUUTI":"' + str(results["SCPUUTI"]) + '"}', qos=0, retain=False)
client.publish("home-assistant/" + host + "/hwstats", payload=r, qos=0, retain=False) client.publish("home-assistant/" + host + "/hwstats", payload=r, qos=0, retain=False)
client.publish("sectorq/systems/" + host.lower() + "/stat", payload="on", qos=0, retain=True)
#print(json.dumps(stats)) #print(json.dumps(stats))
#writeLog(json.dumps(stats)) #writeLog(json.dumps(stats))
else: else:
@@ -1070,8 +1062,7 @@ else:
#print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"])) #print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"]))
#print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"])) #print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"]))
#client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False) #client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
client.publish("home-assistant/" + host + "/hwstats", payload='{"version":"' + VERSION + '","MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":' + str(fan_data.current) + ', "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False) client.publish("home-assistant/" + host + "/hwstats", payload='{"status":"on","version":"' + VERSION + '","MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":' + str(fan_data.current) + ', "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False)
client.publish("sectorq/systems/" + host.lower() + "/stat", payload="on", qos=0, retain=True)
elif host.lower() == "openmediavault" or host.lower() == "omv": elif host.lower() == "openmediavault" or host.lower() == "omv":
#print(psutil.sensors_temperatures()) #print(psutil.sensors_temperatures())
#print(psutil.sensors_fans()) #print(psutil.sensors_fans())
@@ -1112,7 +1103,7 @@ else:
#print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"])) #print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_input"]))
#print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"])) #print(str(jn1["asus-isa-0000"]["cpu_fan"]["fan1_input"]))
#client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False) #client.publish("sectorq/monitor/" + host.lower(), payload="{\"mb_temp\":0,\"mem_usage\":0,\"cpu_temp\":0,\"cpu_usage\":0,\"gpu_temp\":0,\"gpu_usage\":0}", qos=0, retain=False)
client.publish("home-assistant/" + host + "/hwstats", payload='{"version":"' + VERSION + '","reboot":"' + str(reboot_pending) + '", "uptime":"' + str(sys_uptime) + '", "raid_usage": ' + str(disk_usage) + ',"rsync":"' + str(stat_rsync) +'", "MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":0, "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False) client.publish("home-assistant/" + host + "/hwstats", payload='{"status":"on", "version":"' + VERSION + '","reboot":"' + str(reboot_pending) + '", "uptime":"' + str(sys_uptime) + '", "raid_usage": ' + str(disk_usage) + ',"rsync":"' + str(stat_rsync) +'", "MB_TEMP":' + str(mb_data.current) + ', "MEM_UTIL":' + str(mem_data.percent) + ', "CPU_TEMP":' + str(cpu_data.current) + ', "GPU_TEMP":0, "GPU_UTIL":0, "FAN_CPU":0, "VMEM_UTIL":' + str(swap_data.percent) + ', "CPU_UTIL":' + str(cpu_usage) + '}', qos=0, retain=False)
elif host.lower() == "router": elif host.lower() == "router":
check_router() check_router()
elif host.lower() == "nas": elif host.lower() == "nas":