mirror of
https://github.com/oasis6212/Meshbot_weather.git
synced 2025-12-10 00:06:12 -06:00
August Update 3
This commit is contained in:
parent
40727d1f7a
commit
2287f37254
12
meshbot.py
12
meshbot.py
@ -35,7 +35,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|||||||
SOFTWARE.
|
SOFTWARE.
|
||||||
"""
|
"""
|
||||||
print(r"""
|
print(r"""
|
||||||
-----------------Welcome to Meshbot Weather------------------
|
------------------------Welcome to Meshbot Weather-------------------------
|
||||||
|
For more info about this project visit https://github.com/oasis6212/Meshbot_weather
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
|
||||||
@ -386,7 +387,7 @@ def message_listener(packet, interface):
|
|||||||
if packet is not None and packet["decoded"].get("portnum") == "TEXT_MESSAGE_APP":
|
if packet is not None and packet["decoded"].get("portnum") == "TEXT_MESSAGE_APP":
|
||||||
message = packet["decoded"]["text"].lower()
|
message = packet["decoded"]["text"].lower()
|
||||||
sender_id = packet["from"]
|
sender_id = packet["from"]
|
||||||
|
|
||||||
# Check if it's a DM
|
# Check if it's a DM
|
||||||
is_direct_message = False
|
is_direct_message = False
|
||||||
if "to" in packet:
|
if "to" in packet:
|
||||||
@ -616,7 +617,7 @@ def signal_handler(sig, frame):
|
|||||||
def main():
|
def main():
|
||||||
global interface, alerts # Add alerts to global declaration
|
global interface, alerts # Add alerts to global declaration
|
||||||
signal.signal(signal.SIGINT, signal_handler)
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
|
||||||
logger.info("Starting program.")
|
logger.info("Starting program.")
|
||||||
reset_transmission_count()
|
reset_transmission_count()
|
||||||
if settings.get('DUTYCYCLE', False):
|
if settings.get('DUTYCYCLE', False):
|
||||||
@ -649,7 +650,7 @@ def main():
|
|||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
logger.info(f"Press CTRL-C to close the program")
|
logger.info(f"Press CTRL-C to close the program")
|
||||||
|
logger.info(f"Connecting to Meshtastic node...")
|
||||||
# Create interface
|
# Create interface
|
||||||
if args.host:
|
if args.host:
|
||||||
interface = meshtastic.tcp_interface.TCPInterface(hostname=ip_host, noProto=False)
|
interface = meshtastic.tcp_interface.TCPInterface(hostname=ip_host, noProto=False)
|
||||||
@ -658,6 +659,7 @@ def main():
|
|||||||
|
|
||||||
global MYNODE
|
global MYNODE
|
||||||
MYNODE = get_my_node_id(interface)
|
MYNODE = get_my_node_id(interface)
|
||||||
|
#logger.info("Connected to Meshtastic Node:")
|
||||||
logger.info(f"Automatically detected MYNODE ID: {MYNODE}")
|
logger.info(f"Automatically detected MYNODE ID: {MYNODE}")
|
||||||
|
|
||||||
if DM_MODE and not MYNODE:
|
if DM_MODE and not MYNODE:
|
||||||
@ -675,7 +677,7 @@ def main():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
my_info = interface.getMyNodeInfo()
|
my_info = interface.getMyNodeInfo()
|
||||||
logger.info("Connected to Meshtastic Node:")
|
# logger.info("Connected to Meshtastic Node:")
|
||||||
logger.info(f"Node Name: {my_info.get('user', {}).get('longName', 'Unknown')}")
|
logger.info(f"Node Name: {my_info.get('user', {}).get('longName', 'Unknown')}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to get node info: {e}")
|
logger.error(f"Failed to get node info: {e}")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user