aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-10-05 23:46:01 +1300
committerArslaan Pathan <[email protected]>2026-10-05 23:46:01 +1300
commita216de8b33c880472fd94ab31000960a1bf0fe0c (patch)
tree63fb472a570c47476e4e22b63451eeea9372f6f2
parent0b8dd7f240dafc5fe51e604cb73fa4f52a674672 (diff)
downloadremote-automation-a216de8b33c880472fd94ab31000960a1bf0fe0c.tar.xz
remote-automation-a216de8b33c880472fd94ab31000960a1bf0fe0c.zip
http function
-rw-r--r--main.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/main.py b/main.py
index 55c12b9..0fca35e 100644
--- a/main.py
+++ b/main.py
@@ -1,13 +1,18 @@
from evdev import InputDevice, list_devices, ecodes
+from urllib.request import urlopen
SCANCODES = {0x11A: "up", 0x148: "down", 0x147: "left", 0x107: "right", 0x106: "ok", 0x141: "play/pause", 0x11c: "power", 0x103: "vol+", 0x142: "vol-"}
device = None
last = 0x00
+def homelab_request(request: str):
+ with urlopen(f"http://192.168.1.96/automate/{request}") as resp:
+ print(f"homelab request {request} response {resp.status}")
+
def do_action(action: str):
if action == "ok":
- print("ok")
+ homelab_request("hack_this_club") # /j
for path in list_devices():
candidate = InputDevice(path)