Browse Source

giessomat telegram mqtt

Thomas Buck 2 years ago
parent
commit
4396318f6c

+ 23
- 1
input/projects/giessomat.md View File

@@ -5,7 +5,7 @@ position: 6
5 5
 git: https://git.xythobuz.de/thomas/giess-o-mat
6 6
 github: https://github.com/xythobuz/giess-o-mat
7 7
 date: 2021-03-29
8
-update: 2022-05-05
8
+update: 2022-11-27
9 9
 comments: true
10 10
 ---
11 11
 
@@ -528,6 +528,28 @@ lightgallery([
528 528
 ])
529 529
 %-->
530 530
 
531
+## Telegram Bot and MQTT API (November 2022)
532
+
533
+With increasing confidence in my machine I decided to add the ability to trigger watering cycles from external sources.
534
+The initial idea was to implement a Telegram bot that has a simple interface to trigger a "full-auto cycle" (described above).
535
+I did that using the [Universal-Arduino-Telegram-Bot library](https://github.com/witnessmenow/Universal-Arduino-Telegram-Bot).
536
+Unfortunately it really takes a long time to poll for new messages, between one and two seconds.
537
+Because I don't really use interrupts and handle all timings of valves and pumps in a busy-loop that also polls all available input methods, this causes quite noticable delays in both the UI as well as the timing of operations.
538
+But it works, and with long polling times the machine is still usable.
539
+
540
+<!--%
541
+lightgallery([
542
+    [ "img/giessomat_telegram.png", "Telegram bot interaction" ],
543
+])
544
+%-->
545
+
546
+I then also quickly whipped up a MQTT API using the [pubsubclient library](https://github.com/knolleary/pubsubclient).
547
+This has no poll timing problems, but of course it's also not possible to reach from outside my home network without some kind of VPN or so.
548
+
549
+<pre class="sh_sh">
550
+$ mosquitto_pub -h SERVER_IP -u MQTT_USER -P MQTT_PASS -t giessomat -m "auto 2 1,2"
551
+</pre>
552
+
531 553
 ## Links
532 554
 
533 555
 You can find [all the source code for the device itself](https://git.xythobuz.de/thomas/giess-o-mat) (both the UI and the Controller) as well as the OpenSCAD [design files for the 3D printed parts](https://git.xythobuz.de/thomas/3d-print-designs/src/branch/master/giessomat) on my [Gitea instance](https://git.xythobuz.de).

+ 1
- 1
static/css/style.css View File

@@ -30,7 +30,7 @@ s {
30 30
 }
31 31
 
32 32
 s:hover {
33
-  text-decoration: none;
33
+    text-decoration: none;
34 34
 }
35 35
 
36 36
 #nav {

BIN
static/img/giessomat_telegram.png View File


BIN
static/img/giessomat_telegram_small.png View File


Loading…
Cancel
Save