Plain log and remote node control #87

Closed
opened 2026-10-05 03:20:31 +02:00 by adam · 3 comments
Owner

Hi.

Looks like a great app for the cli and meshtastic.

  1. Is there any way to set the app for the plain logging of chats?
    I would like to use my parser script to repost messages into telegram messenger channel.

  2. Is there any plan to add ability to change settings and favourites of the remote node allowed for administration?

Hi. Looks like a great app for the cli and meshtastic. 1. Is there any way to set the app for the plain logging of chats? I would like to use my parser script to repost messages into telegram messenger channel. 2. Is there any plan to add ability to change settings and favourites of the remote node allowed for administration? <!-- github-sync-id:4393625533 -->
adam closed this issue 2026-10-05 03:20:31 +02:00
Author
Owner

Hello, thanks for checking it out!

  1. Currently everything is stored in a sqllite db, which could easily be accessed by another script. It might be a little tricky if you switch nodes, as each node has it's own table in the db. I don't have plans to save as plain text. I do have plans to eventually migrate to using the meshdb library to store everything, which could be a breaking change for anything that reads the contact clientdb...
Image
  1. #150 could address this but truthfully I haven't explored adding remote admin at all yet. I think it would be super handy though!
Hello, thanks for checking it out! 1. Currently everything is stored in a sqllite db, which could easily be accessed by another script. It might be a little tricky if you switch nodes, as each node has it's own table in the db. I don't have plans to save as plain text. I do have plans to _eventually_ migrate to using the [meshdb library ](https://github.com/pdxlocations/meshdb) to store everything, which could be a breaking change for anything that reads the contact clientdb... <img width="991" height="308" alt="Image" src="https://github.com/user-attachments/assets/fefc9ac6-459c-4a67-9750-679bf4f290ea" /> 2. #150 could address this but truthfully I haven't explored adding remote admin at all yet. I think it would be super handy though! <!-- github-comment-id:4391939219 -->
Author
Owner

I do have plans to eventually migrate to using the meshdb library to store everything

so no plans for plain log, instead i do need some script parsing from sqlite for teegram translation?

> I do have plans to eventually migrate to using the [meshdb library ](https://github.com/pdxlocations/meshdb)to store everything so no plans for plain log, instead i do need some script parsing from sqlite for teegram translation? <!-- github-comment-id:4406888113 -->
Author
Owner

i do need some script parsing from sqlite for teegram translation?

Yes, that would be outside the scope of this project. You would need something like:

import sqlite3
import time
import requests

DB = "client.db"
BOT_TOKEN = "YOUR_BOT_TOKEN"
CHAT_ID = "YOUR_CHAT_ID"

last_ts = 0

while True:
    conn = sqlite3.connect(DB)
    cur = conn.cursor()

    tables = cur.execute(
        "SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '%_messages'"
    ).fetchall()

    for (table,) in tables:
        rows = cur.execute(
            f'SELECT user_id, message_text, timestamp FROM "{table}" WHERE timestamp > ? ORDER BY timestamp',
            (last_ts,),
        ).fetchall()

        for user_id, msg, ts in rows:
            text = f"{table}: {user_id}: {msg}"
            requests.post(
                f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage",
                data={"chat_id": CHAT_ID, "text": text},
            )
            last_ts = max(last_ts, ts)

    conn.close()
    time.sleep(5)
> i do need some script parsing from sqlite for teegram translation? Yes, that would be outside the scope of this project. You would need something like: ``` import sqlite3 import time import requests DB = "client.db" BOT_TOKEN = "YOUR_BOT_TOKEN" CHAT_ID = "YOUR_CHAT_ID" last_ts = 0 while True: conn = sqlite3.connect(DB) cur = conn.cursor() tables = cur.execute( "SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '%_messages'" ).fetchall() for (table,) in tables: rows = cur.execute( f'SELECT user_id, message_text, timestamp FROM "{table}" WHERE timestamp > ? ORDER BY timestamp', (last_ts,), ).fetchall() for user_id, msg, ts in rows: text = f"{table}: {user_id}: {msg}" requests.post( f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage", data={"chat_id": CHAT_ID, "text": text}, ) last_ts = max(last_ts, ts) conn.close() time.sleep(5) ``` <!-- github-comment-id:4407554518 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/contact#87