TISControlProtocol 1.0.68__tar.gz → 1.0.69__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.
Files changed (72) hide show
  1. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/PKG-INFO +1 -1
  2. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/pyproject.toml +1 -1
  3. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/display.py +51 -24
  4. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/.gitignore +0 -0
  5. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/.vscode/c_cpp_properties.json +0 -0
  6. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/.vscode/launch.json +0 -0
  7. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/.vscode/settings.json +0 -0
  8. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/.vscode/tasks.json +0 -0
  9. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/LICENSE +0 -0
  10. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/MANIFEST.in +0 -0
  11. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/README.md +0 -0
  12. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/dev/pump_version.py +0 -0
  13. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/BytesHelper.py +0 -0
  14. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/__init__.py +0 -0
  15. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/AckCoordinator.py +0 -0
  16. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketDispatcher.py +0 -0
  17. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketExtractor.py +0 -0
  18. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/AnalogFeedbackHandler.py +0 -0
  19. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/AutoBinaryFeedbackHandler.py +0 -0
  20. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/BinaryFeedbackHandler.py +0 -0
  21. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/ClimateBinaryFeedbackHandler.py +0 -0
  22. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/ClimateControlFeedbackHandler.py +0 -0
  23. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/ControlResponseHandler.py +0 -0
  24. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/DiscoveryFeedbackHandler.py +0 -0
  25. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/EnergyFeedbackHandler.py +0 -0
  26. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/FloorBinaryFeedbackHandler.py +0 -0
  27. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/HealthFeedbackHandler.py +0 -0
  28. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/LunaTempFeedbackHandler.py +0 -0
  29. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/RealTimeFeedbackHandler.py +0 -0
  30. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/SearchResponseHandler.py +0 -0
  31. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/SecurityFeedbackHandler.py +0 -0
  32. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/UpdateResponseHandler.py +0 -0
  33. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/UpdateSecurityHandler.py +0 -0
  34. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/WeatherFeedbackHandler.py +0 -0
  35. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketHandlers/__init__.py +0 -0
  36. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketProtocol.py +0 -0
  37. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketReceiver.py +0 -0
  38. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/PacketSender.py +0 -0
  39. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/ProtocolHandler.py +0 -0
  40. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/UpdateCoordinator.py +0 -0
  41. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/Protocols/udp/__init__.py +0 -0
  42. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/__init__.py +0 -0
  43. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/api.py +0 -0
  44. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/apis/__init__.py +0 -0
  45. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/apis/bill_config_endpoint.py +0 -0
  46. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/apis/change_password_endpoint.py +0 -0
  47. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/apis/get_bill_config_endpoint.py +0 -0
  48. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/apis/get_key_endpoint.py +0 -0
  49. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/apis/password_dashboard.py +0 -0
  50. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/apis/password_form_endpoint.py +0 -0
  51. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/apis/passwords_endpoint.py +0 -0
  52. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/apis/restart_endpoint.py +0 -0
  53. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/apis/scan_devices_endpoint.py +0 -0
  54. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/apis/shared.py +0 -0
  55. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/apis/submit_password.py +0 -0
  56. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/apis/tis_endpoint.py +0 -0
  57. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/apis/update_endpoint.py +0 -0
  58. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/crc.py +0 -0
  59. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/logo.png +0 -0
  60. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/package-lock.json +0 -0
  61. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/package.json +0 -0
  62. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/postcss.config.mjs +0 -0
  63. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/public/__init__.py +0 -0
  64. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/public/dashboard.css +0 -0
  65. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/public/password_dashboard_loader.js +0 -0
  66. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/shared.py +0 -0
  67. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/views/__init__.py +0 -0
  68. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/views/password_dashboard/index.html +0 -0
  69. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/views/password_dashboard/styles.css +0 -0
  70. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/views/password_form/index.html +0 -0
  71. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/src/TISControlProtocol/views/password_form/styles.css +0 -0
  72. {tiscontrolprotocol-1.0.68 → tiscontrolprotocol-1.0.69}/tests/test.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: TISControlProtocol
