{"id":24990819,"url":"https://github.com/ccoors/valegram-bot","last_synced_at":"2025-04-12T01:52:20.540Z","repository":{"id":53930684,"uuid":"454430119","full_name":"ccoors/valegram-bot","owner":"ccoors","description":"A Valetudo Telegram Bot","archived":false,"fork":false,"pushed_at":"2022-08-06T15:10:22.000Z","size":294,"stargazers_count":16,"open_issues_count":2,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-12T01:52:16.685Z","etag":null,"topics":["telegram","telegram-bot","valetudo"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ccoors.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-01T14:57:58.000Z","updated_at":"2025-01-10T10:27:01.000Z","dependencies_parsed_at":"2022-08-13T04:50:12.466Z","dependency_job_id":null,"html_url":"https://github.com/ccoors/valegram-bot","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccoors%2Fvalegram-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccoors%2Fvalegram-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccoors%2Fvalegram-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccoors%2Fvalegram-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ccoors","download_url":"https://codeload.github.com/ccoors/valegram-bot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505873,"owners_count":21115354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["telegram","telegram-bot","valetudo"],"created_at":"2025-02-04T13:39:04.535Z","updated_at":"2025-04-12T01:52:20.521Z","avatar_url":"https://github.com/ccoors.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# valegram-bot\n\n![CI](https://github.com/ccoors/valegram-bot/actions/workflows/ci.yml/badge.svg)\n\n_A Telegram Bot for [Valetudo](https://valetudo.cloud)_\n\nThis bot allows controlling a Valetudo instance via Telegram. It runs directly on the vacuum robot, using the runtime\nprovided by Valetudo.\n\nPlease note that this bot is in its very early stages of development and is targeted at more technically inclined users.\n\nThis bot uses the Valetudo HTTP-API v2. Support for MQTT is not (yet?) implemented.\n\n| ![screenshot](assets/screenshot_1.png) | ![screenshot](assets/screenshot_2.png) |\n| -------------------------------------- | -------------------------------------- |\n| ![screenshot](assets/screenshot_3.png) | ![screenshot](assets/screenshot_4.png) |\n| ![screenshot](assets/screenshot_5.png) |\n\n## Installation\n\nInstallation is a bit complicated, due to how Telegram Bots work.\n\n### Step 1: Create Telegram Bot\n\nCreate a Telegram Bot using [Botfather](https://core.telegram.org/bots#6-botfather). Remember the `token`. Start the bot\nby adding it to your contacts and clicking the \"Start\" button.\n\n### Step 2: Download valegram-bot\n\nDownload the latest valegram-bot release to your robot. Run this command, adjusting `v0.1.2` to the latest\nrelease.\n\n#### Dreame\n```shell\ncd /data\nwget -O valegram-bot.js https://github.com/ccoors/valegram-bot/releases/download/v0.1.2/valegram-bot.js\n```\n\n#### Roborock\n```shell\nmkdir /mnt/data/valegram\ncd /mnt/data/valegram\nwget -O valegram-bot.js https://github.com/ccoors/valegram-bot/releases/download/v0.1.2/valegram-bot.js\n```\n\n### Step 3: Setup valegram-bot\n\nStart the bot directly from the shell. Replace `$$$BOT_TOKEN$$$` with the token obtained from BotFather earlier.\n\n#### Dreame\n```shell\nPKG_EXECPATH=PKG_INVOKE_NODEJS VALEGRAM_BOT_TOKEN=\"$$$BOT_TOKEN$$$\" ./valetudo valegram-bot.js\n```\n\n#### Roborock\n```shell\nPKG_EXECPATH=PKG_INVOKE_NODEJS VALEGRAM_BOT_TOKEN=\"$$$BOT_TOKEN$$$\" /usr/local/bin/valetudo /mnt/data/valegram/valegram-bot.js\n```\n\nThe bot needs to know which chats to respond to - otherwise everybody could control your robot. You can use\nthe `/chat_id` command in Telegram to get your chat id (eg. `104325692`).\n\nTry it out!\n#### Dreame\n```shell\nPKG_EXECPATH=PKG_INVOKE_NODEJS VALEGRAM_BOT_TOKEN=\"$$$BOT_TOKEN$$$\" CHAT_IDS='[$$$CHAT_ID$$$]' ./valetudo valegram-bot.js\n```\n\n#### Roborock\n```shell\nPKG_EXECPATH=PKG_INVOKE_NODEJS VALEGRAM_BOT_TOKEN=\"$$$BOT_TOKEN$$$\" CHAT_IDS='[$$$CHAT_ID$$$]' /usr/local/bin/valetudo /mnt/data/valegram/valegram-bot.js\n```\n\n#### Dreame\nStop the bot (CTRL+C) and add it to your autostart script (`/data/_root_postboot.sh` on Dreame). I suggest extending the\nfinal if-block like this (replace `$$$CHAT_ID$$$` with your chat id):\n\n```\nif [[ -f /data/valetudo ]]; then\n        VALETUDO_CONFIG_PATH=/data/valetudo_config.json /data/valetudo \u003e /dev/null 2\u003e\u00261 \u0026\n        sleep 30\n        PKG_EXECPATH=PKG_INVOKE_NODEJS VALEGRAM_BOT_TOKEN=\"$$$BOT_TOKEN$$$\" CHAT_IDS='[$$$CHAT_ID$$$]' /data/valetudo /data/valegram-bot.js \u003e /tmp/valegram-log.log 2\u003e\u00261 \u0026\nfi\n```\n\nAlternatively, create a wrapper shell-script, which may prove more to be maintainable in the future.\n\n#### Roborock\nStop the bot (CTRL+C) and create an autostart script:\n\n```shell\ncd /etc/init\ntouch S999valegram\nchmod +x S999valegram\n```\n\nEdit the script with nano `nano S999valegram` and add the folowing script (replace `$$$BOT_TOKEN$$$` and `$$$CHAT_ID$$$`).\n```bash\n#!/bin/sh\n\nexport PKG_EXECPATH=PKG_INVOKE_NODEJS\nexport VALEGRAM_BOT_TOKEN=\"$$$BOT_TOKEN$$$\"\nexport CHAT_IDS='[$$$CHAT_ID$$$]'\n\nload() {\n    echo \"starting valegram, process will be ready in about 35 seconds.\"\n    start-stop-daemon -S -b -q -m -p /var/run/valegram.pid -x bash -- -c 'sleep 30; /usr/local/bin/valetudo /mnt/data/valegram/valegram-bot.js'\n}\n\nunload() {\n    echo \"stopping valegram\"\n    start-stop-daemon -K -q -p /var/run/valegram.pid\n}\n\ncase \"$1\" in\n    start)\n        load\n        ;;\n    stop)\n        unload\n        ;;\n    restart)\n        unload\n        load\n        ;;\n    *)\n        echo \"$0 \u003cstart/stop/restart\u003e\"\n        ;;\nesac\n```\n\nYou can try starting the valegram service (startup is delayed by 30 seconds):\n```\n/etc/init/S999valegram start\n```\n\nIf everything works, valegram should start on startup of your robot.\n\n\n### Step 5: Add commands to BotFather (optional)\n\nRun the `/help` command in Telegram. Remove the `/` from each line, use `/setcommands` in BotFather and set the command block.\n\n## Configuration\n\nvalegram-bot is configured through environment variables.\n\n| Variable                 | Description                                                                                                                                                                                         | Default             |\n| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- |\n| `VALEGRAM_BOT_TOKEN`     | The bot token                                                                                                                                                                                       | `\"\"`                |\n| `VALETUDO_URL`           | The URL Valetudo can be reached under                                                                                                                                                               | `http://localhost/` |\n| `VALETUDO_HTTP_TIMEOUT`  | The timeout for HTTP requests to Valetudo                                                                                                                                                           | `10_000`            |\n| `VALETUDO_AUTH_USERNAME` | The username for HTTP-Basic-Auth                                                                                                                                                                    | `\"\"`                |\n| `VALETUDO_AUTH_PASSWORD` | The password for HTTP-Basic-Auth                                                                                                                                                                    | `\"\"`                |\n| `CHAT_IDS`               | The chat ids valegram-bot should respond to. JSON array of numbers.                                                                                                                                 | `[]`                |\n| `ICBINV_URL`             | If you run [ICBINV](https://github.com/Hypfer/ICantBelieveItsNotValetudo) with an enabled webserver, set the URL to `ICBINV_URL=http://ICBINV_HOST:3000/api/map/image` to enable the `/map` command | `\"\"`                |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccoors%2Fvalegram-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fccoors%2Fvalegram-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccoors%2Fvalegram-bot/lists"}