mirror of
https://gitlab.sectorq.eu/jaydee/python.git
synced 2025-12-14 02:34:53 +01:00
das
This commit is contained in:
34
mqtt_srv.py
34
mqtt_srv.py
@@ -772,28 +772,9 @@ def on_message(client, userdata, msg):
|
||||
myCmd = ""
|
||||
writeLog(myObj["target"])
|
||||
if curos == "Windows":
|
||||
if myObj["target"] == "mid":
|
||||
myCmd = "DisplayFusionCommand.exe -monitorloadprofile mid"
|
||||
elif myObj["target"] == "all":
|
||||
myCmd = "DisplayFusionCommand.exe -monitorloadprofile all"
|
||||
elif myObj["target"] == "left":
|
||||
myCmd = "DisplayFusionCommand.exe -monitorloadprofile left"
|
||||
elif myObj["target"] == "midleft":
|
||||
myCmd = "DisplayFusionCommand.exe -monitorloadprofile midleft"
|
||||
elif myObj["target"] == "midtop":
|
||||
myCmd = "DisplayFusionCommand.exe -monitorloadprofile midtop"
|
||||
elif myObj["target"] == "midleftbuild":
|
||||
myCmd = "DisplayFusionCommand.exe -monitorloadprofile midleftbuild"
|
||||
elif myObj["target"] == "midbuild":
|
||||
myCmd = "DisplayFusionCommand.exe -monitorloadprofile midbuild"
|
||||
elif myObj["target"] == "midlefttop":
|
||||
myCmd = "DisplayFusionCommand.exe -monitorloadprofile midlefttop"
|
||||
elif myObj["target"] == "build":
|
||||
myCmd = "DisplayFusionCommand.exe -monitorloadprofile build"
|
||||
elif myObj["target"] == "midtopbuild":
|
||||
myCmd = "DisplayFusionCommand.exe -monitorloadprofile midtopbuild"
|
||||
else:
|
||||
pass
|
||||
|
||||
myCmd = "DisplayFusionCommand.exe -monitorloadprofile {}".format(myObj["target"])
|
||||
|
||||
else:
|
||||
'''
|
||||
mon1 = "HDMI-1-1"
|
||||
@@ -831,8 +812,11 @@ def on_message(client, userdata, msg):
|
||||
writeLog(myCmd)
|
||||
if myCmd != "":
|
||||
print(myCmd)
|
||||
subprocess.Popen(myCmd.split())
|
||||
|
||||
writeLog("Executing")
|
||||
#subprocess.Popen(myCmd.split())
|
||||
status, output = subprocess.getstatusoutput(myCmd)
|
||||
writeLog(output)
|
||||
writeLog(status)
|
||||
if myObj["cmd"] == "display2":
|
||||
# os.startfile(sys.argv[0])
|
||||
#sys.exit()
|
||||
@@ -1039,6 +1023,7 @@ if curos == "Windows":
|
||||
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=r, qos=0, retain=False)
|
||||
client.publish("sectorq/systems/" + host.lower() + "/stat", payload="on", qos=0, retain=True)
|
||||
#print(json.dumps(stats))
|
||||
#writeLog(json.dumps(stats))
|
||||
else:
|
||||
@@ -1086,6 +1071,7 @@ else:
|
||||
#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("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("sectorq/systems/" + host.lower() + "/stat", payload="on", qos=0, retain=True)
|
||||
elif host.lower() == "openmediavault" or host.lower() == "omv":
|
||||
#print(psutil.sensors_temperatures())
|
||||
#print(psutil.sensors_fans())
|
||||
|
||||
Reference in New Issue
Block a user