Update Nous Zigbee sensor E12 #11328
Open
+15
−15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, could you please tell me why after the update some devices stopped working correctly, namely… what could be the reason? I had to rewrite the converter.
Here is the corrected converter.
const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const e = exposes.presets;
const ea = exposes.access;
const DP_CO_STATE = 1;
const DP_CO_VALUE = 2;
const DP_SELF_CHECKING = 8;
const DP_CHECK_RESULT = 9;
const DP_PREHEAT = 10;
const DP_FAULT = 11;
const DP_LIFECYCLE = 12;
const DP_BATTERY_STATE = 14;
const CO_STATES = {0: 'normal', 1: 'alarm'};
const CHECK_RESULTS = {0: 'ok', 1: 'error'};
const PREHEAT_STATE = {0: 'off', 1: 'on'};
const FAULT_STATE = {0: 'normal', 1: 'fault'};
const valueConverterLookup = (lookupTable) => ({
from: (v) => lookupTable[v] ?? v,
to: (v) => {
const entry = Object.entries(lookupTable).find(([, name]) => name === v);
return entry ? Number(entry[0]) : v;
},
});
const trueFalseRobust = {
from: (v) => !!v,
to: (v) => (v ? 1 : 0),
};
const definition = {
fingerprint: tuya.fingerprint('TS0601', ['_TZE284_sonkaxrd']),
};
module.exports = definition;