3
- Version: 1.0.68
3
+ Version: 1.0.69
4
4
  Summary: A library for TIS Control Protocol
5
5
  Project-URL: Homepage, https://github.com/TISControlHass
6
6
  Project-URL: Issues, https://github.com/TISControlHass/issues
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "TISControlProtocol"
7
- version = "1.0.68"
7
+ version = "1.0.69"
8
8
  description = "A library for TIS Control Protocol"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -17,6 +17,7 @@ except (ImportError, RuntimeError) as e:
17
17
  "Failed to load display dependencies. Display will be disabled. Error: %s", e
18
18
  )
19
19
 
20
+
20
21
  class TISDisplay:
21
22
  def __init__(self, display_logo: str, version: str):
22
23
  self.display_logo = display_logo
@@ -39,11 +40,11 @@ class TISDisplay:
39
40
  logging.error(f"Error setting pin {pin} to {value}: {e}")
40
41
 
41
42
  def send_command(self, cmd):
42
- self._set_pin(23, 0) # Command mode (0)
43
+ self._set_pin(23, 0) # Command mode (0)
43
44
  os.write(self.spi_fd, bytes([cmd]))
44
45
 
45
46
  def send_data(self, data):
46
- self._set_pin(23, 1) # Data mode (1)
47
+ self._set_pin(23, 1) # Data mode (1)
47
48
  if isinstance(data, int):
48
49
  os.write(self.spi_fd, bytes([data]))
49
50
  else:
@@ -59,30 +60,30 @@ class TISDisplay:
59
60
  time.sleep(0.1)
60
61
 
61
62
  # ST7789 Initialization Sequence
62
- self.send_command(0x01) # SWRESET
63
+ self.send_command(0x01) # SWRESET
63
64
  time.sleep(0.15)
64
- self.send_command(0x11) # Sleep out
65
+ self.send_command(0x11) # Sleep out
65
66
  time.sleep(0.15)
66
67
 
67
- self.send_command(0x3A) # Color mode 16-bit
68
- self.send_data(0x55) # 0x55 for RGB565
68
+ self.send_command(0x3A) # Color mode 16-bit
69
+ self.send_data(0x55) # 0x55 for RGB565
69
70
 
70
- self.send_command(0x36) # Memory Access Control (MADCTL)
71
- self.send_data(0x00) # Normal rotation
71
+ self.send_command(0x36) # Memory Access Control (MADCTL)
72
+ self.send_data(0x00) # Normal rotation
72
73
 
73
- self.send_command(0x21) # INVON
74
- self.send_command(0x13) # NORON
74
+ self.send_command(0x21) # INVON
75
+ self.send_command(0x13) # NORON
75
76
  time.sleep(0.01)
76
- self.send_command(0x29) # Display on
77
+ self.send_command(0x29) # Display on
77
78
  time.sleep(0.1)
78
79
 
79
80
  def set_window(self, x1, y1, x2, y2):
80
- self.send_command(0x2A) # Column Address Set
81
+ self.send_command(0x2A) # Column Address Set
81
82
  self.send_data(bytearray([x1 >> 8, x1 & 0xFF, x2 >> 8, x2 & 0xFF]))
82
83
 
83
- self.send_command(0x2B) # Row Address Set
84
+ self.send_command(0x2B) # Row Address Set
84
85
  self.send_data(bytearray([y1 >> 8, y1 & 0xFF, y2 >> 8, y2 & 0xFF]))
85
- self.send_command(0x2C) # RAMWR
86
+ self.send_command(0x2C) # RAMWR
86
87
 
87
88
  def set_display_image(self):
88
89
  if self.display_logo:
@@ -94,27 +95,43 @@ class TISDisplay:
94
95
  font = ImageFont.load_default(size=28)
95
96
  except TypeError:
96
97
  font = ImageFont.load_default()
