mirror of
https://gitlab.sectorq.eu/jaydee/python.git
synced 2025-12-14 02:34:53 +01:00
ike
This commit is contained in:
13
mqtt_srv.pyw
13
mqtt_srv.pyw
@@ -19,7 +19,7 @@ import random
|
||||
import requests
|
||||
#import psutil
|
||||
stats = {}
|
||||
VERSION = "1.0.22"
|
||||
VERSION = "1.0.23"
|
||||
curos = platform.system()
|
||||
host = platform.node().lower()
|
||||
print(host)
|
||||
@@ -989,7 +989,7 @@ if curos == "Windows":
|
||||
results["status"] = "on"
|
||||
except:
|
||||
print("aida initializing...")
|
||||
results = {}
|
||||
results = {"status":"init"}
|
||||
|
||||
|
||||
else:
|
||||
@@ -1011,7 +1011,11 @@ if curos == "Windows":
|
||||
print(psutil.sensors_fans())
|
||||
except:
|
||||
pass
|
||||
<<<<<<< HEAD
|
||||
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"}
|
||||
=======
|
||||
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"}
|
||||
>>>>>>> fba8088e24f4b4228930b1a72ca37b712d90c824
|
||||
print(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)
|
||||
@@ -1062,7 +1066,12 @@ else:
|
||||
#print(str(jn1["coretemp-isa-0000"]["Package id 0"]["temp1_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)
|
||||
<<<<<<< HEAD
|
||||
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("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)
|
||||
>>>>>>> fba8088e24f4b4228930b1a72ca37b712d90c824
|
||||
elif host.lower() == "openmediavault" or host.lower() == "omv":
|
||||
#print(psutil.sensors_temperatures())
|
||||
#print(psutil.sensors_fans())
|
||||
|
||||
Reference in New Issue
Block a user