mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-08-07 17:32:52 +02:00
make trap list configurable
This commit is contained in:
+2
-2
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
from dadjokes import Dadjoke # pip install dadjokes
|
from dadjokes import Dadjoke # pip install dadjokes
|
||||||
|
|
||||||
|
trap_list_bbs = ("bbslist", "bbspost", "bbsread", "bbsdelete", "bbshelp")
|
||||||
|
|
||||||
# global message list, later we will use a database on disk
|
# global message list, later we will use a database on disk
|
||||||
bbs_messages = [[1, "Welcome to meshBBS", "Welcome to the BBS, please post a message!"]]
|
bbs_messages = [[1, "Welcome to meshBBS", "Welcome to the BBS, please post a message!"]]
|
||||||
|
|
||||||
@@ -55,5 +57,3 @@ def bbs_read_message(messageID = 0):
|
|||||||
else:
|
else:
|
||||||
return "Please specify a message number to read."
|
return "Please specify a message number to read."
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ DAYS_OF_WEATHER = 2 # weather forecast days, the first two rows are today and to
|
|||||||
NO_DATA_NOGPS = "no location data: does your device have GPS?"
|
NO_DATA_NOGPS = "no location data: does your device have GPS?"
|
||||||
ERROR_FETCHING_DATA = "error fetching data"
|
ERROR_FETCHING_DATA = "error fetching data"
|
||||||
|
|
||||||
|
trap_list_location = ("whereami", "tide", "moon", "wx", "wxc")
|
||||||
|
|
||||||
def where_am_i(lat=0, lon=0):
|
def where_am_i(lat=0, lon=0):
|
||||||
whereIam = ""
|
whereIam = ""
|
||||||
if float(lat) == 0 and float(lon) == 0:
|
if float(lat) == 0 and float(lon) == 0:
|
||||||
@@ -157,3 +159,4 @@ def replace_weather(row):
|
|||||||
line = line.replace(key, value)
|
line = line.replace(key, value)
|
||||||
|
|
||||||
return line
|
return line
|
||||||
|
|
||||||
|
|||||||
+9
-4
@@ -12,16 +12,21 @@ from datetime import datetime
|
|||||||
|
|
||||||
from solarconditions import * # from the spudgunman/meshing-around repo
|
from solarconditions import * # from the spudgunman/meshing-around repo
|
||||||
from locationdata import * # from the spudgunman/meshing-around repo
|
from locationdata import * # from the spudgunman/meshing-around repo
|
||||||
from bbstools import * # from the spudgunman/meshing-around repo
|
from bbstools import *
|
||||||
|
from solarconditions import trap_list_conditions # from the spudgunman/meshing-around repo
|
||||||
|
|
||||||
# Uncomment the interface you want to use depending on your device connection
|
# Uncomment the interface you want to use depending on your device connection
|
||||||
interface = meshtastic.serial_interface.SerialInterface() #serial interface
|
interface = meshtastic.serial_interface.SerialInterface() #serial interface
|
||||||
#interface=meshtastic.tcp_interface.TCPInterface(hostname="192.168.0.1") # IP of your device
|
#interface=meshtastic.tcp_interface.TCPInterface(hostname="192.168.0.1") # IP of your device
|
||||||
#interface=meshtastic.ble_interface.BLEInterface("AA:BB:CC:DD:EE:FF") # BLE interface
|
#interface=meshtastic.ble_interface.BLEInterface("AA:BB:CC:DD:EE:FF") # BLE interface
|
||||||
|
|
||||||
#A list of strings to trap and respond to
|
# A basic list of strings to trap and respond to
|
||||||
trap_list = ("ping", "ack", "testing", "pong", "motd", "help", "sun", "solar", "hfcond", "lheard", "sitrep", \
|
trap_list = ("ping", "ack", "testing", "pong", "motd", "help", "lheard", "sitrep", "joke")
|
||||||
"whereami", "tide", "moon", "wx", "wxc", "joke", "bbslist", "bbspost", "bbsread", "bbsdelete", "bbshelp")
|
|
||||||
|
# join all lists, comment out unwanted funtionality, defined in corresponding files/modules
|
||||||
|
trap_list = trap_list + trap_list_location
|
||||||
|
trap_list = trap_list + trap_list_conditions
|
||||||
|
trap_list = trap_list + trap_list_bbs
|
||||||
|
|
||||||
welcome_message = "MeshBot, here for you like a friend who is not. Try sending: ping @foo or, help"
|
welcome_message = "MeshBot, here for you like a friend who is not. Try sending: ping @foo or, help"
|
||||||
help_message = "Commands are: ack, hfcond, joke, Lheard, moon, motd, ping, solar, sun, tide, whereami, wx, bbshelp"
|
help_message = "Commands are: ack, hfcond, joke, Lheard, moon, motd, ping, solar, sun, tide, whereami, wx, bbshelp"
|
||||||
|
|||||||
+3
-1
@@ -14,6 +14,8 @@ LONGITUDE = -123.0
|
|||||||
|
|
||||||
URL_TIMEOUT = 10 # wait time for URL requests
|
URL_TIMEOUT = 10 # wait time for URL requests
|
||||||
|
|
||||||
|
trap_list_conditions = ("sun", "solar", "hfcond")
|
||||||
|
|
||||||
def hf_band_conditions():
|
def hf_band_conditions():
|
||||||
# ham radio HF band conditions
|
# ham radio HF band conditions
|
||||||
hf_cond = ""
|
hf_cond = ""
|
||||||
@@ -123,4 +125,4 @@ def get_moon(lat=0, lon=0):
|
|||||||
"\nPhase:" + moon_table['phase'] + " @:" + str('{0:.2f}'.format(moon_table['illumination'])) + "%" \
|
"\nPhase:" + moon_table['phase'] + " @:" + str('{0:.2f}'.format(moon_table['illumination'])) + "%" \
|
||||||
+ "\nFull Moon:" + moon_table['next_full_moon'] + "\nNew Moon:" + moon_table['next_new_moon']
|
+ "\nFull Moon:" + moon_table['next_full_moon'] + "\nNew Moon:" + moon_table['next_new_moon']
|
||||||
|
|
||||||
return moon_data
|
return moon_data
|
||||||
|
|||||||
Reference in New Issue
Block a user