awtrix-ts 1.0.0 → 1.1.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/dist/api.d.ts +83 -0
- package/{api.ts → dist/api.js} +32 -63
- package/dist/demo.d.ts +1 -0
- package/dist/demo.js +75 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.js +146 -0
- package/dist/indicators.d.ts +13 -0
- package/dist/indicators.js +6 -0
- package/dist/interaction.d.ts +72 -0
- package/dist/interaction.js +27 -0
- package/dist/moodlight.d.ts +8 -0
- package/dist/moodlight.js +1 -0
- package/dist/settings.d.ts +77 -0
- package/dist/settings.js +1 -0
- package/{stats.d.ts → dist/stats.d.ts} +1 -1
- package/dist/stats.js +1 -0
- package/dist/transitions.d.ts +15 -0
- package/dist/transitions.js +14 -0
- package/package.json +20 -6
- package/indicators.ts +0 -15
- package/interaction.ts +0 -75
- package/moodlight.d.ts +0 -9
- package/settings.ts +0 -79
- package/test.js +0 -8
- package/transitions.ts +0 -17
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as interaction from './interaction.js';
|
|
2
|
+
import * as transitions from './transitions.js';
|
|
3
|
+
import * as indicators from './indicators.js';
|
|
4
|
+
import * as settings from './settings.js';
|
|
5
|
+
import * as stats from './stats.js';
|
|
6
|
+
import * as moodlight from './moodlight.js';
|
|
7
|
+
declare class Awtrix {
|
|
8
|
+
#private;
|
|
9
|
+
url: string;
|
|
10
|
+
Transitions: {
|
|
11
|
+
readonly Random: 0;
|
|
12
|
+
readonly Slide: 1;
|
|
13
|
+
readonly Dim: 2;
|
|
14
|
+
readonly Zoom: 3;
|
|
15
|
+
readonly Rotate: 4;
|
|
16
|
+
readonly Pixelate: 5;
|
|
17
|
+
readonly Curtain: 6;
|
|
18
|
+
readonly Ripple: 7;
|
|
19
|
+
readonly Blink: 8;
|
|
20
|
+
readonly Reload: 9;
|
|
21
|
+
readonly Fade: 10;
|
|
22
|
+
};
|
|
23
|
+
Indicators: {
|
|
24
|
+
readonly UpperRight: 1;
|
|
25
|
+
readonly CenterRight: 2;
|
|
26
|
+
readonly BottomRight: 3;
|
|
27
|
+
};
|
|
28
|
+
Effects: {
|
|
29
|
+
readonly BrickBreaker: "BrickBreaker";
|
|
30
|
+
readonly Checkerboard: "Checkerboard";
|
|
31
|
+
readonly Fireworks: "Fireworks";
|
|
32
|
+
readonly PingPong: "PingPong";
|
|
33
|
+
readonly Radar: "Radar";
|
|
34
|
+
readonly Ripple: "Ripple";
|
|
35
|
+
readonly Snake: "Snake";
|
|
36
|
+
readonly TwinklingStars: "TwinklingStars";
|
|
37
|
+
readonly TheaterChase: "TheaterChase";
|
|
38
|
+
readonly ColorWaves: "ColorWaves";
|
|
39
|
+
readonly SwirlOut: "SwirlOut";
|
|
40
|
+
readonly SwirlIn: "SwirlIn";
|
|
41
|
+
readonly LookingEyes: "LookingEyes";
|
|
42
|
+
readonly Matrix: "Matrix";
|
|
43
|
+
readonly Pacifica: "Pacifica";
|
|
44
|
+
readonly Plasma: "Plasma";
|
|
45
|
+
readonly PlasmaCloud: "PlasmaCloud";
|
|
46
|
+
readonly MovingLine: "MovingLine";
|
|
47
|
+
readonly Fade: "Fade";
|
|
48
|
+
};
|
|
49
|
+
PushIcon: {
|
|
50
|
+
readonly Static: 0;
|
|
51
|
+
readonly MoveOnce: 1;
|
|
52
|
+
readonly MoveRepeat: 2;
|
|
53
|
+
};
|
|
54
|
+
constructor(url: URL);
|
|
55
|
+
power(power: boolean): Promise<void>;
|
|
56
|
+
sleep(time: number): Promise<void>;
|
|
57
|
+
reboot(): Promise<void>;
|
|
58
|
+
settings(settings: settings.Settings): Promise<void>;
|
|
59
|
+
resetDefaultSettings(): Promise<void>;
|
|
60
|
+
erase(): Promise<void>;
|
|
61
|
+
screen(): Promise<string>;
|
|
62
|
+
stats(): Promise<stats.Stats>;
|
|
63
|
+
effects(): Promise<interaction.Effect[]>;
|
|
64
|
+
transitions(): Promise<transitions.Transitions[]>;
|
|
65
|
+
loop(): Promise<{
|
|
66
|
+
[app: string]: number;
|
|
67
|
+
}>;
|
|
68
|
+
playMelody(rtttl: string): Promise<void>;
|
|
69
|
+
playMelodyFile(name: string): Promise<void>;
|
|
70
|
+
setIndicator(indicator: indicators.IndicatorPayload): Promise<void>;
|
|
71
|
+
clearIndicator(indicator: indicators.Indicators): Promise<void>;
|
|
72
|
+
moodlight(setting: moodlight.MoodlightColor | moodlight.MoodlightKelvin): Promise<void>;
|
|
73
|
+
clearMoodlight(): Promise<void>;
|
|
74
|
+
notify(notification: interaction.Interaction): Promise<void>;
|
|
75
|
+
dismissNotification(): Promise<void>;
|
|
76
|
+
app(name: string, app: interaction.Interaction): Promise<void>;
|
|
77
|
+
launchApp(name: string): Promise<void>;
|
|
78
|
+
nextApp(): Promise<void>;
|
|
79
|
+
previousApp(): Promise<void>;
|
|
80
|
+
get(endpoint: string): Promise<any>;
|
|
81
|
+
post(endpoint: string, data?: object): Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
export { Awtrix };
|
package/{api.ts → dist/api.js}
RENAMED
|
@@ -1,42 +1,33 @@
|
|
|
1
1
|
import { setTimeout } from 'node:timers/promises';
|
|
2
|
-
import * as interaction from './interaction.
|
|
3
|
-
import * as transitions from './transitions.
|
|
4
|
-
import * as indicators from './indicators.
|
|
5
|
-
import * as settings from './settings.ts';
|
|
6
|
-
import './stats.d.ts';
|
|
7
|
-
import './moodlight.d.ts';
|
|
8
|
-
|
|
2
|
+
import * as interaction from './interaction.js';
|
|
3
|
+
import * as transitions from './transitions.js';
|
|
4
|
+
import * as indicators from './indicators.js';
|
|
9
5
|
class Awtrix {
|
|
10
6
|
#bootTime = 15 * 1000;
|
|
11
|
-
url
|
|
7
|
+
url;
|
|
12
8
|
Transitions = transitions.Transition;
|
|
13
9
|
Indicators = indicators.Indicator;
|
|
14
10
|
Effects = interaction.Effect;
|
|
15
11
|
PushIcon = interaction.PushIcon;
|
|
16
|
-
|
|
17
|
-
constructor(url: URL) {
|
|
12
|
+
constructor(url) {
|
|
18
13
|
this.url = url.href + 'api';
|
|
19
14
|
}
|
|
20
|
-
|
|
21
|
-
async power(power: boolean): Promise<void> {
|
|
15
|
+
async power(power) {
|
|
22
16
|
await this.post('power', { power });
|
|
23
17
|
}
|
|
24
|
-
|
|
25
|
-
async sleep(time: number): Promise<void> {
|
|
18
|
+
async sleep(time) {
|
|
26
19
|
await Promise.all([
|
|
27
20
|
await this.post('sleep', { sleep: time }),
|
|
28
21
|
await setTimeout((time * 1000) + this.#bootTime)
|
|
29
22
|
]);
|
|
30
23
|
}
|
|
31
|
-
|
|
32
|
-
async reboot(): Promise<void> {
|
|
24
|
+
async reboot() {
|
|
33
25
|
await Promise.all([
|
|
34
26
|
await this.post('reboot'),
|
|
35
27
|
await setTimeout(this.#bootTime)
|
|
36
28
|
]);
|
|
37
29
|
}
|
|
38
|
-
|
|
39
|
-
async settings(settings: settings.Settings): Promise<void> {
|
|
30
|
+
async settings(settings) {
|
|
40
31
|
await this.post('settings', {
|
|
41
32
|
ATIME: settings.appTime,
|
|
42
33
|
TEFF: settings.transitionEffect,
|
|
@@ -74,96 +65,75 @@ class Awtrix {
|
|
|
74
65
|
MATP: settings.matrixPower,
|
|
75
66
|
VOL: settings.volume,
|
|
76
67
|
OVERLAY: settings.globalEffectOverlay
|
|
77
|
-
}
|
|
68
|
+
});
|
|
78
69
|
}
|
|
79
|
-
|
|
80
|
-
async resetDefaultSettings(): Promise<void> {
|
|
70
|
+
async resetDefaultSettings() {
|
|
81
71
|
await this.post('resetSettings');
|
|
82
72
|
}
|
|
83
|
-
|
|
84
|
-
async erase(): Promise<void> {
|
|
73
|
+
async erase() {
|
|
85
74
|
await this.post('erase');
|
|
86
75
|
}
|
|
87
|
-
|
|
88
|
-
async screen(): Promise<string> {
|
|
76
|
+
async screen() {
|
|
89
77
|
return this.get('screen');
|
|
90
78
|
}
|
|
91
|
-
|
|
92
|
-
async stats(): Promise<Stats> {
|
|
79
|
+
async stats() {
|
|
93
80
|
return this.get('stats');
|
|
94
81
|
}
|
|
95
|
-
|
|
96
|
-
async effects(): Promise<interaction.Effect[]> {
|
|
82
|
+
async effects() {
|
|
97
83
|
return this.get('effects');
|
|
98
84
|
}
|
|
99
|
-
|
|
100
|
-
async transitions(): Promise<transitions.Transitions[]> {
|
|
85
|
+
async transitions() {
|
|
101
86
|
return this.get('transitions');
|
|
102
87
|
}
|
|
103
|
-
|
|
104
|
-
async loop(): Promise<{ [app: string]: number; }> {
|
|
88
|
+
async loop() {
|
|
105
89
|
return this.get('loop');
|
|
106
90
|
}
|
|
107
|
-
|
|
108
|
-
async playMelody(rtttl: string): Promise<void> {
|
|
91
|
+
async playMelody(rtttl) {
|
|
109
92
|
await this.post('rtttl', { rtttl });
|
|
110
93
|
}
|
|
111
|
-
|
|
112
|
-
async playMelodyFile(name: string): Promise<void> {
|
|
94
|
+
async playMelodyFile(name) {
|
|
113
95
|
await this.post('sound', { sound: name });
|
|
114
96
|
}
|
|
115
|
-
|
|
116
|
-
async setIndicator(indicator: indicators.IndicatorPayload): Promise<void> {
|
|
97
|
+
async setIndicator(indicator) {
|
|
117
98
|
await this.post('indicator' + indicator.position, {
|
|
118
99
|
color: indicator.color,
|
|
119
100
|
blink: indicator.blink,
|
|
120
101
|
fade: indicator.fade
|
|
121
102
|
});
|
|
122
103
|
}
|
|
123
|
-
|
|
124
|
-
async clearIndicator(indicator: indicators.Indicators): Promise<void> {
|
|
104
|
+
async clearIndicator(indicator) {
|
|
125
105
|
await this.post('indicator' + indicator);
|
|
126
106
|
}
|
|
127
|
-
|
|
128
|
-
async moodlight(setting: MoodlightColor | MoodlightKelvin): Promise<void> {
|
|
107
|
+
async moodlight(setting) {
|
|
129
108
|
await this.post('moodlight', setting);
|
|
130
109
|
}
|
|
131
|
-
|
|
132
|
-
async clearMoodlight(): Promise<void> {
|
|
110
|
+
async clearMoodlight() {
|
|
133
111
|
await this.post('moodlight');
|
|
134
112
|
}
|
|
135
|
-
|
|
136
|
-
async notify(notification: interaction.Interaction): Promise<void> {
|
|
113
|
+
async notify(notification) {
|
|
137
114
|
await this.post('notify', notification);
|
|
138
115
|
}
|
|
139
|
-
|
|
140
|
-
async dismissNotification(): Promise<void> {
|
|
116
|
+
async dismissNotification() {
|
|
141
117
|
await this.post('notify/dismiss');
|
|
142
118
|
}
|
|
143
|
-
|
|
144
|
-
async app(name: string, app: interaction.Interaction): Promise<void> {
|
|
119
|
+
async app(name, app) {
|
|
145
120
|
await this.post(`custom?name=${name}`, app);
|
|
146
121
|
}
|
|
147
|
-
|
|
148
|
-
async launchApp(name: string): Promise<void> {
|
|
122
|
+
async launchApp(name) {
|
|
149
123
|
await this.post('switch', { name });
|
|
150
124
|
}
|
|
151
|
-
|
|
152
|
-
async nextApp(): Promise<void> {
|
|
125
|
+
async nextApp() {
|
|
153
126
|
await this.post('nextapp');
|
|
154
127
|
}
|
|
155
|
-
|
|
156
|
-
async previousApp(): Promise<void> {
|
|
128
|
+
async previousApp() {
|
|
157
129
|
await this.post('previousapp');
|
|
158
130
|
}
|
|
159
|
-
|
|
160
|
-
async get(endpoint: string): Promise<any> {
|
|
131
|
+
async get(endpoint) {
|
|
161
132
|
const response = await fetch(`${this.url}/${endpoint}`);
|
|
162
|
-
const data
|
|
133
|
+
const data = await response.json();
|
|
163
134
|
return data;
|
|
164
135
|
}
|
|
165
|
-
|
|
166
|
-
async post(endpoint: string, data?: object): Promise<void> {
|
|
136
|
+
async post(endpoint, data) {
|
|
167
137
|
await fetch(`${this.url}/${endpoint}`, {
|
|
168
138
|
method: 'POST',
|
|
169
139
|
headers: {
|
|
@@ -173,5 +143,4 @@ class Awtrix {
|
|
|
173
143
|
});
|
|
174
144
|
}
|
|
175
145
|
}
|
|
176
|
-
|
|
177
146
|
export { Awtrix };
|
package/dist/demo.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/demo.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { setTimeout } from 'node:timers/promises';
|
|
2
|
+
import { Awtrix } from './api.js';
|
|
3
|
+
const clockUrl = 'http://SOME_IP_ADDRESS'; // Replace with your Awtrix clock IP address
|
|
4
|
+
const clock = new Awtrix(new URL(clockUrl));
|
|
5
|
+
// Get status
|
|
6
|
+
console.log(await clock.stats());
|
|
7
|
+
// Get app loop
|
|
8
|
+
console.log(await clock.loop());
|
|
9
|
+
// Power on/off
|
|
10
|
+
await clock.power(true);
|
|
11
|
+
await clock.power(false);
|
|
12
|
+
// Hibernate
|
|
13
|
+
await clock.sleep(5);
|
|
14
|
+
// Switch apps
|
|
15
|
+
await clock.nextApp();
|
|
16
|
+
await setTimeout(2000);
|
|
17
|
+
await clock.previousApp();
|
|
18
|
+
// Change settings
|
|
19
|
+
await clock.settings({
|
|
20
|
+
automaticAppSwitching: false,
|
|
21
|
+
globalTextColor: [0, 255, 0],
|
|
22
|
+
// ...other settings
|
|
23
|
+
});
|
|
24
|
+
// Set/clear indicators
|
|
25
|
+
await clock.setIndicator({
|
|
26
|
+
color: [255, 0, 0],
|
|
27
|
+
position: clock.Indicators.UpperRight,
|
|
28
|
+
// blink: 500, // blink every 500ms
|
|
29
|
+
// fade: 1000, // fade in duration 1000ms
|
|
30
|
+
});
|
|
31
|
+
await setTimeout(3000);
|
|
32
|
+
await clock.clearIndicator(clock.Indicators.UpperRight);
|
|
33
|
+
// Send a notification
|
|
34
|
+
await clock.notify({
|
|
35
|
+
text: 'Hello World!',
|
|
36
|
+
icon: '3049',
|
|
37
|
+
pushIcon: clock.PushIcon.MoveOnce,
|
|
38
|
+
effect: clock.Effects.PlasmaCloud,
|
|
39
|
+
repeat: 5
|
|
40
|
+
});
|
|
41
|
+
await setTimeout(10000);
|
|
42
|
+
// Dismiss a notification
|
|
43
|
+
await clock.dismissNotification();
|
|
44
|
+
// Create/update a custom app
|
|
45
|
+
await clock.app('demoApp', {
|
|
46
|
+
text: 'This is a custom app!',
|
|
47
|
+
icon: '1000',
|
|
48
|
+
repeat: 5,
|
|
49
|
+
duration: 3000,
|
|
50
|
+
effect: clock.Effects.TwinklingStars,
|
|
51
|
+
scrollSpeed: 150
|
|
52
|
+
});
|
|
53
|
+
// Launch the custom app
|
|
54
|
+
await clock.launchApp('demoApp');
|
|
55
|
+
await setTimeout(20000);
|
|
56
|
+
// Display progress bar
|
|
57
|
+
for (let i = 0; i <= 100; i++) {
|
|
58
|
+
if (i % 5 === 0) {
|
|
59
|
+
await clock.app('Progress', {
|
|
60
|
+
text: `${i}%`,
|
|
61
|
+
progress: i,
|
|
62
|
+
duration: 1,
|
|
63
|
+
});
|
|
64
|
+
if (i === 0) {
|
|
65
|
+
await clock.launchApp('Progress');
|
|
66
|
+
}
|
|
67
|
+
if (i === 100) {
|
|
68
|
+
await clock.app('Progress', {
|
|
69
|
+
text: `Done!`,
|
|
70
|
+
color: [0, 255, 0],
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
await setTimeout(500);
|
|
74
|
+
}
|
|
75
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as interaction from './interaction.js';
|
|
2
|
+
import * as transitions from './transitions.js';
|
|
3
|
+
import * as indicators from './indicators.js';
|
|
4
|
+
import * as settings from './settings.js';
|
|
5
|
+
import * as stats from './stats.js';
|
|
6
|
+
import * as moodlight from './moodlight.js';
|
|
7
|
+
declare class Awtrix {
|
|
8
|
+
#private;
|
|
9
|
+
url: string;
|
|
10
|
+
Transitions: {
|
|
11
|
+
readonly Random: 0;
|
|
12
|
+
readonly Slide: 1;
|
|
13
|
+
readonly Dim: 2;
|
|
14
|
+
readonly Zoom: 3;
|
|
15
|
+
readonly Rotate: 4;
|
|
16
|
+
readonly Pixelate: 5;
|
|
17
|
+
readonly Curtain: 6;
|
|
18
|
+
readonly Ripple: 7;
|
|
19
|
+
readonly Blink: 8;
|
|
20
|
+
readonly Reload: 9;
|
|
21
|
+
readonly Fade: 10;
|
|
22
|
+
};
|
|
23
|
+
Indicators: {
|
|
24
|
+
readonly UpperRight: 1;
|
|
25
|
+
readonly CenterRight: 2;
|
|
26
|
+
readonly BottomRight: 3;
|
|
27
|
+
};
|
|
28
|
+
Effects: {
|
|
29
|
+
readonly BrickBreaker: "BrickBreaker";
|
|
30
|
+
readonly Checkerboard: "Checkerboard";
|
|
31
|
+
readonly Fireworks: "Fireworks";
|
|
32
|
+
readonly PingPong: "PingPong";
|
|
33
|
+
readonly Radar: "Radar";
|
|
34
|
+
readonly Ripple: "Ripple";
|
|
35
|
+
readonly Snake: "Snake";
|
|
36
|
+
readonly TwinklingStars: "TwinklingStars";
|
|
37
|
+
readonly TheaterChase: "TheaterChase";
|
|
38
|
+
readonly ColorWaves: "ColorWaves";
|
|
39
|
+
readonly SwirlOut: "SwirlOut";
|
|
40
|
+
readonly SwirlIn: "SwirlIn";
|
|
41
|
+
readonly LookingEyes: "LookingEyes";
|
|
42
|
+
readonly Matrix: "Matrix";
|
|
43
|
+
readonly Pacifica: "Pacifica";
|
|
44
|
+
readonly Plasma: "Plasma";
|
|
45
|
+
readonly PlasmaCloud: "PlasmaCloud";
|
|
46
|
+
readonly MovingLine: "MovingLine";
|
|
47
|
+
readonly Fade: "Fade";
|
|
48
|
+
};
|
|
49
|
+
PushIcon: {
|
|
50
|
+
readonly Static: 0;
|
|
51
|
+
readonly MoveOnce: 1;
|
|
52
|
+
readonly MoveRepeat: 2;
|
|
53
|
+
};
|
|
54
|
+
constructor(url: URL);
|
|
55
|
+
power(power: boolean): Promise<void>;
|
|
56
|
+
sleep(time: number): Promise<void>;
|
|
57
|
+
reboot(): Promise<void>;
|
|
58
|
+
settings(settings: settings.Settings): Promise<void>;
|
|
59
|
+
resetDefaultSettings(): Promise<void>;
|
|
60
|
+
erase(): Promise<void>;
|
|
61
|
+
screen(): Promise<string>;
|
|
62
|
+
stats(): Promise<stats.Stats>;
|
|
63
|
+
effects(): Promise<interaction.Effect[]>;
|
|
64
|
+
transitions(): Promise<transitions.Transitions[]>;
|
|
65
|
+
loop(): Promise<{
|
|
66
|
+
[app: string]: number;
|
|
67
|
+
}>;
|
|
68
|
+
playMelody(rtttl: string): Promise<void>;
|
|
69
|
+
playMelodyFile(name: string): Promise<void>;
|
|
70
|
+
setIndicator(indicator: indicators.IndicatorPayload): Promise<void>;
|
|
71
|
+
clearIndicator(indicator: indicators.Indicators): Promise<void>;
|
|
72
|
+
moodlight(setting: moodlight.MoodlightColor | moodlight.MoodlightKelvin): Promise<void>;
|
|
73
|
+
clearMoodlight(): Promise<void>;
|
|
74
|
+
notify(notification: interaction.Interaction): Promise<void>;
|
|
75
|
+
dismissNotification(): Promise<void>;
|
|
76
|
+
app(name: string, app: interaction.Interaction): Promise<void>;
|
|
77
|
+
launchApp(name: string): Promise<void>;
|
|
78
|
+
nextApp(): Promise<void>;
|
|
79
|
+
previousApp(): Promise<void>;
|
|
80
|
+
get(endpoint: string): Promise<any>;
|
|
81
|
+
post(endpoint: string, data?: object): Promise<void>;
|
|
82
|
+
}
|
|
83
|
+
export { Awtrix };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { setTimeout } from 'node:timers/promises';
|
|
2
|
+
import * as interaction from './interaction.js';
|
|
3
|
+
import * as transitions from './transitions.js';
|
|
4
|
+
import * as indicators from './indicators.js';
|
|
5
|
+
class Awtrix {
|
|
6
|
+
#bootTime = 15 * 1000;
|
|
7
|
+
url;
|
|
8
|
+
Transitions = transitions.Transition;
|
|
9
|
+
Indicators = indicators.Indicator;
|
|
10
|
+
Effects = interaction.Effect;
|
|
11
|
+
PushIcon = interaction.PushIcon;
|
|
12
|
+
constructor(url) {
|
|
13
|
+
this.url = url.href + 'api';
|
|
14
|
+
}
|
|
15
|
+
async power(power) {
|
|
16
|
+
await this.post('power', { power });
|
|
17
|
+
}
|
|
18
|
+
async sleep(time) {
|
|
19
|
+
await Promise.all([
|
|
20
|
+
await this.post('sleep', { sleep: time }),
|
|
21
|
+
await setTimeout((time * 1000) + this.#bootTime)
|
|
22
|
+
]);
|
|
23
|
+
}
|
|
24
|
+
async reboot() {
|
|
25
|
+
await Promise.all([
|
|
26
|
+
await this.post('reboot'),
|
|
27
|
+
await setTimeout(this.#bootTime)
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
async settings(settings) {
|
|
31
|
+
await this.post('settings', {
|
|
32
|
+
ATIME: settings.appTime,
|
|
33
|
+
TEFF: settings.transitionEffect,
|
|
34
|
+
TSPEED: settings.transitionSpeed,
|
|
35
|
+
TCOL: settings.globalTextColor,
|
|
36
|
+
TMODE: settings.timeAppStyle,
|
|
37
|
+
CHCOL: settings.calendarHeaderColor,
|
|
38
|
+
CBCOL: settings.calendarBodyColor,
|
|
39
|
+
CTCOL: settings.calendarTextColor,
|
|
40
|
+
WD: settings.weekdayDisplay,
|
|
41
|
+
WDCA: settings.activeWeekdayColor,
|
|
42
|
+
WDCI: settings.inactiveWeekdayColor,
|
|
43
|
+
BRI: settings.matrixBrightness,
|
|
44
|
+
ABRI: settings.automaticBrightnessControl,
|
|
45
|
+
ATRANS: settings.automaticAppSwitching,
|
|
46
|
+
CCORRECTION: settings.colorCorrection,
|
|
47
|
+
CTEMP: settings.colorTemperature,
|
|
48
|
+
TFORMAT: settings.timeFormat,
|
|
49
|
+
DFORMAT: settings.dateFormat,
|
|
50
|
+
SOM: settings.startWeekOnMonday,
|
|
51
|
+
CEL: settings.celsiusTemperature,
|
|
52
|
+
BLOCKN: settings.blockNavigationKeys,
|
|
53
|
+
UPPERCASE: settings.uppercaseText,
|
|
54
|
+
TIME_COL: settings.timeAppTextColor,
|
|
55
|
+
DATE_COL: settings.dateAppTextColor,
|
|
56
|
+
TEMP_COL: settings.temperatureAppTextColor,
|
|
57
|
+
HUM_COL: settings.humidityAppTextColor,
|
|
58
|
+
BAT_COL: settings.batteryAppTextColor,
|
|
59
|
+
SSPEED: settings.scrollSpeedModification,
|
|
60
|
+
TIM: settings.enableTimeApp,
|
|
61
|
+
DAT: settings.enableDateApp,
|
|
62
|
+
HUM: settings.enableHumidityApp,
|
|
63
|
+
TEMP: settings.enableTemperatureApp,
|
|
64
|
+
BAT: settings.enableBatteryApp,
|
|
65
|
+
MATP: settings.matrixPower,
|
|
66
|
+
VOL: settings.volume,
|
|
67
|
+
OVERLAY: settings.globalEffectOverlay
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async resetDefaultSettings() {
|
|
71
|
+
await this.post('resetSettings');
|
|
72
|
+
}
|
|
73
|
+
async erase() {
|
|
74
|
+
await this.post('erase');
|
|
75
|
+
}
|
|
76
|
+
async screen() {
|
|
77
|
+
return this.get('screen');
|
|
78
|
+
}
|
|
79
|
+
async stats() {
|
|
80
|
+
return this.get('stats');
|
|
81
|
+
}
|
|
82
|
+
async effects() {
|
|
83
|
+
return this.get('effects');
|
|
84
|
+
}
|
|
85
|
+
async transitions() {
|
|
86
|
+
return this.get('transitions');
|
|
87
|
+
}
|
|
88
|
+
async loop() {
|
|
89
|
+
return this.get('loop');
|
|
90
|
+
}
|
|
91
|
+
async playMelody(rtttl) {
|
|
92
|
+
await this.post('rtttl', { rtttl });
|
|
93
|
+
}
|
|
94
|
+
async playMelodyFile(name) {
|
|
95
|
+
await this.post('sound', { sound: name });
|
|
96
|
+
}
|
|
97
|
+
async setIndicator(indicator) {
|
|
98
|
+
await this.post('indicator' + indicator.position, {
|
|
99
|
+
color: indicator.color,
|
|
100
|
+
blink: indicator.blink,
|
|
101
|
+
fade: indicator.fade
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
async clearIndicator(indicator) {
|
|
105
|
+
await this.post('indicator' + indicator);
|
|
106
|
+
}
|
|
107
|
+
async moodlight(setting) {
|
|
108
|
+
await this.post('moodlight', setting);
|
|
109
|
+
}
|
|
110
|
+
async clearMoodlight() {
|
|
111
|
+
await this.post('moodlight');
|
|
112
|
+
}
|
|
113
|
+
async notify(notification) {
|
|
114
|
+
await this.post('notify', notification);
|
|
115
|
+
}
|
|
116
|
+
async dismissNotification() {
|
|
117
|
+
await this.post('notify/dismiss');
|
|
118
|
+
}
|
|
119
|
+
async app(name, app) {
|
|
120
|
+
await this.post(`custom?name=${name}`, app);
|
|
121
|
+
}
|
|
122
|
+
async launchApp(name) {
|
|
123
|
+
await this.post('switch', { name });
|
|
124
|
+
}
|
|
125
|
+
async nextApp() {
|
|
126
|
+
await this.post('nextapp');
|
|
127
|
+
}
|
|
128
|
+
async previousApp() {
|
|
129
|
+
await this.post('previousapp');
|
|
130
|
+
}
|
|
131
|
+
async get(endpoint) {
|
|
132
|
+
const response = await fetch(`${this.url}/${endpoint}`);
|
|
133
|
+
const data = await response.json();
|
|
134
|
+
return data;
|
|
135
|
+
}
|
|
136
|
+
async post(endpoint, data) {
|
|
137
|
+
await fetch(`${this.url}/${endpoint}`, {
|
|
138
|
+
method: 'POST',
|
|
139
|
+
headers: {
|
|
140
|
+
'Content-Type': 'application/json',
|
|
141
|
+
},
|
|
142
|
+
...(data ? { body: JSON.stringify(data) } : {}),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
export { Awtrix };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface IndicatorPayload {
|
|
2
|
+
position: Indicators;
|
|
3
|
+
color: string | number[];
|
|
4
|
+
blink?: number;
|
|
5
|
+
fade?: number;
|
|
6
|
+
}
|
|
7
|
+
declare const Indicator: {
|
|
8
|
+
readonly UpperRight: 1;
|
|
9
|
+
readonly CenterRight: 2;
|
|
10
|
+
readonly BottomRight: 3;
|
|
11
|
+
};
|
|
12
|
+
export type Indicators = typeof Indicator[keyof typeof Indicator];
|
|
13
|
+
export { Indicator };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
declare module './interaction.js' {
|
|
2
|
+
interface Interaction {
|
|
3
|
+
text?: string;
|
|
4
|
+
textCase?: number;
|
|
5
|
+
topText?: boolean;
|
|
6
|
+
textOffset?: number;
|
|
7
|
+
center?: boolean;
|
|
8
|
+
color?: string | number[];
|
|
9
|
+
gradient?: (string | number)[];
|
|
10
|
+
blinkText?: number;
|
|
11
|
+
fadeText?: number;
|
|
12
|
+
background?: string | number[];
|
|
13
|
+
rainbow?: boolean;
|
|
14
|
+
icon?: string;
|
|
15
|
+
pushIcon?: PushIcon;
|
|
16
|
+
repeat?: number;
|
|
17
|
+
duration?: number;
|
|
18
|
+
hold?: boolean;
|
|
19
|
+
sound?: string;
|
|
20
|
+
rtttl?: string;
|
|
21
|
+
loopSound?: boolean;
|
|
22
|
+
bar?: number[];
|
|
23
|
+
line?: number[];
|
|
24
|
+
autoscale?: boolean;
|
|
25
|
+
barBC?: string | number[];
|
|
26
|
+
progress?: number;
|
|
27
|
+
progressC?: string | number[];
|
|
28
|
+
progressBC?: string | number[];
|
|
29
|
+
pos?: number;
|
|
30
|
+
draw?: object[];
|
|
31
|
+
lifetime?: number;
|
|
32
|
+
lifetimeMode?: number;
|
|
33
|
+
stack?: boolean;
|
|
34
|
+
wakeup?: boolean;
|
|
35
|
+
noScroll?: boolean;
|
|
36
|
+
clients?: string[];
|
|
37
|
+
scrollSpeed?: number;
|
|
38
|
+
effect?: Effect;
|
|
39
|
+
effectSettings?: Record<string, unknown>;
|
|
40
|
+
save?: boolean;
|
|
41
|
+
overlay?: string;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
declare const PushIcon: {
|
|
45
|
+
readonly Static: 0;
|
|
46
|
+
readonly MoveOnce: 1;
|
|
47
|
+
readonly MoveRepeat: 2;
|
|
48
|
+
};
|
|
49
|
+
type PushIcon = typeof PushIcon[keyof typeof PushIcon];
|
|
50
|
+
declare const Effect: {
|
|
51
|
+
readonly BrickBreaker: "BrickBreaker";
|
|
52
|
+
readonly Checkerboard: "Checkerboard";
|
|
53
|
+
readonly Fireworks: "Fireworks";
|
|
54
|
+
readonly PingPong: "PingPong";
|
|
55
|
+
readonly Radar: "Radar";
|
|
56
|
+
readonly Ripple: "Ripple";
|
|
57
|
+
readonly Snake: "Snake";
|
|
58
|
+
readonly TwinklingStars: "TwinklingStars";
|
|
59
|
+
readonly TheaterChase: "TheaterChase";
|
|
60
|
+
readonly ColorWaves: "ColorWaves";
|
|
61
|
+
readonly SwirlOut: "SwirlOut";
|
|
62
|
+
readonly SwirlIn: "SwirlIn";
|
|
63
|
+
readonly LookingEyes: "LookingEyes";
|
|
64
|
+
readonly Matrix: "Matrix";
|
|
65
|
+
readonly Pacifica: "Pacifica";
|
|
66
|
+
readonly Plasma: "Plasma";
|
|
67
|
+
readonly PlasmaCloud: "PlasmaCloud";
|
|
68
|
+
readonly MovingLine: "MovingLine";
|
|
69
|
+
readonly Fade: "Fade";
|
|
70
|
+
};
|
|
71
|
+
type Effect = typeof Effect[keyof typeof Effect];
|
|
72
|
+
export { PushIcon, Effect };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const PushIcon = {
|
|
2
|
+
Static: 0,
|
|
3
|
+
MoveOnce: 1,
|
|
4
|
+
MoveRepeat: 2
|
|
5
|
+
};
|
|
6
|
+
const Effect = {
|
|
7
|
+
BrickBreaker: "BrickBreaker",
|
|
8
|
+
Checkerboard: "Checkerboard",
|
|
9
|
+
Fireworks: "Fireworks",
|
|
10
|
+
PingPong: "PingPong",
|
|
11
|
+
Radar: "Radar",
|
|
12
|
+
Ripple: "Ripple",
|
|
13
|
+
Snake: "Snake",
|
|
14
|
+
TwinklingStars: "TwinklingStars",
|
|
15
|
+
TheaterChase: "TheaterChase",
|
|
16
|
+
ColorWaves: "ColorWaves",
|
|
17
|
+
SwirlOut: "SwirlOut",
|
|
18
|
+
SwirlIn: "SwirlIn",
|
|
19
|
+
LookingEyes: "LookingEyes",
|
|
20
|
+
Matrix: "Matrix",
|
|
21
|
+
Pacifica: "Pacifica",
|
|
22
|
+
Plasma: "Plasma",
|
|
23
|
+
PlasmaCloud: "PlasmaCloud",
|
|
24
|
+
MovingLine: "MovingLine",
|
|
25
|
+
Fade: "Fade"
|
|
26
|
+
};
|
|
27
|
+
export { PushIcon, Effect };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as transitions from './transitions.js';
|
|
2
|
+
export interface SettingsPayload {
|
|
3
|
+
ATIME?: number;
|
|
4
|
+
TEFF?: typeof transitions.Transition;
|
|
5
|
+
TSPEED?: number;
|
|
6
|
+
TCOL?: string | number[];
|
|
7
|
+
TMODE?: number;
|
|
8
|
+
CHCOL?: string | number[];
|
|
9
|
+
CBCOL?: string | number[];
|
|
10
|
+
CTCOL?: string | number[];
|
|
11
|
+
WD?: boolean;
|
|
12
|
+
WDCA?: string | number[];
|
|
13
|
+
WDCI?: string | number[];
|
|
14
|
+
BRI?: number;
|
|
15
|
+
ABRI?: boolean;
|
|
16
|
+
ATRANS?: boolean;
|
|
17
|
+
CCORRECTION?: number[];
|
|
18
|
+
CTEMP?: number[];
|
|
19
|
+
TFORMAT?: string;
|
|
20
|
+
DFORMAT?: string;
|
|
21
|
+
SOM?: boolean;
|
|
22
|
+
CEL?: boolean;
|
|
23
|
+
BLOCKN?: boolean;
|
|
24
|
+
UPPERCASE?: boolean;
|
|
25
|
+
TIME_COL?: string | number[];
|
|
26
|
+
DATE_COL?: string | number[];
|
|
27
|
+
TEMP_COL?: string | number[];
|
|
28
|
+
HUM_COL?: string | number[];
|
|
29
|
+
BAT_COL?: string | number[];
|
|
30
|
+
SSPEED?: number;
|
|
31
|
+
TIM?: boolean;
|
|
32
|
+
DAT?: boolean;
|
|
33
|
+
HUM?: boolean;
|
|
34
|
+
TEMP?: boolean;
|
|
35
|
+
BAT?: boolean;
|
|
36
|
+
MATP?: boolean;
|
|
37
|
+
VOL?: number;
|
|
38
|
+
OVERLAY?: string;
|
|
39
|
+
}
|
|
40
|
+
export interface Settings {
|
|
41
|
+
appTime?: number;
|
|
42
|
+
transitionEffect?: typeof transitions.Transition;
|
|
43
|
+
transitionSpeed?: number;
|
|
44
|
+
globalTextColor?: string | number[];
|
|
45
|
+
timeAppStyle?: number;
|
|
46
|
+
calendarHeaderColor?: string | number[];
|
|
47
|
+
calendarBodyColor?: string | number[];
|
|
48
|
+
calendarTextColor?: string | number[];
|
|
49
|
+
weekdayDisplay?: boolean;
|
|
50
|
+
activeWeekdayColor?: string | number[];
|
|
51
|
+
inactiveWeekdayColor?: string | number[];
|
|
52
|
+
matrixBrightness?: number;
|
|
53
|
+
automaticBrightnessControl?: boolean;
|
|
54
|
+
automaticAppSwitching?: boolean;
|
|
55
|
+
colorCorrection?: number[];
|
|
56
|
+
colorTemperature?: number[];
|
|
57
|
+
timeFormat?: string;
|
|
58
|
+
dateFormat?: string;
|
|
59
|
+
startWeekOnMonday?: boolean;
|
|
60
|
+
celsiusTemperature?: boolean;
|
|
61
|
+
blockNavigationKeys?: boolean;
|
|
62
|
+
uppercaseText?: boolean;
|
|
63
|
+
timeAppTextColor?: string | number[];
|
|
64
|
+
dateAppTextColor?: string | number[];
|
|
65
|
+
temperatureAppTextColor?: string | number[];
|
|
66
|
+
humidityAppTextColor?: string | number[];
|
|
67
|
+
batteryAppTextColor?: string | number[];
|
|
68
|
+
scrollSpeedModification?: number;
|
|
69
|
+
enableTimeApp?: boolean;
|
|
70
|
+
enableDateApp?: boolean;
|
|
71
|
+
enableHumidityApp?: boolean;
|
|
72
|
+
enableTemperatureApp?: boolean;
|
|
73
|
+
enableBatteryApp?: boolean;
|
|
74
|
+
matrixPower?: boolean;
|
|
75
|
+
volume?: number;
|
|
76
|
+
globalEffectOverlay?: string;
|
|
77
|
+
}
|
package/dist/settings.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/stats.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const Transition: {
|
|
2
|
+
readonly Random: 0;
|
|
3
|
+
readonly Slide: 1;
|
|
4
|
+
readonly Dim: 2;
|
|
5
|
+
readonly Zoom: 3;
|
|
6
|
+
readonly Rotate: 4;
|
|
7
|
+
readonly Pixelate: 5;
|
|
8
|
+
readonly Curtain: 6;
|
|
9
|
+
readonly Ripple: 7;
|
|
10
|
+
readonly Blink: 8;
|
|
11
|
+
readonly Reload: 9;
|
|
12
|
+
readonly Fade: 10;
|
|
13
|
+
};
|
|
14
|
+
export type Transitions = keyof typeof Transition;
|
|
15
|
+
export { Transition };
|
package/package.json
CHANGED
|
@@ -1,18 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "awtrix-ts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "TypeScript API for Awtrix LED Matrix Display",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/gledrich/awtrix-ts.git"
|
|
8
8
|
},
|
|
9
|
-
"main": "api.ts",
|
|
10
9
|
"type": "module",
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"src/**/*.d.ts"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc",
|
|
24
|
+
"prepublishOnly": "npm run build"
|
|
25
|
+
},
|
|
11
26
|
"devDependencies": {
|
|
12
27
|
"eslint": "^9.39.2",
|
|
13
|
-
"eslint-config": "github:7digital/eslint-config"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"@types/node": "^25.0.3"
|
|
28
|
+
"eslint-config": "github:7digital/eslint-config",
|
|
29
|
+
"@types/node": "^25.0.3",
|
|
30
|
+
"typescript": "^5.9.3"
|
|
17
31
|
}
|
|
18
32
|
}
|
package/indicators.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
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
DELETED
package/settings.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
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/test.js
DELETED
package/transitions.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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 };
|