aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2023-11-19 15:53:09 +0000
committerjwansek <eddie.atten.ea29@gmail.com>2023-11-19 15:53:09 +0000
commit224c7385c9f2c0eafd7751bf8e100ab5d8c52345 (patch)
treee19c4ba8deabfd4132230792b17eeb56e6e93802
parent408fa00f2387d19995e078c66d8e3d1c75f473f1 (diff)
downloadpower.eda.gay-224c7385c9f2c0eafd7751bf8e100ab5d8c52345.tar.gz
power.eda.gay-224c7385c9f2c0eafd7751bf8e100ab5d8c52345.zip
Added MQTT broker, some instructions
-rw-r--r--.gitignore1
-rw-r--r--README.md16
-rw-r--r--docker-compose.yml17
-rw-r--r--mosquitto.conf5
4 files changed, 39 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 3de3c7a..b9c2983 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@ power.env
db.env
*.pub
*.pem
+.passwords
# Byte-compiled / optimized / DLL files
__pycache__/
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..c0323a0
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+# power.eda.gay
+
+Logs Tasmota-flashed power usage monitors to InfluxDB and Grafana using MQTT.
+
+## Setup
+
+- `touch .passwords`
+- `sudo docker-compose up -d`
+- `sudo docker exec -it poweredagay_mqtt_1 sh` Then in the container:
+ - `chmod 0700 /mosquitto/passwd_file`
+ - `chmod root:root /mosquitto/passwd_file`
+ - ` mosquitto_passwd -c /mosquitto/passwd_file user_name` Changing `user_name` as appropriate, then it will prompt for a password
+- `sudo docker-compose restart`
+- Test with the `mosquitto_sub` and `mosquitto_pub` commands, the name of the package on debian is `mosquitto-clients`
+- Change the config in the Tasmota MQTT web UI, then check the logs to make sure it connects nicely
+- I like to run `TelePeriod 30` in the Tasmota console to set it to send MQTT messages every 30 seconds, for example. The default is every 5 minutes I believe
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..daaeb5c
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,17 @@
+version: "3"
+
+services:
+ mqtt:
+ image: eclipse-mosquitto
+ ports:
+ - 1883:1883
+ - 9001:9001
+ volumes:
+ - ./mosquitto.conf:/mosquitto/config/mosquitto.conf
+ - ./.passwords://mosquitto/passwd_file
+ - mosquitto-data:/mosquitto/data
+ - mosquitto-logs:/mosquitto/log
+
+volumes:
+ mosquitto-data:
+ mosquitto-logs:
diff --git a/mosquitto.conf b/mosquitto.conf
new file mode 100644
index 0000000..7a37d54
--- /dev/null
+++ b/mosquitto.conf
@@ -0,0 +1,5 @@
+password_file /mosquitto/passwd_file
+allow_anonymous false
+
+# MQTT Default listener
+listener 1883 0.0.0.0