awtrix-ts 1.0.0

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.
package/README.md ADDED
@@ -0,0 +1,252 @@
1
+ # awtrix-ts
2
+
3
+ TS wrapper for Awtrix API.
4
+
5
+ ## Awtrix API
6
+
7
+ The `Awtrix` class provides a TypeScript interface for interacting with the Awtrix device API. It supports device control, settings management, notifications, app switching, indicators, moodlight, and more.
8
+
9
+ ### Usage
10
+
11
+ ```typescript
12
+ import { Awtrix } from './api.ts';
13
+
14
+ const awtrix = new Awtrix(new URL('http://your-awtrix-device-ip'));
15
+
16
+ await awtrix.power(true); // Turn device on
17
+ await awtrix.notify({ text: 'Hello World!' }); // Send a notification
18
+ ```
19
+
20
+ ### Methods
21
+
22
+ #### power(power: boolean)
23
+
24
+ Turn the device on or off.
25
+
26
+ ```typescript
27
+ await clock.power(true); // Turn on
28
+ await clock.power(false); // Turn off
29
+ ```
30
+
31
+ #### reboot()
32
+
33
+ Reboot the device.
34
+
35
+ ```typescript
36
+ await clock.reboot();
37
+ ```
38
+
39
+ #### sleep(time: number)
40
+
41
+ Put the device to sleep for a specified time (in seconds).
42
+
43
+ ```typescript
44
+ await clock.sleep(5); // Sleep for 5 seconds
45
+ ```
46
+
47
+ #### settings(settings: Settings)
48
+
49
+ Update device settings.
50
+
51
+ ```typescript
52
+ await clock.settings({
53
+ automaticAppSwitching: false,
54
+ globalTextColor: [0, 255, 0],
55
+ // ...other settings
56
+ });
57
+ ```
58
+
59
+ #### resetDefaultSettings()
60
+
61
+ Resets the device settings back to default.
62
+
63
+ ```typescript
64
+ await clock.resetDefaultSettings();
65
+ ```
66
+
67
+ #### erase()
68
+
69
+ Factory resets the device. Does not modify WiFi settings.
70
+
71
+ ```typescript
72
+ await clock.erase();
73
+ ```
74
+
75
+ #### screen()
76
+
77
+ Get the current screen content.
78
+
79
+ ```typescript
80
+ const screen = await clock.screen();
81
+ ```
82
+
83
+ #### stats()
84
+
85
+ Retrieve device statistics.
86
+
87
+ ```typescript
88
+ console.log(await clock.stats());
89
+ ```
90
+
91
+ #### effects()
92
+
93
+ List available effects.
94
+
95
+ ```typescript
96
+ const effects = await clock.effects();
97
+ ```
98
+
99
+ #### transitions()
100
+
101
+ List available transitions.
102
+
103
+ ```typescript
104
+ const transitions = await clock.transitions();
105
+ ```
106
+
107
+ #### loop()
108
+
109
+ Get the app loop configuration.
110
+
111
+ ```typescript
112
+ console.log(await clock.loop());
113
+ ```
114
+
115
+ #### playMelody(rtttl: string)
116
+
117
+ Play a melody using RTTTL format.
118
+
119
+ ```typescript
120
+ await clock.playMelody('d=4,o=5,b=140:c6,e6,g6');
121
+ ```
122
+
123
+ #### playMelodyFile(name: string)
124
+
125
+ Play a melody file by name.
126
+
127
+ ```typescript
128
+ await clock.playMelodyFile('melody.mp3');
129
+ ```
130
+
131
+ #### setIndicator(indicator: IndicatorPayload)
132
+
133
+ Set an indicator LED.
134
+
135
+ ```typescript
136
+ await clock.setIndicator({
137
+ color: [255, 0, 0],
138
+ position: clock.Indicators.UpperRight,
139
+ // blink: 500,
140
+ // fade: 1000,
141
+ });
142
+ ```
143
+
144
+ #### clearIndicator(indicator: Indicators)
145
+
146
+ Clear an indicator LED.
147
+
148
+ ```typescript
149
+ await clock.clearIndicator(clock.Indicators.UpperRight);
150
+ ```
151
+
152
+ #### moodlight(setting: MoodlightColor | MoodlightKelvin)
153
+
154
+ Set moodlight color or temperature.
155
+
156
+ ```typescript
157
+ await clock.moodlight({ r: 255, g: 255, b: 255 });
158
+ ```
159
+
160
+ #### clearMoodlight()
161
+
162
+ Turn off moodlight.
163
+
164
+ ```typescript
165
+ await clock.clearMoodlight();
166
+ ```
167
+
168
+ #### notify(notification: Interaction)
169
+
170
+ Send a notification.
171
+
172
+ ```typescript
173
+ await clock.notify({
174
+ text: 'Hello World!',
175
+ icon: '3049',
176
+ pushIcon: clock.PushIcon.MoveOnce,
177
+ effect: clock.Effects.PlasmaCloud,
178
+ repeat: 5,
179
+ });
180
+ ```
181
+
182
+ #### dismissNotification()
183
+
184
+ Dismiss the current notification.
185
+
186
+ ```typescript
187
+ await clock.dismissNotification();
188
+ ```
189
+
190
+ #### app(name: string, app: Interaction)
191
+
192
+ Send a custom app payload.
193
+
194
+ ```typescript
195
+ await clock.app('demoApp', {
196
+ text: 'This is a custom app!',
197
+ icon: '1000',
198
+ repeat: 5,
199
+ duration: 3000,
200
+ effect: clock.Effects.TwinklingStars,
201
+ scrollSpeed: 150,
202
+ });
203
+ ```
204
+
205
+ #### launchApp(name: string)
206
+
207
+ Launch an app by name.
208
+
209
+ ```typescript
210
+ await clock.launchApp('demoApp');
211
+ ```
212
+
213
+ #### nextApp(), previousApp()
214
+
215
+ Switch between apps.
216
+
217
+ ```typescript
218
+ await clock.nextApp();
219
+ await setTimeout(2000);
220
+ await clock.previousApp();
221
+ ```
222
+
223
+ #### Progress Bar Example
224
+
225
+ Display a progress bar using a custom app:
226
+
227
+ ```typescript
228
+ for (let i = 0; i <= 100; i++) {
229
+ if (i % 5 === 0) {
230
+ await clock.app('Progress', {
231
+ text: `${i}%`,
232
+ progress: i,
233
+ duration: 1,
234
+ });
235
+ if (i === 0) {
236
+ await clock.launchApp('Progress');
237
+ }
238
+ if (i === 100) {
239
+ await clock.app('Progress', {
240
+ text: `Done!`,
241
+ color: [0, 255, 0],
242
+ });
243
+ }
244
+ await setTimeout(500);
245
+ }
246
+ }
247
+ ```
248
+
249
+ ### Other
250
+
251
+ - All API calls are asynchronous and return Promises.
252
+ - The class exposes enums for transitions, indicators, and effects for convenience.
package/api.ts ADDED
@@ -0,0 +1,177 @@
1
+ import { setTimeout } from 'node:timers/promises';
2
+ import * as interaction from './interaction.ts';
3
+ import * as transitions from './transitions.ts';
4
+ import * as indicators from './indicators.ts';
5
+ import * as settings from './settings.ts';
6
+ import './stats.d.ts';
7
+ import './moodlight.d.ts';
8
+
9
+ class Awtrix {
10
+ #bootTime = 15 * 1000;
11
+ url: string;
12
+ Transitions = transitions.Transition;
13
+ Indicators = indicators.Indicator;
14
+ Effects = interaction.Effect;
15
+ PushIcon = interaction.PushIcon;
16
+
17
+ constructor(url: URL) {
18
+ this.url = url.href + 'api';
19
+ }
20
+
21
+ async power(power: boolean): Promise<void> {
22
+ await this.post('power', { power });
23
+ }
24
+
25
+ async sleep(time: number): Promise<void> {
26
+ await Promise.all([
27
+ await this.post('sleep', { sleep: time }),
28
+ await setTimeout((time * 1000) + this.#bootTime)
29
+ ]);
30
+ }
31
+
32
+ async reboot(): Promise<void> {
33
+ await Promise.all([
34
+ await this.post('reboot'),
35
+ await setTimeout(this.#bootTime)
36
+ ]);
37
+ }
38
+
39
+ async settings(settings: settings.Settings): Promise<void> {
40
+ await this.post('settings', {
41
+ ATIME: settings.appTime,
42
+ TEFF: settings.transitionEffect,
43
+ TSPEED: settings.transitionSpeed,
44
+ TCOL: settings.globalTextColor,
45
+ TMODE: settings.timeAppStyle,
46
+ CHCOL: settings.calendarHeaderColor,
47
+ CBCOL: settings.calendarBodyColor,
48
+ CTCOL: settings.calendarTextColor,
49
+ WD: settings.weekdayDisplay,
50
+ WDCA: settings.activeWeekdayColor,
51
+ WDCI: settings.inactiveWeekdayColor,
52
+ BRI: settings.matrixBrightness,
53
+ ABRI: settings.automaticBrightnessControl,
54
+ ATRANS: settings.automaticAppSwitching,
55
+ CCORRECTION: settings.colorCorrection,
56
+ CTEMP: settings.colorTemperature,
57
+ TFORMAT: settings.timeFormat,
58
+ DFORMAT: settings.dateFormat,
59
+ SOM: settings.startWeekOnMonday,
60
+ CEL: settings.celsiusTemperature,
61
+ BLOCKN: settings.blockNavigationKeys,
62
+ UPPERCASE: settings.uppercaseText,
63
+ TIME_COL: settings.timeAppTextColor,
64
+ DATE_COL: settings.dateAppTextColor,
65
+ TEMP_COL: settings.temperatureAppTextColor,
66
+ HUM_COL: settings.humidityAppTextColor,
67
+ BAT_COL: settings.batteryAppTextColor,
68
+ SSPEED: settings.scrollSpeedModification,
69
+ TIM: settings.enableTimeApp,
70
+ DAT: settings.enableDateApp,
71
+ HUM: settings.enableHumidityApp,
72
+ TEMP: settings.enableTemperatureApp,
73
+ BAT: settings.enableBatteryApp,
74
+ MATP: settings.matrixPower,
75
+ VOL: settings.volume,
76
+ OVERLAY: settings.globalEffectOverlay
77
+ } as settings.SettingsPayload);
78
+ }
79
+
80
+ async resetDefaultSettings(): Promise<void> {
81
+ await this.post('resetSettings');
82
+ }
83
+
84
+ async erase(): Promise<void> {
85
+ await this.post('erase');
86
+ }
87
+
88
+ async screen(): Promise<string> {
89
+ return this.get('screen');
90
+ }
91
+
92
+ async stats(): Promise<Stats> {
93
+ return this.get('stats');
94
+ }
95
+
96
+ async effects(): Promise<interaction.Effect[]> {
97
+ return this.get('effects');
98
+ }
99
+
100
+ async transitions(): Promise<transitions.Transitions[]> {
101
+ return this.get('transitions');
102
+ }
103
+
104
+ async loop(): Promise<{ [app: string]: number; }> {
105
+ return this.get('loop');
106
+ }
107
+
108
+ async playMelody(rtttl: string): Promise<void> {
109
+ await this.post('rtttl', { rtttl });
110
+ }
111
+
112
+ async playMelodyFile(name: string): Promise<void> {
113
+ await this.post('sound', { sound: name });
114
+ }
115
+
116
+ async setIndicator(indicator: indicators.IndicatorPayload): Promise<void> {
117
+ await this.post('indicator' + indicator.position, {
118
+ color: indicator.color,
119
+ blink: indicator.blink,
120
+ fade: indicator.fade
121
+ });
122
+ }
123
+
124
+ async clearIndicator(indicator: indicators.Indicators): Promise<void> {
125
+ await this.post('indicator' + indicator);
126
+ }
127
+
128
+ async moodlight(setting: MoodlightColor | MoodlightKelvin): Promise<void> {
129
+ await this.post('moodlight', setting);
130
+ }
131
+
132
+ async clearMoodlight(): Promise<void> {
133
+ await this.post('moodlight');
134
+ }
135
+
136
+ async notify(notification: interaction.Interaction): Promise<void> {
137
+ await this.post('notify', notification);
138
+ }
139
+
140
+ async dismissNotification(): Promise<void> {
141
+ await this.post('notify/dismiss');
142
+ }
143
+
144
+ async app(name: string, app: interaction.Interaction): Promise<void> {
145
+ await this.post(`custom?name=${name}`, app);
146
+ }
147
+
148
+ async launchApp(name: string): Promise<void> {
149
+ await this.post('switch', { name });
150
+ }
151
+
152
+ async nextApp(): Promise<void> {
153
+ await this.post('nextapp');
154
+ }
155
+
156
+ async previousApp(): Promise<void> {
157
+ await this.post('previousapp');
158
+ }
159
+
160
+ async get(endpoint: string): Promise<any> {
161
+ const response = await fetch(`${this.url}/${endpoint}`);
162
+ const data: any = await response.json();
163
+ return data;
164
+ }
165
+
166
+ async post(endpoint: string, data?: object): Promise<void> {
167
+ await fetch(`${this.url}/${endpoint}`, {
168
+ method: 'POST',
169
+ headers: {
170
+ 'Content-Type': 'application/json',
171
+ },
172
+ ...(data ? { body: JSON.stringify(data) } : {}),
173
+ });
174
+ }
175
+ }
176
+
177
+ export { Awtrix };
package/indicators.ts ADDED
@@ -0,0 +1,15 @@
1
+ export interface IndicatorPayload {
2
+ position: Indicators;
3
+ color: string | number[];
4
+ blink?: number; // interval in ms
5
+ fade?: number; // duration in ms
6
+ }
7
+
8
+ const Indicator = {
9
+ UpperRight: 1,
10
+ CenterRight: 2,
11
+ BottomRight: 3
12
+ } as const;
13
+
14
+ export type Indicators = typeof Indicator[keyof typeof Indicator];
15
+ export { Indicator };
package/interaction.ts ADDED
@@ -0,0 +1,75 @@
1
+ export interface Interaction {
2
+ text?: string; // The text to display
3
+ textCase?: number; // Changes the Uppercase setting. 0=global setting, 1 = forces uppercase; 2 = shows as sent.
4
+ topText?: boolean; // Draw the text on top.
5
+ textOffset?: number; // Sets an offset for the x position of a starting text.
6
+ center?: boolean; // Centers a short, non-scrollable text.
7
+ color?: string | number[]; // The text, bar or line color.
8
+ gradient?: (string | number)[]; // Colorizes the text in a gradient of two given colors.
9
+ blinkText?: number; // Blinks the text in an given interval in ms, not compatible with gradient or rainbow.
10
+ fadeText?: number; // Fades the text on and off in an given interval, not compatible with gradient or rainbow.
11
+ background?: string | number[]; // Sets a background color.
12
+ rainbow?: boolean; // Fades each letter in the text differently through the entire RGB spectrum.
13
+ icon?: string; // The icon ID or filename (without extension) to display on the app. You can also send a 8x8 jpg as Base64 string.
14
+ pushIcon?: PushIcon; // 0 = Icon doesn't move. 1 = Icon moves with text and will not appear again. 2 = Icon moves with text but appears again when the text starts to scroll again.
15
+ repeat?: number; // Sets how many times the text should be scrolled through the matrix before the app ends.
16
+ duration?: number; // Sets how long the app or notification should be displayed.
17
+ hold?: boolean; // Set it to true, to hold your notification on top until you press the middle button or dismiss it via HomeAssistant. This key only belongs to notification.
18
+ sound?: string; // The filename of your RTTTL ringtone file placed in the MELODIES folder (without extension). Or the 4 digit number of your MP3 if you're using a DFplayer.
19
+ rtttl?: string; // Allows to send the RTTTL sound string with JSON.
20
+ loopSound?: boolean; // Loops the sound or RTTTL as long as the notification is running.
21
+ bar?: number[]; // Draws a bargraph. Without icon maximum 16 values, with icon 11 values.
22
+ line?: number[]; // Draws a linechart. Without icon maximum 16 values, with icon 11 values.
23
+ autoscale?: boolean; // Enables or disables autoscaling for bar and linechart.
24
+ barBC?: string | number[]; // Backgroundcolor of the bars.
25
+ progress?: number; // Shows a progress bar. Value can be 0–100.
26
+ progressC?: string | number[]; // The color of the progress bar.
27
+ progressBC?: string | number[]; // The color of the progress bar background.
28
+ pos?: number; // Defines the position of your custom page in the loop, starting at 0 for the first position. This will only apply with your first push. This function is experimental.
29
+ draw?: object[]; // Array of drawing instructions. Each object represents a drawing command. See the drawing instructions below.
30
+ lifetime?: number; // Removes the custom app when there is no update after the given time in seconds.
31
+ lifetimeMode?: number; // 0 = deletes the app, 1 = marks it as staled with a red rectangle around the app.
32
+ stack?: boolean; // Defines if the notification will be stacked. false will immediately replace the current notification.
33
+ wakeup?: boolean; // If the Matrix is off, the notification will wake it up for the time of the notification.
34
+ noScroll?: boolean; // Disables the text scrolling.
35
+ clients?: string[]; // Allows forwarding a notification to other AWTRIX devices. Use the MQTT prefix for MQTT and IP addresses for HTTP.
36
+ scrollSpeed?: number; // Modifies the scroll speed. Enter a percentage value of the original scroll speed.
37
+ effect?: Effect; // Shows an effect as background. The effect can be removed by sending an empty string for effect.
38
+ effectSettings?: Record<string, unknown>; // Changes color and speed of the effect.
39
+ save?: boolean; // Saves your custom app into flash and reloads it after boot. Avoid this for custom apps with high update frequencies because the ESP's flash memory has limited write cycles.
40
+ overlay?: string; // Sets an effect overlay (cannot be used with global overlays).
41
+ }
42
+
43
+ const PushIcon = {
44
+ Static: 0,
45
+ MoveOnce: 1,
46
+ MoveRepeat: 2
47
+ } as const;
48
+
49
+ type PushIcon = typeof PushIcon[keyof typeof PushIcon];
50
+
51
+ const Effect = {
52
+ BrickBreaker: "BrickBreaker",
53
+ Checkerboard: "Checkerboard",
54
+ Fireworks: "Fireworks",
55
+ PingPong: "PingPong",
56
+ Radar: "Radar",
57
+ Ripple: "Ripple",
58
+ Snake: "Snake",
59
+ TwinklingStars: "TwinklingStars",
60
+ TheaterChase: "TheaterChase",
61
+ ColorWaves: "ColorWaves",
62
+ SwirlOut: "SwirlOut",
63
+ SwirlIn: "SwirlIn",
64
+ LookingEyes: "LookingEyes",
65
+ Matrix: "Matrix",
66
+ Pacifica: "Pacifica",
67
+ Plasma: "Plasma",
68
+ PlasmaCloud: "PlasmaCloud",
69
+ MovingLine: "MovingLine",
70
+ Fade: "Fade"
71
+ } as const;
72
+
73
+ type Effect = typeof Effect[keyof typeof Effect];
74
+
75
+ export { PushIcon, Effect };
package/moodlight.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ interface MoodlightKelvin {
2
+ brightness: number;
3
+ kelvin: number;
4
+ }
5
+
6
+ interface MoodlightColor {
7
+ brightness: number;
8
+ color: string;
9
+ }
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "awtrix-ts",
3
+ "version": "1.0.0",
4
+ "description": "TypeScript API for Awtrix LED Matrix Display",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/gledrich/awtrix-ts.git"
8
+ },
9
+ "main": "api.ts",
10
+ "type": "module",
11
+ "devDependencies": {
12
+ "eslint": "^9.39.2",
13
+ "eslint-config": "github:7digital/eslint-config"
14
+ },
15
+ "dependencies": {
16
+ "@types/node": "^25.0.3"
17
+ }
18
+ }
package/settings.ts ADDED
@@ -0,0 +1,79 @@
1
+ import * as transitions from './transitions.ts';
2
+
3
+ export interface SettingsPayload {
4
+ ATIME?: number; // Duration an app is displayed in seconds.
5
+ TEFF?: number; // Choose between app transition effects.
6
+ TSPEED?: number; // Time taken for the transition to the next app in milliseconds.
7
+ TCOL?: string | number[]; // Global text color.
8
+ TMODE?: number; // Changes the time app style.
9
+ CHCOL?: string | number[]; // Calendar header color of the time app.
10
+ CBCOL?: string | number[]; // Calendar body color of the time app.
11
+ CTCOL?: string | number[]; // Calendar text color in the time app.
12
+ WD?: boolean; // Enable or disable the weekday display.
13
+ WDCA?: string | number[]; // Active weekday color.
14
+ WDCI?: string | number[]; // Inactive weekday color.
15
+ BRI?: number; // Matrix brightness.
16
+ ABRI?: boolean; // Automatic brightness control.
17
+ ATRANS?: boolean; // Automatic switching to the next app.
18
+ CCORRECTION?: number[]; // Color correction for the matrix.
19
+ CTEMP?: number[]; // Color temperature for the matrix.
20
+ TFORMAT?: string; // Time format for the TimeApp.
21
+ DFORMAT?: string; // Date format for the DateApp.
22
+ SOM?: boolean; // Start the week on Monday.
23
+ CEL?: boolean; // Shows the temperature in Celsius (Fahrenheit when false).
24
+ BLOCKN?: boolean; // Block physical navigation keys (still sends input to MQTT).
25
+ UPPERCASE?: boolean; // Display text in uppercase.
26
+ TIME_COL?: string | number[]; // Text color of the time app. Use 0 for global text color.
27
+ DATE_COL?: string | number[]; // Text color of the date app. Use 0 for global text color.
28
+ TEMP_COL?: string | number[]; // Text color of the temperature app. Use 0 for global text color.
29
+ HUM_COL?: string | number[]; // Text color of the humidity app. Use 0 for global text color.
30
+ BAT_COL?: string | number[]; // Text color of the battery app. Use 0 for global text color.
31
+ SSPEED?: number; // Scroll speed modification.
32
+ TIM?: boolean; // Enable or disable the native time app (requires reboot).
33
+ DAT?: boolean; // Enable or disable the native date app (requires reboot).
34
+ HUM?: boolean; // Enable or disable the native humidity app (requires reboot).
35
+ TEMP?: boolean; // Enable or disable the native temperature app (requires reboot).
36
+ BAT?: boolean; // Enable or disable the native battery app (requires reboot).
37
+ MATP?: boolean; // Enable or disable the matrix. Similar to power endpoint but without the animation.
38
+ VOL?: number; // Allows to set the volume of the buzzer and DFplayer.
39
+ OVERLAY?: string; // Sets a global effect overlay (cannot be used with app specific overlays).
40
+ }
41
+
42
+ export interface Settings {
43
+ appTime?: number;
44
+ transitionEffect?: transitions.Transitions;
45
+ transitionSpeed?: number;
46
+ globalTextColor?: string | number[];
47
+ timeAppStyle?: number;
48
+ calendarHeaderColor?: string | number[];
49
+ calendarBodyColor?: string | number[];
50
+ calendarTextColor?: string | number[];
51
+ weekdayDisplay?: boolean;
52
+ activeWeekdayColor?: string | number[];
53
+ inactiveWeekdayColor?: string | number[];
54
+ matrixBrightness?: number;
55
+ automaticBrightnessControl?: boolean;
56
+ automaticAppSwitching?: boolean;
57
+ colorCorrection?: number[];
58
+ colorTemperature?: number[];
59
+ timeFormat?: string;
60
+ dateFormat?: string;
61
+ startWeekOnMonday?: boolean;
62
+ celsiusTemperature?: boolean;
63
+ blockNavigationKeys?: boolean;
64
+ uppercaseText?: boolean;
65
+ timeAppTextColor?: string | number[];
66
+ dateAppTextColor?: string | number[];
67
+ temperatureAppTextColor?: string | number[];
68
+ humidityAppTextColor?: string | number[];
69
+ batteryAppTextColor?: string | number[];
70
+ scrollSpeedModification?: number;
71
+ enableTimeApp?: boolean;
72
+ enableDateApp?: boolean;
73
+ enableHumidityApp?: boolean;
74
+ enableTemperatureApp?: boolean;
75
+ enableBatteryApp?: boolean;
76
+ matrixPower?: boolean;
77
+ volume?: number;
78
+ globalEffectOverlay?: string;
79
+ }
package/stats.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ interface Stats {
2
+ bat: number;
3
+ bat_raw: number;
4
+ type: number;
5
+ lux: number;
6
+ ldr_raw: number;
7
+ ram: number;
8
+ bri: number;
9
+ temp: number;
10
+ hum: number;
11
+ uptime: number;
12
+ wifi_signal: number;
13
+ messages: number;
14
+ version: string;
15
+ indicator1: boolean;
16
+ indicator2: boolean;
17
+ indicator3: boolean;
18
+ app: string;
19
+ uid: string;
20
+ matrix: boolean;
21
+ ip_address: string;
22
+ }
package/test.js ADDED
@@ -0,0 +1,8 @@
1
+ import { setTimeout } from 'node:timers/promises';
2
+ import { Awtrix } from './api.ts';
3
+
4
+ const clockUrl = 'http://192.168.1.109';
5
+
6
+ const clock = new Awtrix(new URL(clockUrl));
7
+
8
+ await clock.resetDefaultSettings();
package/transitions.ts ADDED
@@ -0,0 +1,17 @@
1
+ const Transition = {
2
+ Random: 0,
3
+ Slide: 1,
4
+ Dim: 2,
5
+ Zoom: 3,
6
+ Rotate: 4,
7
+ Pixelate: 5,
8
+ Curtain: 6,
9
+ Ripple: 7,
10
+ Blink: 8,
11
+ Reload: 9,
12
+ Fade: 10
13
+ } as const;
14
+
15
+ export type Transitions = keyof typeof Transition;
16
+
17
+ export { Transition };