turbine-troubleshooter-bot
A Telegram bot for field technicians: search fault codes and spare parts, look up turbine info and IO board pin-outs, and browse reference content (text, documents, photos). Access is by approval, with admins who can add and edit codes and parts.
It is a Python package that a host application installs and starts, or that runs on its own. All site-specific content and documents are supplied by the host at runtime; nothing private lives in this repo.
Install
pip install turbine-troubleshooter-bot
The package installs as turbine-troubleshooter-bot and imports as turbine_troubleshooter.
Use
Inside a host application:
from turbine_troubleshooter import start_troubleshooter_bot, stop_troubleshooter_bot
await start_troubleshooter_bot(share_with=main_application, files_dir=Path("media"))
...
await stop_troubleshooter_bot()
share_with is optional: pass the host's Application when the host shows the troubleshooter menus too, so both bots use the same loaded codes, parts and users.
On its own (reads a .env in the current folder):
python -m turbine_troubleshooter
Standalone also uses TROUBLESHOOTER_FILES_DIR (default media) and TROUBLESHOOTER_SENTRY_DSN (Sentry is off when unset).
The settings below are read from the environment; any keyword passed to start_troubleshooter_bot() overrides the environment.
| Setting | Environment variable | Purpose |
|---|---|---|
name |
TROUBLESHOOTER_NAME |
Shown in menus and messages ("name Bot"). Default Troubleshooter |
wtg_prefix |
TROUBLESHOOTER_WTG_PREFIX |
Prefix for turbine IDs, e.g. WT turns A5 into WTA05 |
token |
TROUBLESHOOTER_BOT_TOKEN |
Bot token from @BotFather (see Create your Telegram bot) |
owner_id |
TROUBLESHOOTER_OWNER_ID |
Your Telegram user ID; the owner approves access and admins (how to find it) |
alerts_chat_id |
TROUBLESHOOTER_ALERTS_CHAT_ID |
Group or channel for new-user, access-request, suggestion and change notifications. Defaults to the owner's private chat (setting one up) |
timezone |
TROUBLESHOOTER_TIMEZONE |
Used for edit timestamps and weather. Default Europe/London |
cefas_buoy |
TROUBLESHOOTER_CEFAS_BUOY |
Cefas WaveNet buoy ID for sea state; enables 🌦 Weather |
windquest_location |
TROUBLESHOOTER_WINDQUEST_LOCATION |
Preferred WindQuest forecast location (falls back to the main location) |
windquest_api_key, windquest_api_token |
WINDQUEST_API_KEY, WINDQUEST_API_TOKEN |
WindQuest credentials for wind, lightning and tides |
files_dir |
— | Folder that file: references in the content resolve against |
content |
— | Fallback content when the database has none (see below) |
noise_filters |
— | Error messages to ignore. Defaults to common network blips |
Database
MySQL, via TROUBLESHOOTER_DB_URL, e.g. mysql://user:pass@host:3306/db. It's required: the bot won't start without it, and never falls back to a host's own JAWSDB_URL, so it can't end up writing to the host's database. Tables are created on first start: codes, parts, users, one table per IO board, content, settings, requests (access and admin requests waiting for the owner) and suggestions (content suggestions waiting for the owner).
Content suggestions
Approved users can suggest a note, a PDF or photo, or a file with text, from 📝 Suggest Content on the main menu. Text sent with a file is shown as its caption, so it's limited to Telegram's 1024 characters. It waits in Admin Panel → 📝 Suggestions until the owner approves or rejects it. Nothing reaches other users before that.
- Text goes live as soon as it's approved: the bot writes it into the
contenttable. - A PDF or photo adds its menu item straight away, pointing at a
file:path infiles_dir, and the bot sends the owner the file with the exact path to save it as. Until the file is uploaded, the item says the document isn't available. Files go in the host's files folder, as with any other document.
PDFs and photos can only be sent to the troubleshooter bot itself, up to 20 MB. A host showing the menus through share_with takes text suggestions only.
settings holds the owner's Notify Users toggles (notify_added, notify_edited, notify_deleted; on unless a row says 0), set from Admin Panel → 🔔 Notify Users. When one is off, that kind of code or part change is only sent to admins.
Content
The menus, turbine map, IO boards and part-search hints are loaded from the content table: one row per item (MODULES_MAP, WTG_MAP, IO_BOARDS, PART_ACCESSORIES), stored as JSON text. Documents and photos are referenced as file:<path relative to files_dir>. See turbine_troubleshooter/example_content.py for the shape.
Create your Telegram bot
Every copy of the bot needs its own bot account. A token can only be used by one running bot at a time, so two copies sharing one token get "Conflict" errors.
- In Telegram, open @BotFather and send
/newbot. - Give it a display name, for example
Site Troubleshooter. - Give it a username. It must be unique and end in
bot, for examplesite_troubleshooter_bot. - BotFather replies with a token that looks like
123456789:AAH.... Put it inTROUBLESHOOTER_BOT_TOKEN.
The token is a password: anyone who has it controls the bot. Never commit it or paste it in an issue. If it leaks, send /revoke to BotFather to get a new one.
Your Telegram user ID
The owner is set by user ID, not username. Message @userinfobot and it replies with your ID, a number like 123456789. Put it in TROUBLESHOOTER_OWNER_ID.
An alerts group or channel
Notifications go to the owner's private chat unless you set TROUBLESHOOTER_ALERTS_CHAT_ID. To send them to a group or channel instead:
- Add the bot to the group. For a channel, add it as an admin that can post messages; it can't post in a channel otherwise.
- Find the chat's ID. With the bot stopped, open
https://api.telegram.org/bot<your token>/getUpdatesin a browser and look for"chat":{"id":-100...from adding the bot. If the list is empty, remove the bot and add it again, then reload. - Put the ID, including the minus sign, in
TROUBLESHOOTER_ALERTS_CHAT_ID.
If the host's own bot is also in that group or channel, it receives the troubleshooter's alerts and edits as updates too. Make sure it ignores channel posts and edited channel posts (~filters.UpdateType.CHANNEL_POSTS in python-telegram-bot).
Run it yourself
You need Python 3.12+, a MySQL database and your own test bot (Create your Telegram bot). Your copy uses its own bot and database, so it never touches anyone else's.
Any MySQL works (a local install, or a free hosted one such as JawsDB). The docker run line below is the quickest way if you have Docker Desktop installed; skip it otherwise.
git clone https://github.com/Adz1DoubleD/turbine-troubleshooter-bot
cd turbine-troubleshooter-bot
python -m venv .venv
.venv\Scripts\activate # Mac/Linux: source .venv/bin/activate
pip install -e ".[dev]"
docker run -d --name ts-db -p 3306:3306 -e MYSQL_ROOT_PASSWORD=dev -e MYSQL_DATABASE=ts mysql:8
cp .env.example .env # Windows: copy .env.example .env
In .env, set these three (the bot refuses to start and lists any that are missing):
TROUBLESHOOTER_BOT_TOKEN: your test bot's token from @BotFather.TROUBLESHOOTER_OWNER_ID: your Telegram user ID.TROUBLESHOOTER_DB_URL: your MySQL database.
Everything else is optional. Access requests, content suggestions and change notices go to TROUBLESHOOTER_ALERTS_CHAT_ID, or to the owner when it isn't set. Then:
python -m turbine_troubleshooter
Open your test bot in Telegram and send /start. As the owner you get the admin panel. Tables are created on first start, and while the database has no content the menus use the made-up example_content.py. Add codes and parts from Admin Panel → Add Code / Add Part. Stop with Ctrl+C.
Development
pip install -e ".[dev]"
pre-commit run --all-files
pytest
CI fails if any document, image or spreadsheet file is committed, or if the package imports anything from a host application. See CONTRIBUTING.md for how to make a change.
Licence
MIT. The licence covers the code only; site content supplied by a host is not part of this repository.
Metadata
Release files for turbine-troubleshooter-bot 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| turbine_troubleshooter_bot-1.1.1.tar.gz | 65.4 kB | With provenance | Details for turbine_troubleshooter_bot-1.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| turbine_troubleshooter_bot-1.1.1-py3-none-any.whl | Python 3 | none | any | Details for turbine_troubleshooter_bot-1.1.1-py3-none-any.whl |
Total release size: 122.4 kB
Release files / turbine_troubleshooter_bot-1.1.1.tar.gz
| Download URL | turbine_troubleshooter_bot-1.1.1.tar.gz |
|---|---|
| Size | 65.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58dd722efbdb6ff97046d5677fa325faaf9620ac35ab1ddcd5c97a943db88b08
|
|
BLAKE2b-256 checksum How to use checksums |
d7df34873aeb379e0e1ee2aef8c4c8dd459cac76846126a2dbe52173c2501a5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logRelease files / turbine_troubleshooter_bot-1.1.1-py3-none-any.whl
| Download URL | turbine_troubleshooter_bot-1.1.1-py3-none-any.whl |
|---|---|
| Size | 56.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab4050609106eeaced757f8a71955be9c051bb14cc6bf33600830d647dbd6903
|
|
BLAKE2b-256 checksum How to use checksums |
2fe2364c416d007d4bde4aa43aa361a4acf4aa85245ae3e5802b753dd3d2b192
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logSecurity for turbine-troubleshooter-bot 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for turbine_troubleshooter_bot-1.1.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.