aboutsummaryrefslogtreecommitdiffstats
path: root/powerButtons.py
diff options
context:
space:
mode:
Diffstat (limited to 'powerButtons.py')
-rw-r--r--powerButtons.py20
1 files changed, 14 insertions, 6 deletions
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