idotmatrix-api-client 0.3.0__tar.gz → 1.1.0__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.
- idotmatrix_api_client-1.1.0/PKG-INFO +187 -0
- idotmatrix_api_client-1.1.0/README.md +165 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/apps/digital_picture_frame.py +3 -22
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/client.py +9 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/connection_manager.py +14 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/__init__.py +7 -1
- idotmatrix_api_client-1.1.0/idotmatrix/modules/alarm.py +226 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/countdown.py +0 -1
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/effect.py +5 -1
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/gif.py +62 -118
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/graffiti.py +2 -2
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/image.py +8 -2
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/materials.py +15 -1
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/system.py +1 -1
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/text.py +3 -1
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/protocol.py +1 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/__init__.py +1 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/__main__.py +31 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/app.py +896 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/canvas.py +140 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/colorwheel.py +245 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/controls.py +61 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/convert.py +73 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/devicebar.py +55 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/devices.py +243 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/dialogs.py +259 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/draw.py +575 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/features.py +235 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/files.py +89 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/forms.py +381 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/pages.py +71 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/preview.py +243 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/previews.py +206 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/scanner.py +37 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/scoreboard.py +172 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/settings.py +243 -0
- idotmatrix_api_client-1.1.0/idotmatrix/tui/widgets.py +523 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/util/file_watch.py +0 -1
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/util/image_utils.py +9 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/util/upload_ack.py +5 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/pyproject.toml +9 -1
- idotmatrix_api_client-0.3.0/PKG-INFO +0 -383
- idotmatrix_api_client-0.3.0/README.md +0 -364
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/LICENSE +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/__init__.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/apps/__init__.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/const.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/16-ErbosDraco1StOpenNbpRegular-l5wX.ttf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/16-MinecraftStandard.otf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/16-MinecraftStandardBoldOblique.otf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/16-PixelOperator8-Bold.ttf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/16-PixelOperator8.ttf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/16-PixelifySans-Regular.ttf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/16-PressStart2P-Regular.ttf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/16-dogica.ttf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/16-dogicabold.ttf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/16-dogicapixel.ttf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/16-dogicapixelbold.ttf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/16_32-HomeVideo-BLG6G.ttf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/16_32-HomeVideoBold-R90Dv.ttf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/16_32-MayfairNbpBold-gAA4.ttf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/32-Jersey10-Regular.ttf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/CC-BY-SA-4.0-License.txt +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/ErbosDraco-License.txt +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/HomeVideo-License.txt +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/Jersey10-Regular-License.txt +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/MayfairNbpBold-License.txt +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/MinecraftStandard-License.txt +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/PixelOperator-License.txt +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/PixelifySans-License.txt +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/PressStart2P-Regular-License.txt +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/Rain-DRM3-License.txt +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/Rain-DRM3.otf +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/fonts/dogica_license.txt +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/chronograph.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/clock.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/common.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/eco.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/fullscreen_color.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/music_sync.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/modules/scoreboard.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/screensize.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/transport.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/util/__init__.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/util/color_utils.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/util/command_ack.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/util/device_info.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/util/device_material.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/util/overlay.py +0 -0
- {idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/util/quality.py +0 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: idotmatrix-api-client
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: A library for controlling iDotMatrix displays.
|
|
5
|
+
License-Expression: GPL-3.0-or-later
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.12,<3.15
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Provides-Extra: tui
|
|
10
|
+
Requires-Dist: bleak (>=0.22.3)
|
|
11
|
+
Requires-Dist: cryptography (>=46.0.7)
|
|
12
|
+
Requires-Dist: pillow (>=12.2.0)
|
|
13
|
+
Requires-Dist: textual (>=8.0.0) ; extra == "tui"
|
|
14
|
+
Requires-Dist: textual-image (>=0.14.0) ; extra == "tui"
|
|
15
|
+
Requires-Dist: watchdog (>=6.0.0)
|
|
16
|
+
Project-URL: Bug Tracker, https://github.com/markusressel/idotmatrix-api-client/issues
|
|
17
|
+
Project-URL: Documentation, https://github.com/markusressel/idotmatrix-api-client
|
|
18
|
+
Project-URL: Homepage, https://github.com/markusressel/idotmatrix-api-client
|
|
19
|
+
Project-URL: Repository, https://github.com/markusressel/idotmatrix-api-client
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
<br/>
|
|
23
|
+
<p align="center">
|
|
24
|
+
<a href="https://github.com/markusressel/idotmatrix-api-client">
|
|
25
|
+
<img src="images/logo.png" alt="Logo" width="250" height="250">
|
|
26
|
+
</a>
|
|
27
|
+
|
|
28
|
+
<h3 align="center">idotmatrix-api-client</h3>
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
Control 16x16, 32x32 and 64x64 sized iDotMatrix Pixel Displays
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
<p align="center">
|
|
35
|
+
<img src="https://img.shields.io/github/contributors/markusressel/idotmatrix-api-client?color=dark-green" alt="Contributors">
|
|
36
|
+
<img src="https://img.shields.io/github/license/markusressel/idotmatrix-api-client" alt="License">
|
|
37
|
+
</p>
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
## Features
|
|
41
|
+
|
|
42
|
+
<img src="docs/images/device.png" alt="An iDotMatrix pixel display showing a pixel art picture" width="220" align="right">
|
|
43
|
+
|
|
44
|
+
A library to control displays like the one on the right without the official
|
|
45
|
+
[iDotMatrix](https://play.google.com/store/apps/details?id=com.tech.idotmatrix&pli=1) app, based on its reverse engineered
|
|
46
|
+
Bluetooth protocol.
|
|
47
|
+
|
|
48
|
+
Looking for Home Assistant? The [ha-idotmatrix](https://github.com/markusressel/ha-idotmatrix) integration is built on
|
|
49
|
+
this library.
|
|
50
|
+
|
|
51
|
+
* Show photos, animated GIFs and pixel art, with text on top, or store them in the slots of the device so that it
|
|
52
|
+
cycles through them on its own
|
|
53
|
+
* Clock, countdown, chronograph, scoreboard, graffiti board, effects and a full screen color
|
|
54
|
+
* Scrolling text with the bundled pixel fonts
|
|
55
|
+
* Music sync with the microphone of the device
|
|
56
|
+
* Brightness, eco mode, power and time
|
|
57
|
+
* Alarms, which make the device beep (untested, see [the protocol notes](docs/DEVICE-PROTOCOL.md#alarm-and-buzzer))
|
|
58
|
+
* Digital picture frame for a folder of pictures
|
|
59
|
+
* Terminal UI to try all of it
|
|
60
|
+
* Works with the 16x16, 32x32 and 64x64 displays, with `bleak` or with the Bluetooth stack of Home Assistant
|
|
61
|
+
|
|
62
|
+
Open ends (the cloud API, password protection, firmware update) are collected in the
|
|
63
|
+
[device protocol notes](docs/DEVICE-PROTOCOL.md#not-understood-yet).
|
|
64
|
+
|
|
65
|
+
<br clear="right"/>
|
|
66
|
+
|
|
67
|
+
## Getting Started
|
|
68
|
+
|
|
69
|
+
You need Python 3.12 or newer and a display that works with the iDotMatrix app (Windows may work but is untested).
|
|
70
|
+
|
|
71
|
+
### Terminal UI
|
|
72
|
+
|
|
73
|
+
The quickest way to try your display: browse a folder, preview how pictures and animations look on the display, send
|
|
74
|
+
them, and control its features, with a pixel editor.
|
|
75
|
+
|
|
76
|
+

|
|
77
|
+
|
|
78
|
+
```sh
|
|
79
|
+
pip install 'idotmatrix-api-client[tui]'
|
|
80
|
+
idotmatrix-tui /path/to/pictures
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
See the [TUI notes](docs/TUI.md) for the keys and options. The terminal UI and its dependencies (textual) are optional:
|
|
84
|
+
`pip install idotmatrix-api-client` installs only the API client, which never loads them.
|
|
85
|
+
|
|
86
|
+
### API Client
|
|
87
|
+
|
|
88
|
+
To control the display from your own code, install the library and use the `IDotMatrixClient`:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
pip install idotmatrix-api-client
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
import asyncio
|
|
96
|
+
|
|
97
|
+
from idotmatrix import IDotMatrixClient, ScreenSize
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
async def main():
|
|
101
|
+
client = IDotMatrixClient(screen_size=ScreenSize.SIZE_64x64)
|
|
102
|
+
await client.connect() # connects to the first iDotMatrix display it finds
|
|
103
|
+
|
|
104
|
+
await client.set_brightness(50)
|
|
105
|
+
await client.text.show_text("Hello World!")
|
|
106
|
+
await client.image.show_image_file("photo.jpg")
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
asyncio.run(main())
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The [examples](./examples) show more: GIFs, labels, effects, and storing files in the slots of the device.
|
|
113
|
+
|
|
114
|
+
#### Digital Picture Frame
|
|
115
|
+
|
|
116
|
+
The `DigitalPictureFrame` class builds on the client and shows images and GIFs as a slideshow. It can
|
|
117
|
+
|
|
118
|
+
* display a static list of images and/or GIFs
|
|
119
|
+
* watch one or more directories for images and GIFs
|
|
120
|
+
* automatically reconnect to the device in case of an error or connection loss
|
|
121
|
+
|
|
122
|
+
See [examples/example_digital_picture_frame.py](./examples/example_digital_picture_frame.py) for how to use it.
|
|
123
|
+
|
|
124
|
+
#### Home Assistant and other Bluetooth stacks
|
|
125
|
+
|
|
126
|
+
If something else owns the Bluetooth stack, like Home Assistant with its scanner and Bluetooth proxies, see the
|
|
127
|
+
[integration notes](docs/INTEGRATION.md).
|
|
128
|
+
|
|
129
|
+
## Fonts
|
|
130
|
+
|
|
131
|
+
Text is drawn in 1-bit cells without anti-aliasing, so pixel fonts work best. The package bundles a selection that was
|
|
132
|
+
tested at fixed `font_size` values. See the [font notes](docs/FONTS.md) for the sizes, licenses and how to add more.
|
|
133
|
+
|
|
134
|
+
## Helpful Links
|
|
135
|
+
|
|
136
|
+
* This project
|
|
137
|
+
* [idotmatrix-api-client on PyPI](https://pypi.org/project/idotmatrix-api-client/)
|
|
138
|
+
* [Device protocol notes](docs/DEVICE-PROTOCOL.md): what is known about the Bluetooth protocol of the displays
|
|
139
|
+
* Related projects
|
|
140
|
+
* [ha-idotmatrix](https://github.com/markusressel/ha-idotmatrix): Home Assistant integration built on this library
|
|
141
|
+
* [derkalle4/python3-idotmatrix-library](https://github.com/derkalle4/python3-idotmatrix-library): the original
|
|
142
|
+
project this is a fork of
|
|
143
|
+
* [8none1/idotmatrix](https://github.com/8none1/idotmatrix): further notes and tools for the displays
|
|
144
|
+
* [fbnlrz/homeyidotmatrix](https://github.com/fbnlrz/homeyidotmatrix): Homey integration with protocol notes
|
|
145
|
+
* The official [iDotMatrix app](https://play.google.com/store/apps/details?id=com.tech.idotmatrix) (Android)
|
|
146
|
+
* Create images or GIFs
|
|
147
|
+
* [pixilart](https://www.pixilart.com/draw): create a new drawing and select a preset for the size of your display
|
|
148
|
+
(e.g. 64x64)
|
|
149
|
+
|
|
150
|
+
## Other Hardware
|
|
151
|
+
This software is specifically built for devices which are supported by the iDotMatrix app. There are other devices
|
|
152
|
+
being sold which have a similar form factor and claim to be compatible, but which are not. Below is a list of known
|
|
153
|
+
non-iDotMatrix-compatible hardware and associated software.
|
|
154
|
+
- For hardware supported by the "LOY SPACE" app: https://github.com/eskibars/popledder/
|
|
155
|
+
|
|
156
|
+
## Contributing
|
|
157
|
+
|
|
158
|
+
GitHub is for social coding: if you want to write code, I encourage contributions through pull requests from forks
|
|
159
|
+
of this repository. Create GitHub tickets for bugs and new features and comment on the ones that you are interested in.
|
|
160
|
+
|
|
161
|
+
To work on the library, see the [development notes](docs/DEVELOPMENT.md).
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
Distributed under the GNU GENERAL PUBLIC License.
|
|
166
|
+
See [LICENSE](https://github.com/markusressel/idotmatrix-api-client/blob/main/LICENSE) for more information.
|
|
167
|
+
|
|
168
|
+
## Differences From The Original Project
|
|
169
|
+
|
|
170
|
+
This is a fork of [derkalle4/python3-idotmatrix-library](https://github.com/derkalle4/python3-idotmatrix-library),
|
|
171
|
+
which is no longer maintained. The fork continues its development and maintenance.
|
|
172
|
+
|
|
173
|
+
The API is not compatible with the original: the structure was reworked for usability and maintainability, so code
|
|
174
|
+
written for the original needs some adjustments to run with this library. Returning the raw bytearray data of commands
|
|
175
|
+
was dropped to keep the library simple.
|
|
176
|
+
|
|
177
|
+
## Acknowledgements
|
|
178
|
+
|
|
179
|
+
Original project by [derkalle4](https://github.com/derkalle4) and [jmgraeffe](https://github.com/jmgraeffe).
|
|
180
|
+
|
|
181
|
+
* [Othneil Drew](https://github.com/othneildrew/Best-README-Template) - *README Template*
|
|
182
|
+
* [LordRippon](https://github.com/LordRippon) - *Reverse Engineering for the Displays*
|
|
183
|
+
* [8none1](https://github.com/8none1) - *Reverse Engineering for the Displays*
|
|
184
|
+
* [schorsch3000](https://github.com/schorsch3000) - *smaller fixes*
|
|
185
|
+
* [tekka007](https://github.com/tekka007) - *code refactoring and reverse engineering*
|
|
186
|
+
* [inselberg](https://github.com/inselberg) - *Reverse Engineering for the Displays*
|
|
187
|
+
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<br/>
|
|
2
|
+
<p align="center">
|
|
3
|
+
<a href="https://github.com/markusressel/idotmatrix-api-client">
|
|
4
|
+
<img src="images/logo.png" alt="Logo" width="250" height="250">
|
|
5
|
+
</a>
|
|
6
|
+
|
|
7
|
+
<h3 align="center">idotmatrix-api-client</h3>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
Control 16x16, 32x32 and 64x64 sized iDotMatrix Pixel Displays
|
|
11
|
+
</p>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
<img src="https://img.shields.io/github/contributors/markusressel/idotmatrix-api-client?color=dark-green" alt="Contributors">
|
|
15
|
+
<img src="https://img.shields.io/github/license/markusressel/idotmatrix-api-client" alt="License">
|
|
16
|
+
</p>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
<img src="docs/images/device.png" alt="An iDotMatrix pixel display showing a pixel art picture" width="220" align="right">
|
|
22
|
+
|
|
23
|
+
A library to control displays like the one on the right without the official
|
|
24
|
+
[iDotMatrix](https://play.google.com/store/apps/details?id=com.tech.idotmatrix&pli=1) app, based on its reverse engineered
|
|
25
|
+
Bluetooth protocol.
|
|
26
|
+
|
|
27
|
+
Looking for Home Assistant? The [ha-idotmatrix](https://github.com/markusressel/ha-idotmatrix) integration is built on
|
|
28
|
+
this library.
|
|
29
|
+
|
|
30
|
+
* Show photos, animated GIFs and pixel art, with text on top, or store them in the slots of the device so that it
|
|
31
|
+
cycles through them on its own
|
|
32
|
+
* Clock, countdown, chronograph, scoreboard, graffiti board, effects and a full screen color
|
|
33
|
+
* Scrolling text with the bundled pixel fonts
|
|
34
|
+
* Music sync with the microphone of the device
|
|
35
|
+
* Brightness, eco mode, power and time
|
|
36
|
+
* Alarms, which make the device beep (untested, see [the protocol notes](docs/DEVICE-PROTOCOL.md#alarm-and-buzzer))
|
|
37
|
+
* Digital picture frame for a folder of pictures
|
|
38
|
+
* Terminal UI to try all of it
|
|
39
|
+
* Works with the 16x16, 32x32 and 64x64 displays, with `bleak` or with the Bluetooth stack of Home Assistant
|
|
40
|
+
|
|
41
|
+
Open ends (the cloud API, password protection, firmware update) are collected in the
|
|
42
|
+
[device protocol notes](docs/DEVICE-PROTOCOL.md#not-understood-yet).
|
|
43
|
+
|
|
44
|
+
<br clear="right"/>
|
|
45
|
+
|
|
46
|
+
## Getting Started
|
|
47
|
+
|
|
48
|
+
You need Python 3.12 or newer and a display that works with the iDotMatrix app (Windows may work but is untested).
|
|
49
|
+
|
|
50
|
+
### Terminal UI
|
|
51
|
+
|
|
52
|
+
The quickest way to try your display: browse a folder, preview how pictures and animations look on the display, send
|
|
53
|
+
them, and control its features, with a pixel editor.
|
|
54
|
+
|
|
55
|
+

|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
pip install 'idotmatrix-api-client[tui]'
|
|
59
|
+
idotmatrix-tui /path/to/pictures
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
See the [TUI notes](docs/TUI.md) for the keys and options. The terminal UI and its dependencies (textual) are optional:
|
|
63
|
+
`pip install idotmatrix-api-client` installs only the API client, which never loads them.
|
|
64
|
+
|
|
65
|
+
### API Client
|
|
66
|
+
|
|
67
|
+
To control the display from your own code, install the library and use the `IDotMatrixClient`:
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
pip install idotmatrix-api-client
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
import asyncio
|
|
75
|
+
|
|
76
|
+
from idotmatrix import IDotMatrixClient, ScreenSize
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
async def main():
|
|
80
|
+
client = IDotMatrixClient(screen_size=ScreenSize.SIZE_64x64)
|
|
81
|
+
await client.connect() # connects to the first iDotMatrix display it finds
|
|
82
|
+
|
|
83
|
+
await client.set_brightness(50)
|
|
84
|
+
await client.text.show_text("Hello World!")
|
|
85
|
+
await client.image.show_image_file("photo.jpg")
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
asyncio.run(main())
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The [examples](./examples) show more: GIFs, labels, effects, and storing files in the slots of the device.
|
|
92
|
+
|
|
93
|
+
#### Digital Picture Frame
|
|
94
|
+
|
|
95
|
+
The `DigitalPictureFrame` class builds on the client and shows images and GIFs as a slideshow. It can
|
|
96
|
+
|
|
97
|
+
* display a static list of images and/or GIFs
|
|
98
|
+
* watch one or more directories for images and GIFs
|
|
99
|
+
* automatically reconnect to the device in case of an error or connection loss
|
|
100
|
+
|
|
101
|
+
See [examples/example_digital_picture_frame.py](./examples/example_digital_picture_frame.py) for how to use it.
|
|
102
|
+
|
|
103
|
+
#### Home Assistant and other Bluetooth stacks
|
|
104
|
+
|
|
105
|
+
If something else owns the Bluetooth stack, like Home Assistant with its scanner and Bluetooth proxies, see the
|
|
106
|
+
[integration notes](docs/INTEGRATION.md).
|
|
107
|
+
|
|
108
|
+
## Fonts
|
|
109
|
+
|
|
110
|
+
Text is drawn in 1-bit cells without anti-aliasing, so pixel fonts work best. The package bundles a selection that was
|
|
111
|
+
tested at fixed `font_size` values. See the [font notes](docs/FONTS.md) for the sizes, licenses and how to add more.
|
|
112
|
+
|
|
113
|
+
## Helpful Links
|
|
114
|
+
|
|
115
|
+
* This project
|
|
116
|
+
* [idotmatrix-api-client on PyPI](https://pypi.org/project/idotmatrix-api-client/)
|
|
117
|
+
* [Device protocol notes](docs/DEVICE-PROTOCOL.md): what is known about the Bluetooth protocol of the displays
|
|
118
|
+
* Related projects
|
|
119
|
+
* [ha-idotmatrix](https://github.com/markusressel/ha-idotmatrix): Home Assistant integration built on this library
|
|
120
|
+
* [derkalle4/python3-idotmatrix-library](https://github.com/derkalle4/python3-idotmatrix-library): the original
|
|
121
|
+
project this is a fork of
|
|
122
|
+
* [8none1/idotmatrix](https://github.com/8none1/idotmatrix): further notes and tools for the displays
|
|
123
|
+
* [fbnlrz/homeyidotmatrix](https://github.com/fbnlrz/homeyidotmatrix): Homey integration with protocol notes
|
|
124
|
+
* The official [iDotMatrix app](https://play.google.com/store/apps/details?id=com.tech.idotmatrix) (Android)
|
|
125
|
+
* Create images or GIFs
|
|
126
|
+
* [pixilart](https://www.pixilart.com/draw): create a new drawing and select a preset for the size of your display
|
|
127
|
+
(e.g. 64x64)
|
|
128
|
+
|
|
129
|
+
## Other Hardware
|
|
130
|
+
This software is specifically built for devices which are supported by the iDotMatrix app. There are other devices
|
|
131
|
+
being sold which have a similar form factor and claim to be compatible, but which are not. Below is a list of known
|
|
132
|
+
non-iDotMatrix-compatible hardware and associated software.
|
|
133
|
+
- For hardware supported by the "LOY SPACE" app: https://github.com/eskibars/popledder/
|
|
134
|
+
|
|
135
|
+
## Contributing
|
|
136
|
+
|
|
137
|
+
GitHub is for social coding: if you want to write code, I encourage contributions through pull requests from forks
|
|
138
|
+
of this repository. Create GitHub tickets for bugs and new features and comment on the ones that you are interested in.
|
|
139
|
+
|
|
140
|
+
To work on the library, see the [development notes](docs/DEVELOPMENT.md).
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
Distributed under the GNU GENERAL PUBLIC License.
|
|
145
|
+
See [LICENSE](https://github.com/markusressel/idotmatrix-api-client/blob/main/LICENSE) for more information.
|
|
146
|
+
|
|
147
|
+
## Differences From The Original Project
|
|
148
|
+
|
|
149
|
+
This is a fork of [derkalle4/python3-idotmatrix-library](https://github.com/derkalle4/python3-idotmatrix-library),
|
|
150
|
+
which is no longer maintained. The fork continues its development and maintenance.
|
|
151
|
+
|
|
152
|
+
The API is not compatible with the original: the structure was reworked for usability and maintainability, so code
|
|
153
|
+
written for the original needs some adjustments to run with this library. Returning the raw bytearray data of commands
|
|
154
|
+
was dropped to keep the library simple.
|
|
155
|
+
|
|
156
|
+
## Acknowledgements
|
|
157
|
+
|
|
158
|
+
Original project by [derkalle4](https://github.com/derkalle4) and [jmgraeffe](https://github.com/jmgraeffe).
|
|
159
|
+
|
|
160
|
+
* [Othneil Drew](https://github.com/othneildrew/Best-README-Template) - *README Template*
|
|
161
|
+
* [LordRippon](https://github.com/LordRippon) - *Reverse Engineering for the Displays*
|
|
162
|
+
* [8none1](https://github.com/8none1) - *Reverse Engineering for the Displays*
|
|
163
|
+
* [schorsch3000](https://github.com/schorsch3000) - *smaller fixes*
|
|
164
|
+
* [tekka007](https://github.com/tekka007) - *code refactoring and reverse engineering*
|
|
165
|
+
* [inselberg](https://github.com/inselberg) - *Reverse Engineering for the Displays*
|
{idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/apps/digital_picture_frame.py
RENAMED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
import logging
|
|
3
3
|
import re
|
|
4
|
-
import signal
|
|
5
4
|
from asyncio import sleep, Task
|
|
6
5
|
from enum import Enum
|
|
7
6
|
from os import PathLike
|
|
@@ -272,6 +271,9 @@ class DigitalPictureFrame:
|
|
|
272
271
|
"""
|
|
273
272
|
Starts a slideshow of images on the digital picture frame.
|
|
274
273
|
|
|
274
|
+
It does not handle signals: the application decides how it shuts down, and calls `stop_slideshow()` then
|
|
275
|
+
(see examples/example_digital_picture_frame.py).
|
|
276
|
+
|
|
275
277
|
Args:
|
|
276
278
|
interval (int): Time in seconds between image changes. Defaults to 5 seconds.
|
|
277
279
|
"""
|
|
@@ -280,24 +282,6 @@ class DigitalPictureFrame:
|
|
|
280
282
|
if interval is not None:
|
|
281
283
|
self.set_interval(interval)
|
|
282
284
|
|
|
283
|
-
async def async_signal_handler():
|
|
284
|
-
"""
|
|
285
|
-
Handles the signal to stop the slideshow gracefully.
|
|
286
|
-
"""
|
|
287
|
-
await self.stop_slideshow()
|
|
288
|
-
# TODO: doing it like this is probably a bad idea,
|
|
289
|
-
# since it will also kill anything else that is currently running,
|
|
290
|
-
# or even fail to stop the loop,
|
|
291
|
-
# but I haven't gotten anything else to work yet :(
|
|
292
|
-
asyncio.get_event_loop().stop()
|
|
293
|
-
|
|
294
|
-
def signal_handler(signum):
|
|
295
|
-
signame = signal.Signals(signum).name
|
|
296
|
-
logging.info(f'Signal handler called with signal {signame} ({signum})')
|
|
297
|
-
asyncio.ensure_future(async_signal_handler())
|
|
298
|
-
|
|
299
|
-
asyncio.get_event_loop().add_signal_handler(signal.SIGINT, lambda: signal_handler(signal.SIGINT))
|
|
300
|
-
asyncio.get_event_loop().add_signal_handler(signal.SIGTERM, lambda: signal_handler(signal.SIGTERM))
|
|
301
285
|
self._slideshow_task = self._start_slideshow_task()
|
|
302
286
|
await asyncio.sleep(0)
|
|
303
287
|
return self._slideshow_task
|
|
@@ -332,9 +316,6 @@ class DigitalPictureFrame:
|
|
|
332
316
|
await self.device_client.clock.show(show_date=False)
|
|
333
317
|
await self.device_client.disconnect()
|
|
334
318
|
|
|
335
|
-
asyncio.get_event_loop().remove_signal_handler(signal.SIGINT)
|
|
336
|
-
asyncio.get_event_loop().remove_signal_handler(signal.SIGTERM)
|
|
337
|
-
|
|
338
319
|
def is_slideshow_running(self) -> bool:
|
|
339
320
|
"""
|
|
340
321
|
Checks if the slideshow is currently running.
|
|
@@ -5,6 +5,7 @@ from typing import Optional
|
|
|
5
5
|
from bleak.backends.device import BLEDevice
|
|
6
6
|
|
|
7
7
|
from idotmatrix.connection_manager import ConnectionManager, ConnectionListener
|
|
8
|
+
from idotmatrix.modules.alarm import AlarmModule
|
|
8
9
|
from idotmatrix.modules.chronograph import ChronographModule
|
|
9
10
|
from idotmatrix.modules.clock import ClockModule
|
|
10
11
|
from idotmatrix.modules.common import CommonModule
|
|
@@ -91,6 +92,14 @@ class IDotMatrixClient:
|
|
|
91
92
|
def screen_size(self, screen_size: ScreenSize) -> None:
|
|
92
93
|
self._screen_size = screen_size
|
|
93
94
|
|
|
95
|
+
@cached_property
|
|
96
|
+
def alarm(self) -> AlarmModule:
|
|
97
|
+
return AlarmModule(
|
|
98
|
+
connection_manager=self._connection_manager,
|
|
99
|
+
gif=self.gif,
|
|
100
|
+
common=self.common,
|
|
101
|
+
)
|
|
102
|
+
|
|
94
103
|
@cached_property
|
|
95
104
|
def chronograph(self) -> ChronographModule:
|
|
96
105
|
return ChronographModule(
|
{idotmatrix_api_client-0.3.0 → idotmatrix_api_client-1.1.0}/idotmatrix/connection_manager.py
RENAMED
|
@@ -429,6 +429,7 @@ class ConnectionManager:
|
|
|
429
429
|
packets: List[List[bytearray | bytes]],
|
|
430
430
|
response: bool = False,
|
|
431
431
|
wait_for_ack: bool = False,
|
|
432
|
+
progress: Callable[[int, int], None] | None = None,
|
|
432
433
|
):
|
|
433
434
|
"""
|
|
434
435
|
Sends multiple packets to the device.
|
|
@@ -443,6 +444,9 @@ class ConnectionManager:
|
|
|
443
444
|
response: If True, a write-with-response operation will be used, otherwise a write-without-response operation will be used.
|
|
444
445
|
wait_for_ack: If True, the device has to acknowledge each packet before the next one is sent. This is how
|
|
445
446
|
the official app transfers images and GIFs, the device drops or garbles data that is sent too early.
|
|
447
|
+
progress: Called with (packets done, packets in total) after each packet, with wait_for_ack once the
|
|
448
|
+
device acknowledged it. The upload is done when the two are equal, also when the device skips the
|
|
449
|
+
rest because it already has the data. Runs on the event loop, so it must not block.
|
|
446
450
|
Raises:
|
|
447
451
|
UploadError: If wait_for_ack is set and the device rejects a packet or does not answer in time.
|
|
448
452
|
"""
|
|
@@ -494,7 +498,17 @@ class ConnectionManager:
|
|
|
494
498
|
if status == UploadStatus.FINISHED and i < len(packets) - 1:
|
|
495
499
|
# f.e. the device already has the same data stored
|
|
496
500
|
self.logging.debug("the device reports the upload as finished, skipping the remaining packets")
|
|
501
|
+
self._report_progress(progress, len(packets), len(packets))
|
|
497
502
|
return
|
|
503
|
+
self._report_progress(progress, i + 1, len(packets))
|
|
504
|
+
|
|
505
|
+
def _report_progress(self, progress: Callable[[int, int], None] | None, done: int, total: int) -> None:
|
|
506
|
+
if progress is None:
|
|
507
|
+
return
|
|
508
|
+
try:
|
|
509
|
+
progress(done, total)
|
|
510
|
+
except Exception:
|
|
511
|
+
self.logging.exception("the progress callback failed")
|
|
498
512
|
|
|
499
513
|
async def _write_chunk(
|
|
500
514
|
self, packet: List[bytearray | bytes], response: bool, all_with_response: bool, paced: bool, label: str
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
from asyncio import sleep
|
|
2
|
+
from collections.abc import Callable
|
|
2
3
|
from typing import List
|
|
3
4
|
|
|
4
5
|
from idotmatrix.connection_manager import ConnectionManager
|
|
@@ -45,6 +46,7 @@ class IDotMatrixModule:
|
|
|
45
46
|
response: bool = False,
|
|
46
47
|
sleep_after: float = None,
|
|
47
48
|
wait_for_ack: bool = False,
|
|
49
|
+
progress: Callable[[int, int], None] | None = None,
|
|
48
50
|
):
|
|
49
51
|
"""
|
|
50
52
|
Sends multiple packets to the IDotMatrix device.
|
|
@@ -54,11 +56,15 @@ class IDotMatrixModule:
|
|
|
54
56
|
sleep_after (float, optional): Time to wait after sending the packets. Defaults to 0 if response=True and 0.5 seconds if response=False.
|
|
55
57
|
wait_for_ack (bool, optional): Whether the device has to acknowledge each packet before the next one is sent.
|
|
56
58
|
Required for uploads of images and GIFs. Defaults to False.
|
|
59
|
+
progress (Callable[[int, int], None], optional): Called with (packets done, packets in total), see
|
|
60
|
+
`ConnectionManager.send_packets`.
|
|
57
61
|
"""
|
|
58
62
|
if sleep_after is None:
|
|
59
63
|
sleep_after = 0 if response else 0.5
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
extra = {} if progress is None else {"progress": progress}
|
|
66
|
+
await self._connection_manager.send_packets(
|
|
67
|
+
packets=packets, response=response, wait_for_ack=wait_for_ack, **extra)
|
|
62
68
|
if sleep_after > 0:
|
|
63
69
|
# sometimes the device needs a moment to process the command before it is able to receive the next one
|
|
64
70
|
await sleep(sleep_after)
|