97
-
98
+
98
99
  x, y = 78, 235
99
100
  draw.text((x, y), version_text, font=font, fill=(255, 255, 255))
100
- img = img.rotate(-90, expand=True)
101
+ img = img.rotate(180, expand=True)
101
102
 
102
103
  if img.size != (240, 320):
103
104
  img = img.resize((240, 320))
104
105
 
105
106
  r, g, b = img.split()
106
- r_data = list(r.getdata()) if not hasattr(r, "get_flattened_data") else r.get_flattened_data()
107
- g_data = list(g.getdata()) if not hasattr(g, "get_flattened_data") else g.get_flattened_data()
108
- b_data = list(b.getdata()) if not hasattr(b, "get_flattened_data") else b.get_flattened_data()
107
+ r_data = (
108
+ list(r.getdata())
109
+ if not hasattr(r, "get_flattened_data")
110
+ else r.get_flattened_data()
111
+ )
112
+ g_data = (
113
+ list(g.getdata())
114
+ if not hasattr(g, "get_flattened_data")
115
+ else g.get_flattened_data()
116
+ )
117
+ b_data = (
118
+ list(b.getdata())
119
+ if not hasattr(b, "get_flattened_data")
120
+ else b.get_flattened_data()
121
+ )
109
122
 
110
123
  rgb565 = bytearray(img.width * img.height * 2)
111
124
  for i in range(len(r_data)):
112
- pixel = (((r_data[i] & 0xF8) << 8) | ((g_data[i] & 0xFC) << 3) | (b_data[i] >> 3))
125
+ pixel = (
126
+ ((r_data[i] & 0xF8) << 8)
127
+ | ((g_data[i] & 0xFC) << 3)
128
+ | (b_data[i] >> 3)
129
+ )
113
130
  rgb565[i * 2] = pixel >> 8
114
131
  rgb565[i * 2 + 1] = pixel & 0xFF
115
132
 
116
133
  self.set_window(0, 0, img.width - 1, img.height - 1)
117
- self._set_pin(23, 1) # Data mode
134
+ self._set_pin(23, 1) # Data mode
118
135
 
119
136
  mv = memoryview(rgb565)
120
137
  chunk_size = 4096
@@ -129,7 +146,9 @@ class TISDisplay:
129
146
  SPI_IOC_WR_MODE = 0x40016B01
130
147
  SPI_IOC_WR_MAX_SPEED_HZ = 0x40046B04
131
148
  fcntl.ioctl(self.spi_fd, SPI_IOC_WR_MODE, struct.pack("B", 0))
132
- fcntl.ioctl(self.spi_fd, SPI_IOC_WR_MAX_SPEED_HZ, struct.pack("I", 10000000))
149
+ fcntl.ioctl(
150
+ self.spi_fd, SPI_IOC_WR_MAX_SPEED_HZ, struct.pack("I", 10000000)
151
+ )
133
152
 
134
153
  # Initialize GPIOs via gpiod dynamically
135
154
  self.chip_path = None
@@ -151,12 +170,20 @@ class TISDisplay:
151
170
  self.req_dc = gpiod.request_lines(
152
171
  self.chip_path,
153
172
  consumer="display_dc",
154
- config={23: gpiod.LineSettings(direction=Direction.OUTPUT, output_value=Value.INACTIVE)}
173
+ config={
174
+ 23: gpiod.LineSettings(
175
+ direction=Direction.OUTPUT, output_value=Value.INACTIVE
176
+ )
177
+ },
155
178
  )
156
179
  self.req_rst = gpiod.request_lines(
157
180
  self.chip_path,
158
181
  consumer="display_rst",
159
- config={25: gpiod.LineSettings(direction=Direction.OUTPUT, output_value=Value.INACTIVE)}
182
+ config={
183
+ 25: gpiod.LineSettings(
184
+ direction=Direction.OUTPUT, output_value=Value.INACTIVE
185
+ )
186
+ },
160
187
  )
161
188
 
162
189
  try: