Node status offline without setTimeout; handel turn line logs according to total_energy.js
This commit is contained in:
parent
0c993f50b1
commit
5540cee8ec
4 changed files with 110 additions and 136 deletions
|
|
@ -6,33 +6,14 @@ exports.version = '1.0.2';
|
|||
exports.icon = 'sign-out';
|
||||
exports.output = 2;
|
||||
|
||||
exports.html = `<div class="padding">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div data-jc="textbox" data-jc-path="host" data-jc-config="placeholder:test.mosquitto.org;required:false" class="m">Hostname or IP address (if not empty - setting will override db setting)</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div data-jc="textbox" data-jc-path="port" data-jc-config="placeholder:1883;required:true" class="m">Port</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div data-jc="textbox" data-jc-path="clientid">@(Client id)</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div data-jc="textbox" data-jc-path="username" class="m">@(Username)</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
||||
exports.readme = `
|
||||
# DB initialization
|
||||
# DB initialization
|
||||
`;
|
||||
|
||||
const { promisifyBuilder, makeMapFromDbResult } = require('./helper/db_helper.js');
|
||||
const { initNotification } = require('./helper/notification_reporter');
|
||||
const errorHandler = require('./helper/ErrorToServiceHandler');
|
||||
const total_energy = require('../databases/total_energy');
|
||||
|
||||
const SEND_TO = {
|
||||
db_init: 0,
|
||||
|
|
@ -41,7 +22,6 @@ const SEND_TO = {
|
|||
|
||||
|
||||
exports.install = async function(instance) {
|
||||
|
||||
const dbNodes = TABLE("nodes");
|
||||
const dbRelays = TABLE("relays");
|
||||
const dbSettings = TABLE("settings");
|
||||
|
|
@ -70,7 +50,7 @@ exports.install = async function(instance) {
|
|||
Object.keys(dbs.nodesData).forEach(node => dbs.nodesData[node].readout = {})
|
||||
|
||||
dbs.settings = {
|
||||
edge_fw_version: "2025-04-24", //rok-mesiac-den
|
||||
edge_fw_version: "2025-07-08", //rok-mesiac-den
|
||||
language: responseSettings[0]["lang"],
|
||||
rvo_name: responseSettings[0]["rvo_name"],
|
||||
project_id: responseSettings[0]["project_id"],
|
||||
|
|
@ -98,6 +78,11 @@ exports.install = async function(instance) {
|
|||
maintenance_mode: false,
|
||||
}
|
||||
|
||||
|
||||
let rvo_number = responseSettings[0]["rvo_name"].match(/\D+(\d{1,2})_/)[1];
|
||||
dbs.settings.energy_to_switch_lamps = total_energy[rvo_number];
|
||||
if (dbs.settings.energy_to_switch_lamps === undefined) console.log('=============== db_init.js: energy_to_switch_lamps is undefined');
|
||||
|
||||
FLOW.dbLoaded = true;
|
||||
errorHandler.setProjectId(dbs.settings.project_id);
|
||||
initNotification();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue