funky serialisation for serial
This commit is contained in:
parent
c3f03f50b3
commit
34ba762b42
1 changed files with 21 additions and 2 deletions
|
|
@ -43,8 +43,27 @@ Pattern.prototype.serial = async function (...args) {
|
||||||
const onTrigger = (time, hap, currentTime) => {
|
const onTrigger = (time, hap, currentTime) => {
|
||||||
var message = "";
|
var message = "";
|
||||||
if (typeof hap.value === 'object') {
|
if (typeof hap.value === 'object') {
|
||||||
for (const [key, val] of Object.entries(hap.value).flat()) {
|
if ('what' in hap.value) {
|
||||||
message += `${key}:${val};`
|
message += hap.value['what'] + '(';
|
||||||
|
var first = true;
|
||||||
|
for (const [key, val] of Object.entries(hap.value)) {
|
||||||
|
if (key === 'what') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (first) {
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
message +=',';
|
||||||
|
}
|
||||||
|
message += `${key}:${val}`
|
||||||
|
}
|
||||||
|
message += ')';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (const [key, val] of Object.entries(hap.value)) {
|
||||||
|
message += `${key}:${val};`
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue