diff --git a/README.md b/README.md index 9de3c08..5899791 100644 --- a/README.md +++ b/README.md @@ -38,16 +38,23 @@ other features - `launch.sh` will activate and launch the app in the venv if built ### Configurations - Currently config modifications is edit to code. Be sure to uncomment the appropriate interface for your method (serial/BLE/TCP). Only one at a time is supported to a single node at a time. +Some config is via code, converting to `config.ini` set the appropriate interface for your method (serial/ble/tcp). + Only one at a time is supported to a single node at a time. ``` -# Uncomment the interface you want to use depending on your device connection -interface = meshtastic.serial_interface.SerialInterface() #serial interface -# you can specify SerialInterface('/dev/ttyUSB0') +#config.ini +# type can be serial, tcp, or ble +# port is the serial port to use, commented out will try to auto-detect +# hostname is the IP address of the device to connect to for tcp type +# mac is the MAC address of the device to connect to for ble type -#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] +type = serial +# port = '/dev/ttyUSB0' +# hostname = 192.168.0.1 +# mac = 00:11:22:33:44:55 ``` + The following pair of settings determine how to respond, default action is to not spam the default channel. Setting DM_ONLY will force all DM which may not be wanted. Setting the Default channel is the channel which wont be spammed by the bot. ``` diff --git a/mesh_bot.py b/mesh_bot.py index a46afa0..735587b 100755 --- a/mesh_bot.py +++ b/mesh_bot.py @@ -10,17 +10,13 @@ import meshtastic.tcp_interface import meshtastic.ble_interface from datetime import datetime from dadjokes import Dadjoke # pip install dadjokes +import configparser # Import all the functions from the modules in the repo if you want to use them otherwise make waffles # from modules.solarconditions import * # from the spudgunman/meshing-around repo from modules.locationdata import * # from the spudgunman/meshing-around repo from modules.bbstools import * # from the spudgunman/meshing-around repo -# Uncomment the interface you want to use depending on your device connection -interface = meshtastic.serial_interface.SerialInterface() #serial interface (specify port) default is first found -#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 - # A basic list of strings to trap and respond to trap_list = ("ping", "pinging", "ack", "testing", "pong", "motd", "cmd", "lheard", "sitrep", "joke") @@ -35,6 +31,7 @@ MOTD = "Thanks for using PongBOT! Have a good day!" # Message of the Day RESPOND_BY_DM_ONLY = False # Set to True to respond messages via DM only, False uses smart response DEFAULT_CHANNEL = 0 # Default channel on your node, also known as "public channel" 0 on new devices + #Get the node number of the device, check if the device is connected try: myinfo = interface.getMyNodeInfo()