JasonToh
(Jason Toh)
September 9, 2022, 3:27pm
1
I did some edit to existing coding to receive the DP value, but it does not shown.
Can someone help me resolve and correct the code?
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 reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;
const dataPoints = {
valve_state: 102,
};
const fzLocal = {
valve_state: {
cluster: 'manuSpecificTuya',
type: ['commandDataReport'],
convert: (model, msg, publish, options, meta) => {
const result = {};
for (const dpValue of msg.data.dpValues) {
const dp = dpValue.dp; // First we get the data point ID
const value = tuya.getDataValue(dpValue); // This function will take care of converting the data to proper JS type
switch (dp) {
case dataPoints.valve_state: {
result.valve_state = value;
break;
}
default: {
meta.logger.debug(`>>> UNKNOWN DP #${dp} with data "${JSON.stringify(dpValue)}"`);
}
}
}
return result;
},
},
};
const tzLocal = {
valve_state: {
key: ['valve_state'],
convertSet: async (entity, key, value, meta) => {
await tuya.sendDataPointValue(entity, dataPoints.valve_state, value);
},
},
};
const definition = {
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_wt9agwf3'},
{modelID: 'TS0601', manufacturerName: '_TZE200_1n2zev06'}],
model: 'TS0601',
vendor: 'Frankever',
description: 'Water Control Valve',
fromZigbee: [fz.frankever_valve],
toZigbee: [tzLocal.valve_state, tz.tuya_switch_state, tz.frankever_threshold, tz.frankever_timer],
exposes: [e.switch().setAccess('state', ea.STATE_SET),
exposes.numeric('threshold', exposes.access.STATE_SET).withValueMin(0).withValueMax(100).withUnit('%')
.withDescription('Valve open percentage (multiple of 10)'),
exposes.numeric('timer', exposes.access.STATE_SET).withValueMin(0).withValueMax(600).withUnit('minutes')
.withDescription('Countdown timer in minutes'),
exposes.numeric('valve_state', ea.STATE_SET).withValueMin(0).withValueMax(100).withValueStep(5).withUnit('%')
.withDescription('Set valve to %.')],
};
pkscout
(Kyle Johnson)
September 9, 2022, 9:38pm
2
Please use three of the backward tics (```) before and after your code to format it. Make sure the three tics before and after are on lines by themselves. Without that It’s too hard to read.
gibbon
(Gibbon)
September 11, 2022, 2:47pm
3
Have same problem, the feedback from ventil do not apear
the Vlave open and close, but the feedback only make warning:
Warning <small>2022-09-11 16:49:31</small>`zigbee-herdsman-converters:FrankeverValve: NOT RECOGNIZED DP #102 with data {"dp":102,"datatype":2,"data":{"type":"Buffer","data":[0,0,0,90]}}`
gibbon
(Gibbon)
September 11, 2022, 2:53pm
4
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 reporting = require(‘zigbee-herdsman-converters/lib/reporting’);
const extend = require(‘zigbee-herdsman-converters/lib/extend’);
const globalStore = require(‘zigbee-herdsman-converters/lib/store’);
const e = exposes.presets;
const ea = exposes.access;
const dataPoints = {
valve_state: 102,
};
const fzLocal = {
valve_state: {
cluster: ‘manuSpecificTuya’,
type: [‘commandDataReport’],
convert: (model, msg, publish, options, meta) => {
const result = {};
for (const dpValue of msg.data.dpValues) {
const dp = dpValue.dp; // First we get the data point ID
const value = tuya.getDataValue(dpValue); // This function will take care of converting the data to proper JS type
switch (dp) {
case dataPoints.valve_state: {
result.valve_state = value;
break;
}
default: {
meta.logger.debug(`>>> UNKNOWN DP #${dp} with data "${JSON.stringify(dpValue)}"`);
}
}
}
return result;
},
},
};
const tzLocal = {
valve_state: {
key: [‘valve_state’],
convertSet: async (entity, key, value, meta) => {
await tuya.sendDataPointValue(entity, dataPoints.valve_state, value);
},
},
};
const definition = {
fingerprint: [{modelID: ‘TS0601’, manufacturerName: ‘_TZE200_wt9agwf3’},
{modelID: ‘TS0601’, manufacturerName: ‘_TZE200_1n2zev06’}],
model: ‘TS0601’,
vendor: ‘Frankever’,
description: ‘Water Control Valve’,
fromZigbee: [fz.frankever_valve],
toZigbee: [tzLocal.valve_state, tz.tuya_switch_state, tz.frankever_threshold, tz.frankever_timer],
exposes: [e.switch().setAccess(‘state’, ea.STATE_SET),
exposes.numeric(‘threshold’, exposes.access.STATE_SET).withValueMin(0).withValueMax(100).withUnit(’%’)
.withDescription(‘Valve open percentage (multiple of 10)’),
exposes.numeric(‘timer’, exposes.access.STATE_SET).withValueMin(0).withValueMax(600).withUnit(‘minutes’)
.withDescription(‘Countdown timer in minutes’),
exposes.numeric(‘valve_state’, ea.STATE_SET).withValueMin(0).withValueMax(100).withValueStep(5).withUnit(’%’)
.withDescription(‘Set valve to %.’)],
};
JasonToh
(Jason Toh)
September 13, 2022, 2:43pm
5
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 reporting = require('zigbee-herdsman-converters/lib/reporting');
const extend = require('zigbee-herdsman-converters/lib/extend');
const globalStore = require('zigbee-herdsman-converters/lib/store');
const e = exposes.presets;
const ea = exposes.access;
const dataPoints = {
valve_state: 102,
};
const fzLocal = {
valve_state: {
cluster: 'manuSpecificTuya',
type: ['commandDataReport'],
convert: (model, msg, publish, options, meta) => {
const result = {};
for (const dpValue of msg.data.dpValues) {
const dp = dpValue.dp; // First we get the data point ID
const value = tuya.getDataValue(dpValue); // This function will take care of converting the data to proper JS type
switch (dp) {
case dataPoints.valve_state: {
result.valve_state = value;
break;
}
default: {
meta.logger.debug(`>>> UNKNOWN DP #${dp} with data "${JSON.stringify(dpValue)}"`);
}
}
}
return result;
},
},
};
const tzLocal = {
valve_state: {
key: ['valve_state'],
convertSet: async (entity, key, value, meta) => {
await tuya.sendDataPointValue(entity, dataPoints.valve_state, value);
},
},
};
const definition = {
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_wt9agwf3'},
{modelID: 'TS0601', manufacturerName: '_TZE200_1n2zev06'}],
model: 'TS0601',
vendor: 'Frankever',
description: 'Water Control Valve',
fromZigbee: [fz.frankever_valve],
toZigbee: [tzLocal.valve_state, tz.tuya_switch_state, tz.frankever_threshold, tz.frankever_timer],
exposes: [e.switch().setAccess('state', ea.STATE_SET),
exposes.numeric('threshold', exposes.access.STATE_SET).withValueMin(0).withValueMax(100).withUnit('%')
.withDescription('Valve open percentage (multiple of 10)'),
exposes.numeric('timer', exposes.access.STATE_SET).withValueMin(0).withValueMax(600).withUnit('minutes')
.withDescription('Countdown timer in minutes'),
exposes.numeric('valve_state', ea.STATE_SET).withValueMin(0).withValueMax(100).withValueStep(5).withUnit('%')
.withDescription('Set valve to %.')],
};
konpyl
January 7, 2023, 11:47am
6
@JasonToh @pkscout @gibbon
I have bought the same device - _TZE200_1n2zev06.
Using this config, I get the following error :
[15:45:15] INFO: Preparing to start...
[15:45:16] INFO: Socat not enabled
[15:45:18] INFO: Starting Zigbee2MQTT...
/app/node_modules/zigbee-herdsman-converters/index.js:78
definition.toZigbee.push(tz.scene_store, tz.scene_recall, tz.scene_add, tz.scene_remove, tz.scene_remove_all, tz.read, tz.write,
^
TypeError: Cannot read properties of undefined (reading 'push')
at Object.addDefinition [as addDeviceDefinition] (/app/node_modules/zigbee-herdsman-converters/index.js:78:25)
at new ExternalConverters (/app/lib/extension/externalConverters.ts:15:17)
at new Controller (/app/lib/controller.ts:84:58)
at start (/app/index.js:106:18)
Any ideas what is wrong?
konpyl
January 7, 2023, 12:14pm
7
there was one line missing:
module.exports = definition;
Using latest @JasonToh version, I am getting same error as the author