diff --git a/README.md b/README.md
index a04634553b68f749dab3eeaf89c1627aaff8e4f7..bd63bdb20f31d823085f5a9d87c64f7901adcdff 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1 @@
 # Luanti LED Tree
-
-You have to add the mod to the trusted mods in minetest.conf:
-
-secure.http_mods = ledtree
diff --git a/init.lua b/init.lua
index 17e9b2ec528679b40ba5a594538292e9cd9003e4..76159357994c3222666817204dcc00dd62b735ef 100644
--- a/init.lua
+++ b/init.lua
@@ -2,40 +2,79 @@
 --
 -- SPDX-License-Identifier: GPL-3.0-or-later
 
-local HTTPApiTable = core.request_http_api()
+local modname = core.get_current_modname()
+local modpath = core.get_modpath(modname)
 
 local data = {
-    url = "https://mqtt.felix-zauberer.de:443",
+    url = "mqtt.felix-zauberer.de",
     clientId = "ledtree_luanti",
     username = "kalle1",
-    token = "eZcKn1zBE6KtbeFnZ33lV1EKnr9Bcn8B",
+    password = "eZcKn1zBE6KtbeFnZ33lV1EKnr9Bcn8B",
 }
 
-change_color = function(led_id)
-    local request = {
-        url = data.url,
-        method = 'POST',
-        timeout = 15,
-        username = data.username,
-        clientId = data.clientId,
-        extra_headers = {
-            "Authorization: Bearer "..data.token,
-        }
-    }
-    HTTPApiTable.fetch(request, function(response)
-        print(dump(request))
-        if response.code ~= 200 then
-            return false
-        else
-            return true
-        end
-    end)
+local mqttBaseTopic = core.settings:get("ledtree_base_topic") or "ledtree"
+
+local client = mqtt.connect(data.url, data.clientId, data.username, data.password)
+
+local change_color = function(player, led_id)
+    local formspec = "size[3,3]" ..
+                     "image_button[0,0;1,1;red.png;red;red;false;false;]" ..
+                     "image_button[1,0;1,1;green.png;gren;green;false;false;]" ..
+                     "image_button[2,0;1,1;blue.png;blue;blue;false;false;]" ..
+                     "image_button[0,1;1,1;yellow.png;yellow;yellow;false;false;]" ..
+                     "image_button[1,1;1,1;cyan.png;cyan;cyan;false;false;]" ..
+                     "image_button[2,1;1,1;magenta.png;magenta;magenta;false;false;]" ..
+                     "image_button[0,2;1,1;white.png;white;white;false;false;]" ..
+                     "image_button[1,2;1,1;black.png;black;black;false;false;]" ..
+                     "image_button[2,2;1,1;gray.png;gray;gray;false;false;]"
+
+    core.show_formspec(player:get_player_name(), "ledtree:colorpicker", formspec)
+end
+
+local function send_mqtt(id, rgb)
+    mqtt.publish(client, mqttBaseTopic.."/led/"..id, "["..rgb.."]")
 end
 
 for id=1, 10, 1 do
     core.register_node("ledtree:led"..id, {
         description = "LED"..id,
         --tiles = "",
-        on_rightclick = change_color(id),
+        on_rightclick = function(pos, node, player, itemstack, pointed_thing)
+            change_color(player, id)
+        end,
     })
 end
+
+core.register_on_player_receive_fields(function(player, formname, fields)
+    if formname == "ledtree:colorpicker" then
+        for color, _ in pairs(fields) do
+            if color then
+                local rgb = ""
+                if color == "red" then
+                    rgb = "255,0,0"
+                elseif color == "green" then
+                    rgb = "0,255,0"
+                elseif color == "blue" then
+                    rgb = "0,0,255"
+                elseif color == "yellow" then
+                    rgb = "255,255,0"
+                elseif color == "cyan" then
+                    rgb = "0,255,255"
+                elseif color == "magenta" then
+                    rgb = "255,0,255"
+                elseif color == "white" then
+                    rgb = "255,255,255"
+                elseif color == "black" then
+                    rgb = "0,0,0"
+                elseif color == "gray" then
+                    rgb = "128,128,128"
+                end
+
+                if rgb ~= "" then
+                    core.chat_send_player(player:get_player_name(), "RGB: " .. rgb)
+                    send_mqtt(1, rgb)
+                end
+            end
+        end
+    end
+end)
diff --git a/mod.conf b/mod.conf
index d7d6ed58a2fdd8c69b5a2f9e9da924bb28103e66..77503c3ed05fe90c17656ab80b5f4e2ae6464afc 100644
--- a/mod.conf
+++ b/mod.conf
@@ -1,4 +1,5 @@
 name = ledtree
 title = Teckids LED-Weihnachtsbaum
 description = Teckids LED-Weihnachtsbaum
+depends = mqtt
 author = Tuxilio <mail@tuxil.io>
diff --git a/settingtypes.txt b/settingtypes.txt
new file mode 100644
index 0000000000000000000000000000000000000000..6c24e52100471203c34a69aca349932a000624f2
--- /dev/null
+++ b/settingtypes.txt
@@ -0,0 +1 @@
+ledtree_base_topic (Base topic (e.g. /[base_topic]/led/1)) string ledtree
diff --git a/textures/black.png b/textures/black.png
new file mode 100644
index 0000000000000000000000000000000000000000..d9e1417a7650a8f614768d3ba8813b7a2d5518c6
Binary files /dev/null and b/textures/black.png differ
diff --git a/textures/blue.png b/textures/blue.png
new file mode 100644
index 0000000000000000000000000000000000000000..b070f2dd5f37fd10a3b20a476fc505aa876a0dc6
Binary files /dev/null and b/textures/blue.png differ
diff --git a/textures/cyan.png b/textures/cyan.png
new file mode 100644
index 0000000000000000000000000000000000000000..1a7989147f98e8fdaee2d01ce9bb3b43f1ff20f3
Binary files /dev/null and b/textures/cyan.png differ
diff --git a/textures/gray.png b/textures/gray.png
new file mode 100644
index 0000000000000000000000000000000000000000..2f11ee97e6affeb88d069fbbbeaa308b84c1c65e
Binary files /dev/null and b/textures/gray.png differ
diff --git a/textures/green.png b/textures/green.png
new file mode 100644
index 0000000000000000000000000000000000000000..d9c634be1dad16c9a4bad6f1b7dc655a9816ee70
Binary files /dev/null and b/textures/green.png differ
diff --git a/textures/magenta.png b/textures/magenta.png
new file mode 100644
index 0000000000000000000000000000000000000000..edf8e7203dce11c800b15a9f76b5b039fdb5c886
Binary files /dev/null and b/textures/magenta.png differ
diff --git a/textures/red.png b/textures/red.png
new file mode 100644
index 0000000000000000000000000000000000000000..45b8162bdfe67026e12afb8f06126f83db8becfb
Binary files /dev/null and b/textures/red.png differ
diff --git a/textures/white.png b/textures/white.png
new file mode 100644
index 0000000000000000000000000000000000000000..20fd88347972bc0420fb4d83fa18576559eca54b
Binary files /dev/null and b/textures/white.png differ
diff --git a/textures/yellow.png b/textures/yellow.png
new file mode 100644
index 0000000000000000000000000000000000000000..c2ee4a7b914127fe51cb183ea9fa7848306ce0c2
Binary files /dev/null and b/textures/yellow.png differ