kopia lustrzana https://github.com/mate-dev/mmrelaynode
Meshtastic command wrapper script
rodzic
1e51c54579
commit
6f517a1500
|
@ -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"])
|
|
@ -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"
|
||||
|
|
Ładowanie…
Reference in New Issue