Meshtastic command wrapper script

pull/9/head
Jeremiah K 2023-09-09 12:52:25 -05:00
rodzic 1e51c54579
commit 6f517a1500
2 zmienionych plików z 26 dodań i 1 usunięć

Wyświetl plik

@ -0,0 +1,22 @@
import os
import subprocess
import time
def execute_meshtastic_command(options):
"""Execute a meshtastic command with the given options."""
command = ["meshtastic", "--set"] + options.split()
subprocess.run(command)
time.sleep(30) # Pause for 30 seconds
# Loop through environment variables in sequence
index = 1
while True:
command = os.environ.get(f'MESHTASTIC_COMMAND_{index}')
if command:
execute_meshtastic_command(command)
index += 1
else:
break
# Finally, run the main Meshtastic process (or whatever process you want to keep the container running)
subprocess.run(["meshtastic"])

Wyświetl plik

@ -13,6 +13,9 @@ services:
networks:
- mesh
entrypoint: ["sh", "-c", "meshtasticd"]
environment:
MESHTASTIC_COMMAND_1: "network.wifi_enabled true --set network.wifi_ssid 'my network' --set network.wifi_psk mypassword"
MESHTASTIC_COMMAND_2: "another_option value --set yet_another_option another_value"
mmrelayapp:
build: app
@ -30,7 +33,7 @@ services:
MATRIX_HOMESERVER: "https://example.matrix.org"
MATRIX_ACCESS_TOKEN: "your_access_token"
MATRIX_BOT_USER_ID: "@botuser:example.matrix.org"
MATRIX_ROOMS_ID_1: "#someroomalias1:example.matrix.org"
MATRIX_ROOMS_ID_1: "#someroomalias1:example.matrix.org" # Need at least 1 room & channel mapped, maximum 8
MATRIX_ROOMS_MESHTASTIC_CHANNEL_1: "0"
# MATRIX_ROOMS_ID_2: "#someroomalias2:example.matrix.org"
# MATRIX_ROOMS_MESHTASTIC_CHANNEL_2: "1"