-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.js
54 lines (48 loc) · 1.13 KB
/
constants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
export const HEADERS = [
"timestamp",
"state",
"isOn",
"currentGrillTemp",
"desiredGrillTemp",
"currentProbe1Temp",
"desiredProbe1Temp",
"currentProbe2Temp",
"desiredProbe2Temp",
"fanModeActive",
"lowPelletAlarmActive",
];
export const COMMANDS = Object.freeze({
powerOn: "UK001!",
powerOnColdSmoke: "UK002!",
powerOff: "UK004!",
getGrillStatus: "UR001!",
getGrillId: "UL!",
setGrillTempF: (temp) => `UT${temp}!`,
setProbe1TempF: (temp) => `UF${temp}!`,
setProbe2TempF: (temp) => `Uf${temp}!`,
// setPizzaMode: 'UC.+ 2 !',
// setRegularMode: 'UC.+ 9 !'
});
String.prototype.replaceAt = function (index, replacement) {
return (
this.substr(0, index) +
replacement +
this.substr(index + replacement.length)
);
};
export const HEX_COMMANDS = Object.freeze({
setPizzaMode: (settings) => {
const mode = `55430${settings.replaceAt(1, '2')}21`;
return mode;
},
setRegularMode: (settings) => {
const mode = `55430${settings.replaceAt(1, '0')}21`;
return mode;
},
});
// UN - what does this do?
// UF150
// Uf150
// used to work
// 5543052b023220202020
// 52b14321919191921