aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2026-06-18 17:26:06 +0100
committerjwansek <eddie.atten.ea29@gmail.com>2026-06-18 17:26:06 +0100
commit29770b708616e3c6379b17350baf74c2dd79a52e (patch)
treef6843bedc65f005d04902e352175a2658d1fde66
parent1c6265bffd7390672ac33357639438c4682fbc2d (diff)
downloadHomelabPowerButtons-29770b708616e3c6379b17350baf74c2dd79a52e.tar.gz
HomelabPowerButtons-29770b708616e3c6379b17350baf74c2dd79a52e.zip
Added spec for pyinstaller
-rw-r--r--Assets/icon.icobin0 -> 177356 bytes
-rw-r--r--Assets/icon.pngbin0 -> 21864 bytes
-rw-r--r--powerButtons.py20
-rw-r--r--requirements.txt3
4 files changed, 17 insertions, 6 deletions
diff --git a/Assets/icon.ico b/Assets/icon.ico
new file mode 100644
index 0000000..e5fcb3c
--- /dev/null
+++ b/Assets/icon.ico
Binary files differ
diff --git a/Assets/icon.png b/Assets/icon.png
new file mode 100644
index 0000000..a720fed
--- /dev/null
+++ b/Assets/icon.png
Binary files differ
diff --git a/powerButtons.py b/powerButtons.py
index 065702b..2e0d4fe 100644
--- a/powerButtons.py
+++ b/powerButtons.py
@@ -29,6 +29,7 @@ class App(tk.Tk):
super().__init__(*args, **kwargs)
self.title("Power Buttons")
self.protocol("WM_DELETE_WINDOW", self._on_closing)
+ self.iconbitmap(os.path.join(os.path.dirname(__file__), "Assets", "icon.ico"))
self.config = configparser.ConfigParser()
self.config.read(config_path)
@@ -41,8 +42,6 @@ class App(tk.Tk):
self.mqttc.username_pw_set(self.config["zigbee"]["mqtt_username"], password = self.config["zigbee"]["mqtt_password"])
self.mqttc.connect(self.config["zigbee"]["mqtt_host"], 1883, 60)
- tk.Button(self, text = "sneed", command = lambda: print("sneed")).pack()
-
self.img_green = tk.PhotoImage(file = os.path.join(os.path.dirname(__file__), "Assets", "green.png"))
self.img_yellow = tk.PhotoImage(file = os.path.join(os.path.dirname(__file__), "Assets", "yellow.png"))
self.img_red = tk.PhotoImage(file = os.path.join(os.path.dirname(__file__), "Assets", "red.png"))
@@ -210,7 +209,16 @@ def send_raw_tasmota_http(host, password, command):
return req.json()
if __name__ == "__main__":
- app = App(sys.argv[1])
- app.mainloop()
-
- # print(tasmota_query_to_fields(query_tasmota_power("geoffery.plug", "securebackdoor"))) \ No newline at end of file
+ places_to_look = [
+ os.path.dirname(__file__),
+ os.path.expanduser("~"),
+ os.getcwd()
+ ]
+
+ for p in places_to_look:
+ fp = os.path.join(p, "powerButtons.ini")
+ if os.path.exists(fp):
+ app = App(fp)
+ app.mainloop()
+
+ print("Couldn't find a config file :c") \ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..33c28be
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,3 @@
+requests
+paho-mqtt==1.6.1
+pyinstaller