hid-usb-relay 25.0.0__py3-none-any.whl → 26.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: hid-usb-relay
3
- Version: 25.0.0
3
+ Version: 26.0.0
4
4
  Summary: hid based usb relay package
5
5
  Keywords: Python,HID,USB,RELAY
6
6
  Author: chaitu-ycr
7
7
  Author-email: chaitu-ycr <chaitu.ycr@gmail.com>
8
8
  License: MIT License
9
9
 
10
- Copyright (c) 2025 chaitu-ycr
10
+ Copyright (c) 2026 chaitu-ycr
11
11
 
12
12
  Permission is hereby granted, free of charge, to any person obtaining a copy
13
13
  of this software and associated documentation files (the "Software"), to deal
@@ -33,16 +33,16 @@ Classifier: Programming Language :: Python :: 3.13
33
33
  Classifier: Programming Language :: Python :: 3.14
34
34
  Classifier: License :: OSI Approved :: MIT License
35
35
  Classifier: Operating System :: Microsoft :: Windows
36
- Requires-Dist: gradio
37
- Requires-Dist: fastapi[standard]
36
+ Classifier: Operating System :: POSIX :: Linux
37
+ Requires-Dist: nicegui[native]
38
38
  Requires-Python: >=3.10, <=3.14
39
- Project-URL: documentation, https://chaitu-ycr.github.io/automotive-test-kit/packages/hid_usb_relay
40
- Project-URL: homepage, https://github.com/chaitu-ycr/automotive-test-kit/tree/main/packages/hid_usb_relay
41
- Project-URL: repository, https://github.com/chaitu-ycr/automotive-test-kit
39
+ Project-URL: homepage, https://github.com/chaitu-ycr/hid-usb-relay
40
+ Project-URL: repository, https://github.com/chaitu-ycr/hid-usb-relay
41
+ Project-URL: documentation, https://chaitu-ycr.github.io/hid-usb-relay
42
42
  Description-Content-Type: text/markdown
43
43
 
44
44
  # hid_usb_relay
45
45
 
46
46
  hid based usb relay package
47
47
 
48
- ## [source manual](https://chaitu-ycr.github.io/automotive-test-kit/packages/hid_usb_relay/#source-manual)
48
+ ## [source manual](https://chaitu-ycr.github.io/hid-usb-relay/source-manual)
@@ -1,4 +1,5 @@
1
1
  hid_usb_relay/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ hid_usb_relay/app.py,sha256=kCbd-yN2hEAhllKbSMRVCplVVbf-IjdMYXhWvcKNUEo,26619
2
3
  hid_usb_relay/hid_usb_relay_bin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
4
  hid_usb_relay/hid_usb_relay_bin/linux/32bit/hidusb-relay-cmd,sha256=kZpUbPucCsGzHXizusMupgSMhfJhj9-As1E5gzLFtX4,17051
4
5
  hid_usb_relay/hid_usb_relay_bin/linux/64bit/hidusb-relay-cmd,sha256=RvWPyw5o0TPBqLcjZfc3iCBHodM9k_l5NrstWDTnr90,18759
@@ -8,8 +9,7 @@ hid_usb_relay/hid_usb_relay_bin/windows/32bit/hidusb-relay-cmd.exe,sha256=uhuw_p
8
9
  hid_usb_relay/hid_usb_relay_bin/windows/64bit/GUIapp.exe,sha256=HxUtZEguzAV41H3CQfAG6EbiOVChJxgjWj_0IHCaJvI,69632
9
10
  hid_usb_relay/hid_usb_relay_bin/windows/64bit/USB_RELAY_DEVICE.dll,sha256=vcbH-kbY6QCWRYGQ-EiRCIoXgIgZlckc0pHXoU9eJIE,86528
10
11
  hid_usb_relay/hid_usb_relay_bin/windows/64bit/hidusb-relay-cmd.exe,sha256=wknn0l05jSHsvmwKrFlit2p8gPMbQP3LkV_5gwjmWTs,92672
11
- hid_usb_relay/rest_api.py,sha256=5HzVPE5WAkVg2M_w7-0YFUvCnsGMTp8pDO91Vg2iI1o,4644
12
- hid_usb_relay/usb_relay.py,sha256=B5lnTDhMQjjhFzg9sIVeGC-08gy7CEUvm9tP5k4uFVg,6418
13
- hid_usb_relay-25.0.0.dist-info/WHEEL,sha256=5h_Q-_6zWQhhADpsAD_Xpw7gFbCRK5WjOOEq0nB806Q,79
14
- hid_usb_relay-25.0.0.dist-info/METADATA,sha256=fw-zZoVFpzMJELZcZsZqMe8W9mCb_Y9NymAgiwaYijE,2375
15
- hid_usb_relay-25.0.0.dist-info/RECORD,,
12
+ hid_usb_relay/usb_relay.py,sha256=tIc3HyAaCTeUNKtuWfLtg5S8EzM60jjqYzySzcRIAaY,17455
13
+ hid_usb_relay-26.0.0.dist-info/WHEEL,sha256=XV0cjMrO7zXhVAIyyc8aFf1VjZ33Fen4IiJk5zFlC3g,80
14
+ hid_usb_relay-26.0.0.dist-info/METADATA,sha256=MNDZxxAqJfvuoEzgsAc6ubu6l1uIs0jZaIk1V0rk0J0,2294
15
+ hid_usb_relay-26.0.0.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: uv 0.8.18
2
+ Generator: uv 0.9.26
3
3
  Root-Is-Purelib: true
