Fake accelerometer and handle hasMainSwitch

This commit is contained in:
rasta5man 2025-05-06 11:58:26 +02:00
parent 5233aa38af
commit d97d90cf95
11 changed files with 3692 additions and 549 deletions

View file

@ -24,25 +24,25 @@ exports.install = function(instance) {
instance.send(0, FLOW.GLOBALS.pinsData);
})
instance.on("4", _ => {
instance.send(0, {rpcSwitchOffLine, rpcSetNodeDimming, rpcLineProfile, rpcNodeProfile, sunCalcExample, dataFromTerminalBroadcast})
instance.send(0, { rpcSwitchOffLine, rpcSetNodeDimming, rpcLineProfile, rpcNodeProfile, sunCalcExample, dataFromTerminalBroadcast })
})
instance.on("5", _ => {
exec("sudo tail -n 25 monitor.txt" , (err, stdout, stderr) => {
if (err || stderr) instance.send(0,{err, stderr});
else instance.send(0,stdout);
exec("sudo tail -n 25 monitor.txt", (err, stdout, stderr) => {
if (err || stderr) instance.send(0, { err, stderr });
else instance.send(0, stdout);
})
})
instance.on("6", _ => {
exec("sudo tail -n 25 err.txt" , (err, stdout, stderr) => {
if (err || stderr) instance.send(0,{err, stderr});
else instance.send(0,stdout);
exec("sudo tail -n 25 err.txt", (err, stdout, stderr) => {
if (err || stderr) instance.send(0, { err, stderr });
else instance.send(0, stdout);
})
})
};
};
const rpcSwitchOffLine =
const rpcSwitchOffLine =
{
"topic": "v1/gateway/rpc",
"content": {
@ -90,7 +90,7 @@ const rpcSetNodeDimming =
}
}
const rpcLineProfile =
const rpcLineProfile =
{
"topic": "v1/gateway/rpc",
"content": {
@ -212,7 +212,7 @@ const rpcNodeProfile =
}
}
const sunCalcExample = {
const sunCalcExample = {
dusk_no_offset: '20:18',
dawn_no_offset: '05:19',
dusk: '20:18',