Initial commit - testing version
This commit is contained in:
parent
cf16481324
commit
06b289d7a3
11 changed files with 6636 additions and 3819 deletions
|
|
@ -364,7 +364,7 @@ exports.install = function(instance) {
|
|||
data.map(item => {
|
||||
|
||||
let value = item['value'];
|
||||
let pin = item["dev"] + item["circuit"]; // for example "relay1_03" or "input1_01"
|
||||
let pin = item["dev"] + item["circuit"]; // for example "ro1_03" or "di1_01"
|
||||
|
||||
if (pin == undefined) return;
|
||||
switchLogic(pin, value);
|
||||
|
|
@ -516,9 +516,9 @@ exports.install = function(instance) {
|
|||
|
||||
}
|
||||
else if (ws) {
|
||||
//pin = "relay1_03" or "input1_01" ... we must make just "1_01" with slice method
|
||||
//pin = "ro1_03" or "di1_01" ... we must make just "1_01" with slice method
|
||||
monitor.info(`Dido: turnLine ${onOrOff} - (line, pin, force)`, line, pin, force, info);
|
||||
let cmd = { "cmd": "set", "dev": "relay", "circuit": pin.slice(5), "value": value };
|
||||
let cmd = { "cmd": "set", "dev": "relay", "circuit": pin.slice(2), "value": value };
|
||||
ws.send(JSON.stringify(cmd));
|
||||
}
|
||||
|
||||
|
|
@ -754,9 +754,9 @@ exports.install = function(instance) {
|
|||
pins = [4, 6];
|
||||
}
|
||||
} else if (controllerType === "unipi") {
|
||||
pins = ["input1_01", "input1_04", "input1_05"];
|
||||
pins = ["di1_01", "di1_04", "di1_05"];
|
||||
if (hasMainSwitch === 1) {
|
||||
pins = ["input1_01", "input1_04"];
|
||||
pins = ["di1_01", "di1_04"];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -781,7 +781,7 @@ exports.install = function(instance) {
|
|||
|
||||
for (const pinIndex of pinIndexes) {
|
||||
if (previousValues[pinIndex] === 0) {
|
||||
if ((pinIndex === 6 || pinIndex === 'input1_01' || pinIndex === 'input1_05') && SETTINGS.maintenance_mode) continue;
|
||||
if ((pinIndex === 6 || pinIndex === 'di1_01' || pinIndex === 'di1_05') && SETTINGS.maintenance_mode) continue;
|
||||
status = "NOK";
|
||||
break;
|
||||
}
|
||||
|
|
@ -798,7 +798,7 @@ exports.install = function(instance) {
|
|||
|
||||
|
||||
// we pass array to function in case of rsPort ==> switchLogic([55,3,0,1]) ==> [[55,3,0,1]]
|
||||
// we pass two values in case of websocket ==> switchLogic("relay1_03",1) ==> ["relay1_03",1]
|
||||
// we pass two values in case of websocket ==> switchLogic("ro1_03",1) ==> ["ro1_03",1]
|
||||
const switchLogic = (...args) => {
|
||||
|
||||
let values = {};
|
||||
|
|
@ -849,18 +849,18 @@ exports.install = function(instance) {
|
|||
else if (type == "rotary_switch_state") {
|
||||
// combination of these two pins required to get result
|
||||
let pin2, pin3;
|
||||
if (pinIndex == 2 || pinIndex == "input1_02") {
|
||||
if (pinIndex == 2 || pinIndex == "di1_02") {
|
||||
pin2 = newPinValue;
|
||||
pin3 = previousValues[3] || previousValues["input1_03"];
|
||||
pin3 = previousValues[3] || previousValues["di1_03"];
|
||||
|
||||
if (pin3 == undefined) {
|
||||
previousValues[pinIndex] = newPinValue;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (pinIndex == 3 || pinIndex == "input1_03") {
|
||||
else if (pinIndex == 3 || pinIndex == "di1_03") {
|
||||
pin3 = newPinValue;
|
||||
pin2 = previousValues[2] || previousValues["input1_02"];
|
||||
pin2 = previousValues[2] || previousValues["di1_02"];
|
||||
|
||||
if (pin2 == undefined) {
|
||||
previousValues[pinIndex] = newPinValue;
|
||||
|
|
@ -913,7 +913,7 @@ exports.install = function(instance) {
|
|||
}
|
||||
|
||||
//Dverovy kontakt - pin 6
|
||||
//! Ak je rvo s dvoma dverovymi kontaktami, ked pride z evoku signal z input1_05, co bol predytm "state_of_main switch" handlujeme ho teraz ako 'door_condition'
|
||||
//! Ak je rvo s dvoma dverovymi kontaktami, ked pride z evoku signal z di1_05, co bol predytm "state_of_main switch" handlujeme ho teraz ako 'door_condition'
|
||||
else if (type == "door_condition" || type === "state_of_main_switch") {
|
||||
newPinValue === 0 ? value = "open" : value = "closed";
|
||||
|
||||
|
|
@ -1369,60 +1369,60 @@ exports.install = function(instance) {
|
|||
|
||||
//! pins.table --> from UNIPI
|
||||
// pin:string|type:string|line:number
|
||||
// *|input1_01|state_of_main_switch|0|...........
|
||||
// *|input1_02|rotary_switch_state|0|...........
|
||||
// *|input1_03|rotary_switch_state|0|...........
|
||||
// *|di1_01|state_of_main_switch|0|...........
|
||||
// *|di1_02|rotary_switch_state|0|...........
|
||||
// *|di1_03|rotary_switch_state|0|...........
|
||||
// *|intut1_04|power_supply|0|...........
|
||||
// *|input1_05|door_condition|0|...........
|
||||
// *|input1_06|state_of_breaker|1|...........
|
||||
// *|input1_07|state_of_breaker|2|...........
|
||||
// *|input1_08|state_of_breaker|3|...........
|
||||
// *|relay1_02|state_of_contactor|1|...........
|
||||
// *|relay1_03|state_of_contactor|2|...........
|
||||
// *|relay1_04|state_of_contactor|3|...........
|
||||
// *|di1_05|door_condition|0|...........
|
||||
// *|di1_06|state_of_breaker|1|...........
|
||||
// *|di1_07|state_of_breaker|2|...........
|
||||
// *|di1_08|state_of_breaker|3|...........
|
||||
// *|ro1_02|state_of_contactor|1|...........
|
||||
// *|ro1_03|state_of_contactor|2|...........
|
||||
// *|ro1_04|state_of_contactor|3|...........
|
||||
// *|287D8776E0013CE9|temperature|0|...........
|
||||
|
||||
|
||||
//! pins_data --> from UNIPI
|
||||
// {
|
||||
// input1_01: {
|
||||
// pin: 'input1_01',
|
||||
// di1_01: {
|
||||
// pin: 'di1_01',
|
||||
// type: 'door_condition',
|
||||
// line: 0,
|
||||
// tbname: 'PLBJzmK1r3Gynd6OW0gGYz0e5wV4vx9bDEqNgYR8'
|
||||
// },
|
||||
// input1_02: {
|
||||
// pin: 'input1_02',
|
||||
// di1_02: {
|
||||
// pin: 'di1_02',
|
||||
// type: 'rotary_switch_state',
|
||||
// line: 0,
|
||||
// tbname: 'PLBJzmK1r3Gynd6OW0gGYz0e5wV4vx9bDEqNgYR8'
|
||||
// },
|
||||
// input1_03: {
|
||||
// pin: 'input1_03',
|
||||
// di1_03: {
|
||||
// pin: 'di1_03',
|
||||
// type: 'rotary_switch_state',
|
||||
// line: 0,
|
||||
// tbname: 'PLBJzmK1r3Gynd6OW0gGYz0e5wV4vx9bDEqNgYR8'
|
||||
// },
|
||||
// input1_04: {
|
||||
// pin: 'input1_04',
|
||||
// di1_04: {
|
||||
// pin: 'di1_04',
|
||||
// type: 'power_supply',
|
||||
// line: 0,
|
||||
// tbname: 'PLBJzmK1r3Gynd6OW0gGYz0e5wV4vx9bDEqNgYR8'
|
||||
// },
|
||||
// input1_05: {
|
||||
// pin: 'input1_05',
|
||||
// di1_05: {
|
||||
// pin: 'di1_05',
|
||||
// type: 'state_of_main_switch',
|
||||
// line: 0,
|
||||
// tbname: 'PLBJzmK1r3Gynd6OW0gGYz0e5wV4vx9bDEqNgYR8'
|
||||
// },
|
||||
// input1_06: {
|
||||
// pin: 'input1_06',
|
||||
// di1_06: {
|
||||
// pin: 'di1_06',
|
||||
// type: 'state_of_breaker',
|
||||
// line: 1,
|
||||
// tbname: '52dD6ZlV1QaOpRBmbAqK8bkKnGzWMLj4eJq38Pgo'
|
||||
// },
|
||||
// relay1_02: {
|
||||
// pin: 'relay1_02',
|
||||
// ro1_02: {
|
||||
// pin: 'ro1_02',
|
||||
// type: 'state_of_contactor',
|
||||
// line: 1,
|
||||
// tbname: '52dD6ZlV1QaOpRBmbAqK8bkKnGzWMLj4eJq38Pgo'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue