Handle NOK master_node
This commit is contained in:
parent
63504df84d
commit
613d846dbe
2 changed files with 18 additions and 28 deletions
|
|
@ -1239,7 +1239,7 @@ exports.install = function(instance) {
|
|||
params.address = 0;
|
||||
params.timestamp = Date.now() + 60000;
|
||||
params.addMinutesToTimestamp = 5;
|
||||
params.tbname = rvoTbName;
|
||||
params.tbname = SETTINGS.rvoTbName;
|
||||
params.info = "Master node FW verzia";
|
||||
//params.debug = true;
|
||||
|
||||
|
|
@ -1591,13 +1591,13 @@ exports.install = function(instance) {
|
|||
}
|
||||
}
|
||||
|
||||
let contactorStatus = 1;
|
||||
if(relaysData[line] != undefined) contactorStatus = relaysData[line].contactor;
|
||||
let contactorStatus = 1;
|
||||
if (relaysData[line] != undefined) contactorStatus = relaysData[line].contactor;
|
||||
|
||||
if (line == 0 || contactorStatus == 0) {
|
||||
interval = setInterval(runTasks, LONG_INTERVAL);
|
||||
return;
|
||||
}
|
||||
if (line == 0 || contactorStatus == 0) {
|
||||
interval = setInterval(runTasks, LONG_INTERVAL);
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: -> status offline for rvo if rotary_switch_state is OFF, this is source of errors
|
||||
//
|
||||
|
|
@ -1629,13 +1629,9 @@ exports.install = function(instance) {
|
|||
//set actual time for broadcast
|
||||
if (register == 87 && params.recipient === 2) {
|
||||
var d = new Date();
|
||||
let hours = d.getHours();
|
||||
let minutes = d.getMinutes();
|
||||
let seconds = d.getSeconds();
|
||||
|
||||
params.byte1 = hours;//h
|
||||
params.byte2 = minutes;//m
|
||||
params.byte3 = seconds;//s
|
||||
params.byte1 = d.getHours();//h
|
||||
params.byte2 = d.getMinutes();//m
|
||||
params.byte3 = 0;//s
|
||||
params.byte4 = 0;
|
||||
}
|
||||
|
||||
|
|
@ -1645,11 +1641,8 @@ exports.install = function(instance) {
|
|||
|
||||
if (type != "cmd-terminal") {
|
||||
let sunCalcResult = calculateDuskDawn();
|
||||
let dusk_hours = sunCalcResult["dusk_hours"];
|
||||
let dusk_minutes = sunCalcResult["dusk_minutes"];
|
||||
|
||||
params.byte1 = dusk_hours;//h
|
||||
params.byte2 = dusk_minutes;//m
|
||||
params.byte1 = sunCalcResult["dusk_hours"];//h
|
||||
params.byte2 = sunCalcResult["dusk_minutes"];//m
|
||||
params.byte3 = 0;//s
|
||||
params.byte4 = 0;
|
||||
|
||||
|
|
@ -1662,11 +1655,8 @@ exports.install = function(instance) {
|
|||
if (register == 7 && params.recipient === 2) {
|
||||
if (type != "cmd-terminal") {
|
||||
let sunCalcResult = calculateDuskDawn();
|
||||
let dawn_hours = sunCalcResult["dawn_hours"];
|
||||
let dawn_minutes = sunCalcResult["dawn_minutes"];
|
||||
|
||||
params.byte1 = dawn_hours;//h
|
||||
params.byte2 = dawn_minutes;//m
|
||||
params.byte1 = sunCalcResult["dawn_hours"];//h
|
||||
params.byte2 = sunCalcResult["dawn_minutes"];//m
|
||||
params.byte3 = 0;//s
|
||||
params.byte4 = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -742,6 +742,7 @@ exports.install = function(instance) {
|
|||
async function sendRvoStatus() {
|
||||
|
||||
if (SETTINGS === undefined) return;
|
||||
SETTINGS.masterNodeIsResponding ? deviceStatus["master_node"] = "OK" : deviceStatus["master_node"] = "NOK";
|
||||
|
||||
const table = {
|
||||
"OK": 1,
|
||||
|
|
@ -776,7 +777,7 @@ exports.install = function(instance) {
|
|||
let status = "OK";
|
||||
|
||||
for (const [key, value] of Object.entries(deviceStatus)) {
|
||||
if (["em", "twilight_sensor", "temperature"].includes(key) && value == "NOK") status = "NOK";
|
||||
if (["em", "twilight_sensor", "temperature", "master_node"].includes(key) && value == "NOK") status = "NOK";
|
||||
}
|
||||
|
||||
if (status == "OK") {
|
||||
|
|
@ -794,7 +795,6 @@ exports.install = function(instance) {
|
|||
|
||||
// battery status. If value is 1 - battery is NOK
|
||||
if (previousValues[5] === 1) status = "NOK";
|
||||
if (!SETTINGS.masterNodeIsResponding) status = "NOK";
|
||||
if (SETTINGS.no_voltage.size > 0) status = "NOK";
|
||||
|
||||
// console.log("rvo status",status)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue