TISControlProtocol 1.0.66__tar.gz → 1.0.67__tar.gz
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.
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/PKG-INFO +1 -1
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/pyproject.toml +1 -1
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/api.py +76 -30
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/.gitignore +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/.vscode/c_cpp_properties.json +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/.vscode/launch.json +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/.vscode/settings.json +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/.vscode/tasks.json +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/LICENSE +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/MANIFEST.in +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/README.md +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/dev/pump_version.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/BytesHelper.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/__init__.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/AckCoordinator.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketDispatcher.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketExtractor.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/AnalogFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/AutoBinaryFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/BinaryFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/ClimateBinaryFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/ClimateControlFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/ControlResponseHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/DiscoveryFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/EnergyFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/FloorBinaryFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/HealthFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/LunaTempFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/RealTimeFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/SearchResponseHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/SecurityFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/UpdateResponseHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/UpdateSecurityHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/WeatherFeedbackHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketHandlers/__init__.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketProtocol.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketReceiver.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/PacketSender.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/ProtocolHandler.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/UpdateCoordinator.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/udp/__init__.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/__init__.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/__init__.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/bill_config_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/change_password_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/get_bill_config_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/get_key_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/password_dashboard.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/password_form_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/passwords_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/restart_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/scan_devices_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/shared.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/submit_password.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/tis_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/update_endpoint.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/crc.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/logo.png +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/package-lock.json +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/package.json +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/postcss.config.mjs +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/public/__init__.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/public/dashboard.css +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/public/password_dashboard_loader.js +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/shared.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/views/__init__.py +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/views/password_dashboard/index.html +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/views/password_dashboard/styles.css +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/views/password_form/index.html +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/views/password_form/styles.css +0 -0
- {tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/tests/test.py +0 -0
|
@@ -32,13 +32,13 @@ from .apis import (
|
|
|
32
32
|
)
|
|
33
33
|
|
|
34
34
|
try:
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
from
|
|
35
|
+
import time
|
|
36
|
+
import spidev
|
|
37
|
+
import gpiod
|
|
38
|
+
from gpiod.line import Direction, Value
|
|
39
39
|
|
|
40
40
|
HAS_ST7789 = True
|
|
41
|
-
except (ImportError, RuntimeError
|
|
41
|
+
except (ImportError, RuntimeError) as e:
|
|
42
42
|
HAS_ST7789 = False
|
|
43
43
|
logging.error(
|
|
44
44
|
"Failed to load display dependencies. Display will be disabled. Error: %s", e
|
|
@@ -218,35 +218,62 @@ class TISApi:
|
|
|
218
218
|
"ram_percent": mem.percent,
|
|
219
219
|
}
|
|
220
220
|
|
|
221
|
+
def send_command(self, cmd):
|
|
222
|
+
self.gpio_request.set_value(23, Value.INACTIVE) # Command mode (0)
|
|
223
|
+
self.spi.xfer2([cmd])
|
|
224
|
+
|
|
225
|
+
def send_data(self, data):
|
|
226
|
+
self.gpio_request.set_value(23, Value.ACTIVE) # Data mode (1)
|
|
227
|
+
self.spi.xfer2(list(data))
|
|
228
|
+
|
|
229
|
+
def init_display(self):
|
|
230
|
+
# Hardware Reset
|
|
231
|
+
self.gpio_request.set_value(25, Value.INACTIVE)
|
|
232
|
+
time.sleep(0.1)
|
|
233
|
+
self.gpio_request.set_value(25, Value.ACTIVE)
|
|
234
|
+
time.sleep(0.1)
|
|
235
|
+
|
|
236
|
+
# ST7789 Initialization Sequence
|
|
237
|
+
self.send_command(0x11) # Sleep out
|
|
238
|
+
time.sleep(0.12)
|
|
239
|
+
|
|
240
|
+
self.send_command(0x3A) # Color mode 16-bit
|
|
241
|
+
self.send_data([0x55]) # 0x55 for RGB565
|
|
242
|
+
|
|
243
|
+
self.send_command(0x36) # Memory Access Control (MADCTL)
|
|
244
|
+
self.send_data([0x00]) # Normal rotation
|
|
245
|
+
|
|
246
|
+
self.send_command(0x29) # Display on
|
|
247
|
+
time.sleep(0.1)
|
|
248
|
+
|
|
249
|
+
def set_window(self, x1, y1, x2, y2):
|
|
250
|
+
self.send_command(0x2A) # Column Address Set
|
|
251
|
+
self.send_data([x1 >> 8, x1 & 0xFF, x2 >> 8, x2 & 0xFF])
|
|
252
|
+
|
|
253
|
+
self.send_command(0x2B) # Row Address Set
|
|
254
|
+
self.send_data([y1 >> 8, y1 & 0xFF, y2 >> 8, y2 & 0xFF])
|
|
255
|
+
|
|
221
256
|
def run_display(self, style="dots"):
|
|
222
257
|
try:
|
|
223
258
|
if HAS_ST7789:
|
|
224
|
-
#
|
|
225
|
-
spi =
|
|
226
|
-
|
|
227
|
-
#
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
self.display = st7789.ST7789(
|
|
240
|
-
spi,
|
|
241
|
-
cs=cs_pin,
|
|
242
|
-
dc=dc_pin,
|
|
243
|
-
rst=rst_pin,
|
|
244
|
-
baudrate=60000000,
|
|
245
|
-
width=320,
|
|
246
|
-
height=240,
|
|
247
|
-
rotation=0
|
|
259
|
+
# Initialize SPI Bus
|
|
260
|
+
self.spi = spidev.SpiDev()
|
|
261
|
+
self.spi.open(0, 0)
|
|
262
|
+
self.spi.max_speed_hz = 30 * 1000 * 1000 # 30 MHz (conservative and stable)
|
|
263
|
+
self.spi.mode = 0b00
|
|
264
|
+
|
|
265
|
+
# Open and request GPIO lines using gpiod v2 API
|
|
266
|
+
self.gpio_request = gpiod.request_lines(
|
|
267
|
+
"/dev/gpiochip0",
|
|
268
|
+
consumer="display",
|
|
269
|
+
config={
|
|
270
|
+
23: gpiod.LineSettings(direction=Direction.OUTPUT, output_value=Value.INACTIVE),
|
|
271
|
+
25: gpiod.LineSettings(direction=Direction.OUTPUT, output_value=Value.ACTIVE),
|
|
272
|
+
12: gpiod.LineSettings(direction=Direction.OUTPUT, output_value=Value.ACTIVE),
|
|
273
|
+
},
|
|
248
274
|
)
|
|
249
275
|
|
|
276
|
+
self.init_display()
|
|
250
277
|
self.set_display_image()
|
|
251
278
|
else:
|
|
252
279
|
logging.error("Can't start display, some packages are missing")
|
|
@@ -270,7 +297,26 @@ class TISApi:
|
|
|
270
297
|
draw.text((x, y), version_text, font=font, fill=(255, 255, 255))
|
|
271
298
|
img = img.rotate(-90, expand=True)
|
|
272
299
|
|
|
273
|
-
|
|
300
|
+
# Convert image to RGB565 (16-bit)
|
|
301
|
+
img_bytes = []
|
|
302
|
+
for y in range(img.height):
|
|
303
|
+
for x in range(img.width):
|
|
304
|
+
r, g, b = img.getpixel((x, y))
|
|
305
|
+
# Pack into RGB565 format
|
|
306
|
+
rgb565 = ((r & 0xF8) << 8) | ((g & 0xFC) << 3) | (b >> 3)
|
|
307
|
+
img_bytes.append((rgb565 >> 8) & 0xFF)
|
|
308
|
+
img_bytes.append(rgb565 & 0xFF)
|
|
309
|
+
|
|
310
|
+
# Send pixel data
|
|
311
|
+
self.set_window(0, 0, img.width - 1, img.height - 1)
|
|
312
|
+
self.send_command(0x2C) # Memory Write
|
|
313
|
+
|
|
314
|
+
# Send in chunks to avoid overwhelming the SPI buffer
|
|
315
|
+
chunk_size = 4096
|
|
316
|
+
for i in range(0, len(img_bytes), chunk_size):
|
|
317
|
+
chunk = img_bytes[i:i + chunk_size]
|
|
318
|
+
self.gpio_request.set_value(23, Value.ACTIVE) # Data mode
|
|
319
|
+
self.spi.xfer2(chunk)
|
|
274
320
|
|
|
275
321
|
async def parse_device_manager_request(self, data: dict) -> None:
|
|
276
322
|
"""Parse the device manager request."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/BytesHelper.py
RENAMED
|
File without changes
|
{tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/Protocols/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/shared.py
RENAMED
|
File without changes
|
|
File without changes
|
{tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/apis/tis_endpoint.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/package-lock.json
RENAMED
|
File without changes
|
|
File without changes
|
{tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/postcss.config.mjs
RENAMED
|
File without changes
|
{tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/public/__init__.py
RENAMED
|
File without changes
|
{tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/public/dashboard.css
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tiscontrolprotocol-1.0.66 → tiscontrolprotocol-1.0.67}/src/TISControlProtocol/views/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|