Sync Client
pypixelcolor.client.Client
Synchronous client for controlling the LED matrix via BLE.
This is a synchronous wrapper around AsyncClient that handles the event loop automatically for simpler usage in non-async code.
Source code in src/pypixelcolor/client.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | |
__del__()
Cleanup on deletion.
Source code in src/pypixelcolor/client.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |
__enter__()
Context manager entry.
Source code in src/pypixelcolor/client.py
211 212 213 214 | |
__exit__(exc_type, exc_val, exc_tb)
Context manager exit.
Source code in src/pypixelcolor/client.py
216 217 218 | |
__getattr__(name)
Delegate attribute access to async client, wrapping coroutines.
This allows automatic synchronous wrapping of all async methods without explicit redefinition, reducing code duplication.
Source code in src/pypixelcolor/client.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
__init__(address)
Initialize the Client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
address
|
str
|
Bluetooth device address (e.g., "1D:6B:5E:B5:A5:54") |
required |
Source code in src/pypixelcolor/client.py
126 127 128 129 130 131 132 133 134 135 | |
clear()
Clears the EEPROM.
Source code in src/pypixelcolor/client.py
110 111 112 | |
connect()
Connect to the BLE device and retrieve device info.
Source code in src/pypixelcolor/client.py
90 91 92 | |
delete(n)
Delete a specific screen by its index.
Source code in src/pypixelcolor/client.py
113 | |
disconnect()
Disconnect from the BLE device.
Source code in src/pypixelcolor/client.py
94 95 | |
get_device_info()
Get cached device information.
Device info is automatically retrieved during connect(). This is a simple getter for the cached data.
Source code in src/pypixelcolor/client.py
98 99 100 101 102 103 | |
send_image(path, resize_method=ResizeMethod.CROP, device_info=None, save_slot=0)
Send an image or animation.
Source code in src/pypixelcolor/client.py
116 117 | |
send_image_hex(hex_string, file_extension, resize_method=ResizeMethod.CROP, device_info=None, save_slot=0)
Send an image or animation from a hexadecimal string.
Source code in src/pypixelcolor/client.py
119 120 | |
send_text(text, rainbow_mode=0, animation=0, save_slot=0, speed=80, color='ffffff', bg_color=None, font='CUSONG', char_height=None, device_info=None)
Send a text to the device with configurable parameters.
Source code in src/pypixelcolor/client.py
122 123 124 | |
set_brightness(level)
Set the brightness of the device.
Source code in src/pypixelcolor/client.py
125 126 | |
set_clock_mode(style=1, date='', show_date=True, format_24=True)
Set the clock mode of the device.
Source code in src/pypixelcolor/client.py
128 129 | |
set_fun_mode(enable=False)
Enable or disable fun mode.
Source code in src/pypixelcolor/client.py
131 132 133 | |
set_orientation(orientation=0)
Set the orientation of the device.
Source code in src/pypixelcolor/client.py
134 135 | |
set_pixel(x, y, color, device_info=None)
Defines the color of a specific pixel.
Source code in src/pypixelcolor/client.py
137 138 139 | |
set_power(on=True)
Set the power state of the device.
Source code in src/pypixelcolor/client.py
140 141 | |
set_rhythm_mode(style=0, l1=0, l2=0, l3=0, l4=0, l5=0, l6=0, l7=0, l8=0, l9=0, l10=0, l11=0)
Set the rhythm mode of the device.
Source code in src/pypixelcolor/client.py
143 144 145 | |
set_rhythm_mode_2(style=0, t=0)
Set the rhythm mode of the device (alternative version).
Source code in src/pypixelcolor/client.py
146 147 | |
set_time(hour=None, minute=None, second=None)
Set the device time.
Source code in src/pypixelcolor/client.py
149 150 | |
show_slot(number)
Shows the specified slot on the device.
Source code in src/pypixelcolor/client.py
152 153 154 | |
version()
Get the client library version.
Source code in src/pypixelcolor/client.py
106 107 108 | |