mirror of
https://gitlab.sectorq.eu/jaydee/mqtt_srv.git
synced 2025-12-14 02:34:52 +01:00
Compare commits
19 Commits
35c24f9527
...
87d82d8f73
| Author | SHA1 | Date | |
|---|---|---|---|
| 87d82d8f73 | |||
| 7d0da9241e | |||
| 2c892fd6fa | |||
| 1e0a172cb9 | |||
| 69ddbe559b | |||
| 245e88f612 | |||
| 07e61dc952 | |||
| bb3de5c241 | |||
| e428b18e42 | |||
| f747536496 | |||
| ebfb825cfe | |||
| 796eae1859 | |||
| 2c7be24654 | |||
| 5b05f1ac61 | |||
| 9ed37997a0 | |||
| 3f132c1f89 | |||
| facb016fc3 | |||
| 6951eebf09 | |||
| b361e043c5 |
@@ -8,5 +8,6 @@ build-job: # This job runs in the build stage, which runs first.
|
||||
- column=":"
|
||||
- echo "${flow_id}"
|
||||
- curl -X POST https://kestra.sectorq.eu/api/v1/executions/webhook/jaydee/ansible-all/${flow_id} -d '{"tag":["mqtt-srv"],"target":["morefine.home.lan"]}' -H "Content-Type${column} application/json"
|
||||
- rm -rf /home/gitlab-runner/builds/1fLwHSKm2/0/jaydee/mqtt_srv.tmp/.gitlab-runner.ext.conf
|
||||
rules:
|
||||
- if: '$CI_COMMIT_MESSAGE =~ /build/'
|
||||
|
||||
23
mqtt_srv.py
23
mqtt_srv.py
@@ -691,9 +691,26 @@ def on_message(client, userdata, msg):
|
||||
else:
|
||||
writeLog("Linux Vol Control")
|
||||
if myObj['target'] == "start":
|
||||
writeLog("Getting sound status")
|
||||
#myCmd = "sudo XDG_RUNTIME_DIR=/run/user/1000 -u jd amixer sget Master | awk -F'[][]' '/Left:/ { print $2 }'"
|
||||
myCmd = "sudo XDG_RUNTIME_DIR=/run/user/1000 -u jd amixer sget Master"
|
||||
writeLog(myCmd)
|
||||
output = subprocess.Popen(myCmd, shell=True)
|
||||
cmd = """sudo XDG_RUNTIME_DIR=/run/user/1000 -u jd amixer sget Master | awk -F'[][]' '/Left:/ { print $2 }'"""
|
||||
|
||||
result = subprocess.run(
|
||||
cmd,
|
||||
shell=True,
|
||||
capture_output=True,
|
||||
text=True
|
||||
)
|
||||
os.environ["MQTT_SRV_CUR_VOLUME"] = result.stdout.strip()
|
||||
writeLog(f"Status of volume {os.environ["MQTT_SRV_CUR_VOLUME"]}")
|
||||
myCmd = f'sudo XDG_RUNTIME_DIR=/run/user/1000 -u jd amixer set Master 20%'
|
||||
|
||||
|
||||
else:
|
||||
myCmd =f'sudo XDG_RUNTIME_DIR=/run/user/1000 -u jd amixer set Master 100%'
|
||||
myCmd =f'sudo XDG_RUNTIME_DIR=/run/user/1000 -u jd amixer set Master {os.environ["MQTT_SRV_CUR_VOLUME"] }'
|
||||
# try:
|
||||
# #percent = 20
|
||||
# #output = subprocess.run(["pactl", "set-sink-volume", "@DEFAULT_SINK@", f"{percent}%"], check=True)
|
||||
@@ -1278,8 +1295,8 @@ else:
|
||||
payload[m] = 0
|
||||
client.publish( "home-assistant/" + host + "/hwstats", payload=json.dumps(payload), qos=0, retain=True)
|
||||
|
||||
writeLog(FILE_TIMESTAMP)
|
||||
writeLog(mtime)
|
||||
# writeLog(FILE_TIMESTAMP)
|
||||
# writeLog(mtime)
|
||||
if FILE_TIMESTAMP != mtime:
|
||||
writeLog("Script updated ! restarting...")
|
||||
#os.execv(sys.executable, ['python'] + sys.argv)
|
||||
|
||||
Reference in New Issue
Block a user