|
@@ -3,11 +3,11 @@
|
3
|
3
|
Simple MQTT bridge in the form of a Telegram Bot.
|
4
|
4
|
And also my first attempt at doing something with Go.
|
5
|
5
|
|
6
|
|
-## Getting Started
|
|
6
|
+## Configuration
|
7
|
7
|
|
8
|
8
|
First register a new Bot with the Telegram, as [described in the docs](https://core.telegram.org/bots#6-botfather), to get your API key.
|
9
|
9
|
|
10
|
|
-Then simply run lights-telegram once manually.
|
|
10
|
+Then simply run lights-telegram once manually using `go run .`.
|
11
|
11
|
This will create a `config.yaml` file in the same directory.
|
12
|
12
|
Your API key goes in there, as well as the MQTT credentials.
|
13
|
13
|
|
|
@@ -20,10 +20,32 @@ Now this admin account can add further user authorizations using chat messages t
|
20
|
20
|
As an admin use `/register` to add new MQTT topics and their possible values to the menu.
|
21
|
21
|
Finally run `/commandlist` on the bot to get a nicely formatted command list which you can then give to the `/setcommands` command of BotFather.
|
22
|
22
|
|
|
23
|
+## Installation
|
|
24
|
+
|
|
25
|
+Run `go build` to produce an executable in the project directory.
|
|
26
|
+
|
|
27
|
+You now need to decide on an installation location for both the executable as well as the configuration file.
|
|
28
|
+As an example, I'll be using `~/bin/lights-telegram/` as the install directory.
|
|
29
|
+
|
|
30
|
+You also need to decide which user will run the server.
|
|
31
|
+It needs write access to the directory / config file.
|
|
32
|
+In this example we'll also be using the current user, `thomas` in my case.
|
|
33
|
+
|
|
34
|
+Modify the username and paths in `lights-telegram.service` and the commands below as required.
|
|
35
|
+
|
|
36
|
+ CGO_ENABLED=0 go build
|
|
37
|
+ mkdir ~/bin/lights-telegram
|
|
38
|
+ cp lights-telegram ~/bin/lights-telegram/lights-telegram
|
|
39
|
+ cp config.yaml ~/bin/lights-telegram/config.yaml
|
|
40
|
+ cp lights-telegram.service /etc/systemd/system/lights-telegram.service
|
|
41
|
+ systemctl daemon-reload
|
|
42
|
+ systemctl enable --now lights-telegram
|
|
43
|
+
|
23
|
44
|
## Dependencies
|
24
|
45
|
|
25
|
46
|
* [tgbotapi](https://pkg.go.dev/github.com/go-telegram-bot-api/telegram-bot-api/v5)
|
26
|
47
|
* [mqtt](https://pkg.go.dev/github.com/eclipse/paho.mqtt.golang)
|
|
48
|
+ * [yaml](https://pkg.go.dev/gopkg.in/yaml.v3)
|
27
|
49
|
|
28
|
50
|
## License
|
29
|
51
|
|