actual working Senica Rvo code 09/2024
This commit is contained in:
parent
f4ffef94b9
commit
8929cc3a53
7 changed files with 810 additions and 429 deletions
|
|
@ -11,11 +11,11 @@ exports.icon = 'bolt';
|
|||
exports.options = { edge: "undefined" };
|
||||
|
||||
exports.html = `<div class="padding">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div data-jc="textbox" data-jc-path="edge" data-jc-config="placeholder:undefined;required:true" class="m">Edge TB Name</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div data-jc="textbox" data-jc-path="edge" data-jc-config="placeholder:undefined;required:true" class="m">Edge TB Name</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
exports.readme = `# Sets RS232 port and all digital pins on device. Then it starts to receive data from sensors.
|
||||
|
|
@ -60,7 +60,7 @@ state_of_contactor - podľa indexu stykača sa reportuje jeho stav, teda
|
|||
|
||||
//globals
|
||||
//FIRMWARE version
|
||||
FLOW.OMS_edge_fw_version = "2024-05-10";//rok-mesiac-den
|
||||
FLOW.OMS_edge_fw_version = "2024-07-08";//rok-mesiac-den
|
||||
FLOW.OMS_edgeName = "";
|
||||
FLOW.OMS_maintenance_mode = false;
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ FLOW.OMS_temperature_adress = "";//cmd_manager
|
|||
|
||||
let alarmStatus = "OFF";
|
||||
|
||||
const instanceSendTo = {
|
||||
const SEND_TO = {
|
||||
debug: 0,
|
||||
tb: 1,
|
||||
cmd_manager: 2
|
||||
|
|
@ -152,7 +152,7 @@ exports.install = function(instance) {
|
|||
/*
|
||||
let conversionTable = {
|
||||
"1": {tbname: "", type: "state_of_main_switch", "line": 0}, //state_of_main_switch pin1
|
||||
"2": {tbname: "", type: "rotary_switch_state", "line": 0}, //rotary_switch_state - poloha manual = pin2
|
||||
"2": {tbname: "", type: "rotary_switch_state", "line": 0}, //rotary_switch_state - poloha manual = pin2
|
||||
"3": {tbname: "", type: "rotary_switch_state", "line": 0}, //rotary_switch_state - poloha auto = pin3
|
||||
"4": {tbname: "", type: "power_supply", "line": 0},
|
||||
"5": {tbname: "", type: "battery", "line": 0},
|
||||
|
|
@ -192,7 +192,7 @@ exports.install = function(instance) {
|
|||
/*
|
||||
dbRelays.on('change', function(doc, old) {
|
||||
console.log("'DI_DO_Controller - dbRelays.on('change'");
|
||||
instance.send(instanceSendTo.cmd_manager, "reload_relays");
|
||||
instance.send(SEND_TO.cmd_manager, "reload_relays");
|
||||
});
|
||||
*/
|
||||
|
||||
|
|
@ -264,14 +264,13 @@ exports.install = function(instance) {
|
|||
{
|
||||
errLogger.error("CRITICAL!!! undefined relay", relaysData[line], line);
|
||||
|
||||
//sendNotification("set port ", edgeName, ERRWEIGHT.CRITICAL, "local database is corrupted", "", instanceSendTo.tb, instance, null );
|
||||
sendNotification("set port ", edgeName, "local_database_is_corrupted", {}, "", instanceSendTo.tb, instance );
|
||||
//sendNotification("set port ", edgeName, ERRWEIGHT.CRITICAL, "local database is corrupted", "", SEND_TO.tb, instance, null );
|
||||
sendNotification("set port ", edgeName, "local_database_is_corrupted", {}, "", SEND_TO.tb, instance );
|
||||
}
|
||||
}
|
||||
|
||||
if(pinsData[key].type == "state_of_contactor")
|
||||
{
|
||||
|
||||
let pin = key - 1;
|
||||
if(controller_type === "unipi") pin = key;
|
||||
|
||||
|
|
@ -298,37 +297,19 @@ exports.install = function(instance) {
|
|||
}
|
||||
]
|
||||
}
|
||||
|
||||
instance.send(instanceSendTo.tb, dataToTb);
|
||||
|
||||
instance.send(SEND_TO.tb, dataToTb);
|
||||
|
||||
let time = 3*1000;
|
||||
setTimeout(function(){
|
||||
instance.send(instanceSendTo.cmd_manager, {sender: "dido_controller", cmd: "buildTasks"});
|
||||
instance.send(SEND_TO.cmd_manager, {sender: "dido_controller", cmd: "buildTasks"});
|
||||
|
||||
sendNotification("rsPort.open()", edgeName, "flow_start", {}, "", instanceSendTo.tb, instance );
|
||||
sendNotification("rsPort.open()", edgeName, "flow_start", {}, "", SEND_TO.tb, instance );
|
||||
monitor.info("-->FLOW bol spustený", edgeName, FLOW.OMS_edge_fw_version);
|
||||
|
||||
}, time);
|
||||
}
|
||||
|
||||
|
||||
// TODO: FIND BETTER SOLUTION, THAN REBUILDING TASKS
|
||||
// we ensure, all tasks will be rebuild twice a week on tuesday or saturday at 11. To set correct switch off and on times
|
||||
let sendRebuildTasksAt11 = null;
|
||||
const checkIf11Oclock = () =>
|
||||
{
|
||||
const d = new Date();
|
||||
const h = d.getHours();
|
||||
const day = d.getDay();
|
||||
|
||||
if((day === 2 || day === 6) && h === 11)
|
||||
{
|
||||
instance.send(instanceSendTo.cmd_manager, {sender:"dido_controller", cmd:"buildTasks"});
|
||||
monitor.info("Task rebuilt at 11 o'clock, tuesday, saturday");
|
||||
}
|
||||
}
|
||||
sendRebuildTasksAt11 = setInterval(checkIf11Oclock, 3600000);
|
||||
|
||||
|
||||
function handleRsPort()
|
||||
{
|
||||
|
|
@ -339,14 +320,14 @@ exports.install = function(instance) {
|
|||
|
||||
rsPort.on('error', function(err) {
|
||||
logger.debug("rsPort opened error - failed", err.message);
|
||||
instance.send(instanceSendTo.debug, err.message);
|
||||
instance.send(SEND_TO.debug, err.message);
|
||||
|
||||
errorHandler.sendMessageToService( exports.title + " rsPort opened error - failed: " + err.message);
|
||||
})
|
||||
|
||||
rsPort.on('open', async function() {
|
||||
|
||||
await runSyncExec("stty -F /dev/ttymxc0 115200 min 1 time 5 ignbrk -brkint -icrnl -imaxbel -opost -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke").then(function (status) {
|
||||
await runSyncExec("stty -F /dev/ttymxc0 115200 min 1 time 5 ignbrk -brkint -icrnl -imaxbel -opost -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke").then(function (status) {
|
||||
|
||||
//set port
|
||||
rsPort.write(Buffer.from(setRSPortData), function(err) {
|
||||
|
|
@ -361,7 +342,7 @@ exports.install = function(instance) {
|
|||
})
|
||||
|
||||
}).catch(function (reason) {
|
||||
//instance.send(instanceSendTo.debug, exports.title + " runSyncExec - promise rejected:" + reason);
|
||||
//instance.send(SEND_TO.debug, exports.title + " runSyncExec - promise rejected:" + reason);
|
||||
errLogger.error( exports.title + " runSyncExec - promise rejected:" + reason);
|
||||
|
||||
errorHandler.sendMessageToService( exports.title + " runSyncExec - promise rejected:" + reason);
|
||||
|
|
@ -490,7 +471,7 @@ exports.install = function(instance) {
|
|||
|
||||
deviceStatuses["temperature"] = "OK";
|
||||
previousValues["temperature"] = value;
|
||||
instance.send(instanceSendTo.tb, dataToTb);
|
||||
instance.send(SEND_TO.tb, dataToTb);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -508,7 +489,7 @@ exports.install = function(instance) {
|
|||
|
||||
ws.on('error', (err) => {
|
||||
monitor.info('websocket error, reconnect')
|
||||
instance.send(instanceSendTo.debug, err.message);
|
||||
instance.send(SEND_TO.debug, err.message);
|
||||
clearInterval(startRequests);
|
||||
ws = null;
|
||||
setTimeout(handleWebSocket, 1000);
|
||||
|
|
@ -657,14 +638,14 @@ exports.install = function(instance) {
|
|||
|
||||
//console.log(values);
|
||||
|
||||
instance.send(instanceSendTo.tb, dataToTb);
|
||||
instance.send(SEND_TO.tb, dataToTb);
|
||||
}
|
||||
|
||||
|
||||
function turnOnLine(line, pin, force, info)
|
||||
{
|
||||
|
||||
instance.send(instanceSendTo.debug, "turn on line " + line );
|
||||
instance.send(SEND_TO.debug, "turn on line " + line );
|
||||
if(force == undefined) force = false;
|
||||
|
||||
if(line == 0)
|
||||
|
|
@ -698,7 +679,7 @@ exports.install = function(instance) {
|
|||
{
|
||||
if(relaysData[line].contactor == 1)
|
||||
{
|
||||
instance.send(instanceSendTo.debug, "line is already on " + line );
|
||||
instance.send(SEND_TO.debug, "line is already on " + line );
|
||||
logger.debug("turnOnLine: line is already on: ", line);
|
||||
|
||||
return;
|
||||
|
|
@ -775,7 +756,7 @@ exports.install = function(instance) {
|
|||
{
|
||||
if(relaysData[line].contactor == 0)
|
||||
{
|
||||
instance.send(instanceSendTo.debug, "line is already off " + line );
|
||||
instance.send(SEND_TO.debug, "line is already off " + line );
|
||||
logger.debug("turnOffLine: line already off:", line);
|
||||
|
||||
return;
|
||||
|
|
@ -828,7 +809,7 @@ exports.install = function(instance) {
|
|||
if(!flowdata.data instanceof Object) return;
|
||||
|
||||
// console.log('***********************', flowdata.data)
|
||||
instance.send(instanceSendTo.debug, flowdata.data);
|
||||
instance.send(SEND_TO.debug, flowdata.data);
|
||||
|
||||
// we handle nok status from modbus_reader component and thermometer
|
||||
if(flowdata.data?.status)
|
||||
|
|
@ -846,33 +827,34 @@ exports.install = function(instance) {
|
|||
{
|
||||
deviceStatuses["temperature"] = "NOK";
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if(flowdata.data?.values)
|
||||
{
|
||||
const values = flowdata.data.values;
|
||||
if(values.hasOwnProperty("twilight_sensor"))
|
||||
{
|
||||
instance.send(SEND_TO.cmd_manager, {sender: "dido_controller", cmd: "lux_sensor", value: values["twilight_sensor"]});
|
||||
deviceStatuses["twilight_sensor"] = "OK"
|
||||
}
|
||||
else if(values.hasOwnProperty("temperature"))
|
||||
{
|
||||
deviceStatuses["temperature"] = "OK";
|
||||
}
|
||||
// EM
|
||||
else if(values.hasOwnProperty("total_power") || values.hasOwnProperty("total_energy") || values.hasOwnProperty("power_factor") || values.hasOwnProperty("Phase_1_voltage") || values.hasOwnProperty("Phase_1_current"))
|
||||
{
|
||||
deviceStatuses["em"] = "OK";
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const values = flowdata.data.values;
|
||||
if(values.hasOwnProperty("twilight_sensor"))
|
||||
{
|
||||
instance.send(instanceSendTo.cmd_manager, {sender: "dido_controller", cmd: "lux_sensor", value: values["twilight_sensor"]});
|
||||
deviceStatuses["twilight_sensor"] = "OK"
|
||||
const updateStatus = checkFinalRVOStatus();
|
||||
if(updateStatus) values.status = "OK";
|
||||
|
||||
sendTelemetry(values, FLOW.OMS_rvo_tbname);
|
||||
}
|
||||
else if(values.hasOwnProperty("temperature"))
|
||||
{
|
||||
deviceStatuses["temperature"] = "OK";
|
||||
}
|
||||
// EM
|
||||
else if(values.hasOwnProperty("total_power") || values.hasOwnProperty("total_energy") || values.hasOwnProperty("power_factor") || values.hasOwnProperty("Phase_1_voltage") || values.hasOwnProperty("Phase_1_current"))
|
||||
{
|
||||
deviceStatuses["em"] = "OK";
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const updateStatus = checkFinalRVOStatus();
|
||||
if(updateStatus) values.status = "OK";
|
||||
|
||||
sendTelemetry(values, FLOW.OMS_rvo_tbname);
|
||||
|
||||
})
|
||||
|
||||
|
|
@ -902,7 +884,7 @@ exports.install = function(instance) {
|
|||
rsPort.write(Buffer.from(obj), function(err) {
|
||||
switchLogic(obj);
|
||||
|
||||
instance.send(instanceSendTo.debug, {"WRITE":obj} );
|
||||
instance.send(SEND_TO.debug, {"WRITE":obj} );
|
||||
});
|
||||
}
|
||||
})
|
||||
|
|
@ -1195,14 +1177,14 @@ exports.install = function(instance) {
|
|||
{
|
||||
if (newPinValue === 0 && newPinValue !== previousValues[pinIndex])
|
||||
{
|
||||
sendNotification("switchLogic", edgeName, "main_switch_has_been_turned_off", {}, "", instanceSendTo.tb, instance , "state_of_main_switch");
|
||||
sendNotification("switchLogic", edgeName, "main_switch_has_been_turned_off", {}, "", SEND_TO.tb, instance , "state_of_main_switch");
|
||||
values["status"] = "NOK";
|
||||
|
||||
deviceStatuses["state_of_main_switch"] = "Off";
|
||||
}
|
||||
else if (newPinValue === 1 && newPinValue !== previousValues[pinIndex])
|
||||
{
|
||||
sendNotification("switchLogic", edgeName, "main_switch_has_been_turned_on", {}, "", instanceSendTo.tb, instance , "state_of_main_switch");
|
||||
sendNotification("switchLogic", edgeName, "main_switch_has_been_turned_on", {}, "", SEND_TO.tb, instance , "state_of_main_switch");
|
||||
|
||||
deviceStatuses["state_of_main_switch"] = "On";
|
||||
}
|
||||
|
|
@ -1247,7 +1229,7 @@ exports.install = function(instance) {
|
|||
//ak je spracovany, a automatic - tak ho zapnem
|
||||
//ak nie je spracovany, iba profil zapisem
|
||||
|
||||
instance.send(instanceSendTo.cmd_manager, {sender: "dido_controller", cmd: "rotary_switch_state", value: value});
|
||||
instance.send(SEND_TO.cmd_manager, {sender: "dido_controller", cmd: "rotary_switch_state", value: value});
|
||||
|
||||
//console.log("rotary_switch_state pin", pin2, pin3, value);
|
||||
}
|
||||
|
|
@ -1256,16 +1238,16 @@ exports.install = function(instance) {
|
|||
{
|
||||
if (newPinValue === 0 && newPinValue !== previousValues[pinIndex])
|
||||
{
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.ALERT, "Power supply is not OK", "", instanceSendTo.tb, instance);
|
||||
sendNotification("switchLogic", edgeName, "power_supply_has_disconnected_input", {}, "", instanceSendTo.tb, instance, "power_supply");
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.ALERT, "Power supply is not OK", "", SEND_TO.tb, instance);
|
||||
sendNotification("switchLogic", edgeName, "power_supply_has_disconnected_input", {}, "", SEND_TO.tb, instance, "power_supply");
|
||||
values["status"] = "NOK";
|
||||
|
||||
deviceStatuses["power_supply"] = "NOK";
|
||||
}
|
||||
else if (newPinValue === 1 && newPinValue !== previousValues[pinIndex])
|
||||
{
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.NOTICE, "Power supply is is OK", "", instanceSendTo.tb, instance);
|
||||
sendNotification("switchLogic", edgeName, "power_supply_works_correctly", {}, "", instanceSendTo.tb, instance, "power_supply");
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.NOTICE, "Power supply is is OK", "", SEND_TO.tb, instance);
|
||||
sendNotification("switchLogic", edgeName, "power_supply_works_correctly", {}, "", SEND_TO.tb, instance, "power_supply");
|
||||
|
||||
deviceStatuses["power_supply"] = "OK";
|
||||
}
|
||||
|
|
@ -1275,16 +1257,16 @@ exports.install = function(instance) {
|
|||
{
|
||||
if (newPinValue === 1 && newPinValue !== previousValues[pinIndex])
|
||||
{
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.ERROR, "Battery is not OK", "", instanceSendTo.tb, instance);
|
||||
sendNotification("switchLogic", edgeName, "battery_level_is_low", {}, "", instanceSendTo.tb, instance, "battery_level");
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.ERROR, "Battery is not OK", "", SEND_TO.tb, instance);
|
||||
sendNotification("switchLogic", edgeName, "battery_level_is_low", {}, "", SEND_TO.tb, instance, "battery_level");
|
||||
values["status"] = "NOK";
|
||||
|
||||
deviceStatuses["battery"] = "NOK";
|
||||
}
|
||||
else if (newPinValue === 0 && newPinValue !== previousValues[pinIndex])
|
||||
{
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.NOTICE, "Battery is OK", "", instanceSendTo.tb, instance);
|
||||
sendNotification("switchLogic", edgeName, "battery_level_is_ok", {}, "", instanceSendTo.tb, instance, "battery_level");
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.NOTICE, "Battery is OK", "", SEND_TO.tb, instance);
|
||||
sendNotification("switchLogic", edgeName, "battery_level_is_ok", {}, "", SEND_TO.tb, instance, "battery_level");
|
||||
|
||||
deviceStatuses["battery"] = "OK";
|
||||
}
|
||||
|
|
@ -1298,19 +1280,19 @@ exports.install = function(instance) {
|
|||
|
||||
if (newPinValue != previousValues[pinIndex])
|
||||
{
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.NOTICE, `RVO door ${value}`, "", instanceSendTo.tb, instance, "rvo_door");
|
||||
//TODO ? sendNotification("switchLogic", edgeName, "door_value", {value: value}, "", instanceSendTo.tb, instance, "rvo_door");
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.NOTICE, `RVO door ${value}`, "", SEND_TO.tb, instance, "rvo_door");
|
||||
//TODO ? sendNotification("switchLogic", edgeName, "door_value", {value: value}, "", SEND_TO.tb, instance, "rvo_door");
|
||||
}
|
||||
|
||||
if (value === "open" && FLOW.OMS_maintenance_mode)
|
||||
{
|
||||
sendNotification("switchLogic", edgeName, "door_has_been_open", {}, "", instanceSendTo.tb, instance, "rvo_door");
|
||||
sendNotification("switchLogic", edgeName, "door_has_been_open", {}, "", SEND_TO.tb, instance, "rvo_door");
|
||||
}
|
||||
|
||||
if (value === "open" && !FLOW.OMS_maintenance_mode)
|
||||
{
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.WARNING, "RVO open door out of maintenance mode", "", instanceSendTo.tb, instance);
|
||||
sendNotification("switchLogic", edgeName, "door_has_been_open_without_permision_alarm_is_on", {}, "", instanceSendTo.tb, instance, "rvo_door");
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.WARNING, "RVO open door out of maintenance mode", "", SEND_TO.tb, instance);
|
||||
sendNotification("switchLogic", edgeName, "door_has_been_open_without_permision_alarm_is_on", {}, "", SEND_TO.tb, instance, "rvo_door");
|
||||
values["status"] = "NOK";
|
||||
|
||||
//console.log(door_has_been_open_without_permision_alarm_is_on);
|
||||
|
|
@ -1325,7 +1307,7 @@ exports.install = function(instance) {
|
|||
if(alarmStatus == "ON") turnOffAlarm();
|
||||
//turnOffAlarm();
|
||||
|
||||
sendNotification("switchLogic", edgeName, "door_has_been_closed", {}, "", instanceSendTo.tb, instance, "rvo_door");
|
||||
sendNotification("switchLogic", edgeName, "door_has_been_closed", {}, "", SEND_TO.tb, instance, "rvo_door");
|
||||
}
|
||||
|
||||
deviceStatuses["door_condition"] = value;
|
||||
|
|
@ -1364,12 +1346,12 @@ exports.install = function(instance) {
|
|||
twilightError = true;
|
||||
values["status"] = "NOK";
|
||||
let value = twilight_sensor_array.shift();
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.ERROR, "Lux sensor error", {"Repeating value": value}, instanceSendTo.tb, instance );
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.ERROR, "Lux sensor error", {"Repeating value": value}, SEND_TO.tb, instance );
|
||||
newPinValue = 0;
|
||||
}
|
||||
else if (set.size !== 1 && twilightError)
|
||||
{
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.NOTICE, "Lux sensor is working again", "", instanceSendTo.tb, instance );
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.NOTICE, "Lux sensor is working again", "", SEND_TO.tb, instance );
|
||||
twilightError = false;
|
||||
twilight_sensor_array.shift();
|
||||
newPinValue = value;
|
||||
|
|
@ -1387,7 +1369,7 @@ exports.install = function(instance) {
|
|||
if(diff >= twilight_sensor_interval * 60 * 1000)
|
||||
{
|
||||
const average = twilight_sensor.reduce((acc, c) => acc + c.value, 0) / twilight_sensor.length;
|
||||
instance.send(instanceSendTo.cmd_manager, {sender: "dido_controller", cmd: "lux_sensor", value: average});
|
||||
instance.send(SEND_TO.cmd_manager, {sender: "dido_controller", cmd: "lux_sensor", value: average});
|
||||
|
||||
twilight_sensor = [];
|
||||
|
||||
|
|
@ -1398,11 +1380,11 @@ exports.install = function(instance) {
|
|||
}
|
||||
else if(type == "state_of_contactor")
|
||||
{
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.INFO, `State of contactor ${line} is now ${value}`, "", instanceSendTo.tb, instance );
|
||||
//sendNotification("switchLogic", edgeName, ERRWEIGHT.INFO, `State of contactor ${line} is now ${value}`, "", SEND_TO.tb, instance );
|
||||
|
||||
if(!(deviceStatuses["state_of_contactor"][line] == value))
|
||||
{
|
||||
sendNotification("switchLogic", edgeName, "state_of_contactor_for_line", {line: line, value: value}, "", instanceSendTo.tb, instance );
|
||||
sendNotification("switchLogic", edgeName, "state_of_contactor_for_line", {line: line, value: value}, "", SEND_TO.tb, instance );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1444,7 +1426,7 @@ exports.install = function(instance) {
|
|||
//a budu sa odosielat commandy, tie vsak mozu zlyhat, a preto potrebujeme ich spusti trochu neskor
|
||||
|
||||
setTimeout(function(){
|
||||
instance.send(instanceSendTo.cmd_manager, {sender: "dido_controller", cmd: "reload_relays", line: line, time: time, value: value, dataChanged: dataChanged});
|
||||
instance.send(SEND_TO.cmd_manager, {sender: "dido_controller", cmd: "reload_relays", line: line, time: time, value: value, dataChanged: dataChanged});
|
||||
}, time);
|
||||
|
||||
reportLineStatus(line);
|
||||
|
|
@ -1469,7 +1451,7 @@ exports.install = function(instance) {
|
|||
|
||||
if(valueChanged)
|
||||
{
|
||||
instance.send(instanceSendTo.cmd_manager, {sender: "dido_controller", cmd: "state_of_breaker", value: value, line: line});
|
||||
instance.send(SEND_TO.cmd_manager, {sender: "dido_controller", cmd: "state_of_breaker", value: value, line: line});
|
||||
|
||||
//mame iba 3 istice. vyreportujeme a ohandlujeme liniu na tom istom istici ako paralelna linia (napr linia 1, paralelna s nou je linia 4, key je string "4")
|
||||
// ak je 7 linii, na 1 istici je linia 1,4,7
|
||||
|
|
@ -1483,7 +1465,7 @@ exports.install = function(instance) {
|
|||
{
|
||||
if(!relaysData.hasOwnProperty(lineOnSameBraker[i])) continue;
|
||||
|
||||
instance.send(instanceSendTo.cmd_manager, {sender: "dido_controller", cmd: "state_of_breaker", value: value, line: lineOnSameBraker[i]});
|
||||
instance.send(SEND_TO.cmd_manager, {sender: "dido_controller", cmd: "state_of_breaker", value: value, line: lineOnSameBraker[i]});
|
||||
|
||||
deviceStatuses["state_of_breaker"][lineOnSameBraker[i]] = value;
|
||||
reportLineStatus(lineOnSameBraker[i]);
|
||||
|
|
@ -1502,7 +1484,7 @@ exports.install = function(instance) {
|
|||
|
||||
if(relaysData.hasOwnProperty(lineOnSameBraker))
|
||||
{
|
||||
instance.send(instanceSendTo.cmd_manager, {sender: "dido_controller", cmd: "state_of_breaker", value: value, line: line + 3});
|
||||
instance.send(SEND_TO.cmd_manager, {sender: "dido_controller", cmd: "state_of_breaker", value: value, line: line + 3});
|
||||
|
||||
deviceStatuses["state_of_breaker"][line + 3] = value;
|
||||
reportLineStatus(line + 3);
|
||||
|
|
@ -1598,7 +1580,7 @@ exports.install = function(instance) {
|
|||
]
|
||||
}
|
||||
|
||||
instance.send(instanceSendTo.tb, dataToTb);
|
||||
instance.send(SEND_TO.tb, dataToTb);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue