This commit is contained in:
2025-05-05 17:09:01 +02:00
parent 920dadd36f
commit 344706f10d

View File

@@ -373,6 +373,8 @@ def on_connect(client, userdata, flags, rc):
# Subscribing in on_connect() means that if we lose the connection and
# reconnect then subscriptions will be renewed.
topic = "sectorq/systems/" + host.lower()
topic2 = "sectorq/systems/all"
MQTT_TOPIC = [(topic,0),(topic2,0)]
print(topic)
writeLog(topic)
time.sleep(1)
@@ -412,8 +414,7 @@ def on_connect(client, userdata, flags, rc):
else:
client.publish("sectorq/systems/nas/" + m, payload=0, qos=0, retain=True)
client.subscribe(topic)
client.subscribe(MQTT_TOPIC)
def on_disconnect(client, userdata, rc):
print("disconnecting reason " +str(rc))
@@ -690,17 +691,14 @@ def on_message(client, userdata, msg):
subprocess.Popen(myCmd.split())
if myObj["cmd"] == "assist":
if myObj['target'] == "start":
myCmd =f"powershell c:\\Users\\jd\Documents\\volume.ps1 10"
myCmd =f'powershell "& ""c:\\Program Files\\jaydee\\vol_control.ps1""" 0.2'
else:
myCmd =f"powershell c:\\Users\\jd\\Documents\\volume.ps1 100"
myCmd =f'powershell "& ""c:\\Program Files\\jaydee\\vol_control.ps1""" 1'
writeLog(myCmd)
output = subprocess.Popen(myCmd, shell=True)
writeLog(output)
if myObj["cmd"] == "display":
if curos == "Windows":
# os.startfile(sys.argv[0])
#sys.exit()
#print("reconfigure")
#myCmd = 'MonitorSwitcher.exe -load:' + myObj["target"] + '.xml'
myCmd =f"powershell -w h -command \" Import-Module DisplayConfig ; Import-Clixml $home\monitors\{myObj['target']}.xml | Use-DisplayConfig -UpdateAdapterIds \""
writeLog(myCmd)
#myCmd = f"MultiMonitorTool.exe /LoadConfig \"c:\\Program Files\\jaydee\\Monitors\\{myObj["target"]}.cfg\""
@@ -1037,7 +1035,7 @@ if curos == "Windows":
#writeLog(json.dumps(stats))
writeLog(FILE_TIMESTAMP)
writeLog(mtime)
writeLog(sys.argv[0])
#writeLog(sys.argv[0])
if FILE_TIMESTAMP != mtime:
writeLog("Script updated ! restarting...")
#os.execv(sys.executable, ['python'] + sys.argv)