4
- Tag: py3-none-any
4
+ Tag: py3-none-any
hid_usb_relay/rest_api.py DELETED
@@ -1,116 +0,0 @@
1
- import socket
2
- import uvicorn
3
- import logging
4
- from fastapi import FastAPI, HTTPException
5
- from fastapi.responses import HTMLResponse
6
-
7
- from hid_usb_relay.usb_relay import (
8
- set_relay_device_state,
9
- set_relay_device_relay_state,
10
- get_relay_device_state,
11
- get_relay_device_relay_state,
12
- set_default_relay_device_state,
13
- set_default_relay_device_relay_state,
14
- get_default_relay_device_state,
15
- get_default_relay_device_relay_state,
16
- )
17
-
18
- app = FastAPI()
19
-
20
- logging.basicConfig(level=logging.INFO)
21
-
22
- helper_text = """
23
- <h1>YCR HID USB Relay Web API</h1>
24
- <h2>Endpoints</h2>
25
- <ul>
26
- <li><b>/</b> ➖ This page</li>
27
- <li><b>/relay/1/on</b> ➖ Turn ON Relay 1 of Default Relay Device</li>
28
- <li><b>/relay/2/off</b> ➖ Turn OFF Relay 2 of Default Relay Device</li>
29
- <li><b>/relay/all/on</b> ➖ Turn ON all Relays of Default Relay Device</li>
30
- <li><b>/relay/all/off</b> ➖ Turn OFF all Relays of Default Relay Device</li>
31
- <li><b>/relay/HURTM/1/on</b> ➖ Turn ON Relay 1 of Relay Id "HURTM"</li>
32
- <li><b>/relay/HURTM/2/off</b> ➖ Turn OFF Relay 2 of Relay Id "HURTM"</li>
33
- <li><b>/relay/HURTM/all/on</b> ➖ Turn ON all Relays of Relay Id "HURTM"</li>
34
- <li><b>/relay/HURTM/all/off</b> ➖ Turn OFF all Relays of Relay Id "HURTM"</li>
35
- </ul>
36
- """
37
-
38
- @app.get("/", response_class=HTMLResponse)
39
- def root_page_help() -> str:
40
- """
41
- Provides help text for the root page.
42
-
43
- Returns:
44
- str: The help text for the root page.
45
- """
46
- return helper_text
47
-
48
- @app.get("/relay/{relay_id}/{relay_number}/{relay_state}")
49
- def relay_control_by_id(relay_id: str, relay_number: str, relay_state: str) -> dict:
50
- """
51
- Controls the state of a relay by its ID and relay number.
52
-
53
- Args:
54
- relay_id (str): The ID of the relay device.
55
- relay_number (str): The number of the relay to control. Use "all" to control all relays.
56
- relay_state (str): The desired state of the relay (e.g., "on", "off").
57
-
58
- Returns:
59
- dict: A dictionary containing the status of the operation and the current state of the relay.
60
-
61
- Raises:
62
- HTTPException: If the relay state could not be set or if an internal server error occurs.
63
- """
64
- try:
65
- if relay_number.lower() == "all":
66
- ret_val = set_relay_device_state(relay_id, relay_state.upper())
67
- else:
68
- ret_val = set_relay_device_relay_state(relay_id, relay_number, relay_state.upper())
69
-
70
- if ret_val:
71
- if relay_number.lower() == "all":
72
- response_text = get_relay_device_state(relay_id)
73
- else:
74
- response_text = get_relay_device_relay_state(relay_id, relay_number)
75
- return {"status": "success", "relay_state": response_text}
76
- else:
77
- raise HTTPException(status_code=400, detail="Failed to set relay state. Check command.")
78
- except Exception as e:
79
- logging.error(f"Error in relay_control_by_id: {e}")
80
- raise HTTPException(status_code=500, detail="Internal Server Error")
81
-
82
- @app.get("/relay/{relay_number}/{relay_state}")
83
- def default_relay_control(relay_number: str, relay_state: str) -> dict:
84
- """
85
- Controls the state of a relay or all relays on the default relay device.
86
-
87
- Args:
88
- relay_number (str): The relay number to control. Use "all" to control all relays.
89
- relay_state (str): The desired state of the relay(s). Typically "on" or "off".
90
-
91
- Returns:
92
- dict: A dictionary containing the status of the operation and the current state of the relay(s).
93
-
94
- Raises:
95
- HTTPException: If the relay state could not be set or if an internal error occurs.
96
- """
97
- try:
98
- if relay_number.lower() == "all":
99
- ret_val = set_default_relay_device_state(relay_state.upper())
100
- else:
101
- ret_val = set_default_relay_device_relay_state(relay_number, relay_state.upper())
102
-
103
- if ret_val:
104
- if relay_number.lower() == "all":
105
- response_text = get_default_relay_device_state()
106
- else:
107
- response_text = get_default_relay_device_relay_state(relay_number)
108
- return {"status": "success", "relay_state": response_text}
109
- else:
110
- raise HTTPException(status_code=400, detail="Failed to set relay state. Check command.")
111
- except Exception as e:
112
- logging.error(f"Error in default_relay_control: {e}")
113
- raise HTTPException(status_code=500, detail="Internal Server Error")
114
-
115
- if __name__ == "__main__":
116
- uvicorn.run(app, host=socket.getfqdn(), port=9400)