Skip to content

Commit

Permalink
remove the elevated source logging for calls to getDevStates
Browse files Browse the repository at this point in the history
  • Loading branch information
agav99 committed Nov 16, 2024
1 parent fb517e5 commit e854c3e
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions lib/statescontroller.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class StatesController extends EventEmitter {
async collectOptions(devId, model, callback) {
const result = {};
// find model states for options and get it values
const devStates = await this.getDevStates('0x' + devId, model, 'collectOptions');
const devStates = await this.getDevStates('0x' + devId, model);
if (devStates == null || devStates == undefined || devStates.states == null || devStates.states == undefined) {
callback(result);
return;
Expand Down Expand Up @@ -183,7 +183,7 @@ class StatesController extends EventEmitter {
}
}

async getDevStates(deviceId, model, debugInfo) {
async getDevStates(deviceId, model) {
try {
let states;
let stateModel;
Expand All @@ -203,10 +203,7 @@ class StatesController extends EventEmitter {
} else {
states = stateModel.states;
}

if (this.checkDebugDevice(deviceId))
this.info(`ELEVATED: getDevStates deviceId="${deviceId}", model="${model}" call by:${debugInfo}`);


if (typeof states === 'function' && !states.prototype) {
const entity = await this.adapter.zbController.resolveEntity(deviceId);
if (entity) {
Expand All @@ -229,7 +226,7 @@ class StatesController extends EventEmitter {

if (elevated) this.warn(`ELEVATED Change state '${stateKey}' at device ${deviceId} type '${model}'`);

const devStates = await this.getDevStates(deviceId, model,'publishFromState');
const devStates = await this.getDevStates(deviceId, model);
if (!devStates) {
if (elevated) this.error(`ELEVATED no device states for device ${deviceId} type '${model}'`);
return;
Expand Down Expand Up @@ -337,7 +334,7 @@ class StatesController extends EventEmitter {


async deleteOrphanedDeviceStates(ieeeAddr, model, force, callback) {
const devStates = await this.getDevStates(ieeeAddr, model,'deleteOrphanedDeviceStates');
const devStates = await this.getDevStates(ieeeAddr, model);
const commonStates = statesMapping.commonStates;
const devId = ieeeAddr.substr(2);
this.adapter.getStatesOf(devId, (err, states) => {
Expand Down Expand Up @@ -575,7 +572,7 @@ class StatesController extends EventEmitter {
async syncDevStates(dev, model) {
const devId = dev.ieeeAddr.substr(2);
// devId - iobroker device id
const devStates = await this.getDevStates(dev.ieeeAddr, model,'syncDevStates');
const devStates = await this.getDevStates(dev.ieeeAddr, model);
if (!devStates) {
return;
}
Expand Down Expand Up @@ -639,7 +636,7 @@ class StatesController extends EventEmitter {
states = statesMapping.commonStates;
}
else{
const devStates = await this.getDevStates(`0x${devId}`, model, 'publishToState');
const devStates = await this.getDevStates(`0x${devId}`, model);

if (!devStates) {
if (has_debug) this.error(`ELEVATED publishToState: no device states for device ${devId} type '${model}'`)
Expand Down

0 comments on commit e854c3e

Please sign in to comment.