Closed adriannowaq closed 3 years ago
you need to add a colon ":" after change
await configureReporting.temperature(endpoint, {min: 1, max: 5, change: 1});
you need to add a colon ":" after
change
await configureReporting.temperature(endpoint, {min: 1, max: 5, change: 1});
Fixed that, I also added expose, now it looks like this:
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 e = exposes.presets;
const ea = exposes.access;
const definition = {
zigbeeModel: ['RH3052'],
model: 'RH3052',
vendor: 'TUYATEC-yg5dcbfu',
description: 'Temperature & humidity sensor with display',
supports: 'temperature and humidity',
fromZigbee: [fz.battery, fz.temperature, fz.humidity],
toZigbee: [],
exposes: [e.humidity(), e.temperature(), e.battery()],
meta: {configureKey: 1},
configure: async (device, coordinatorEndpoint) => {
const endpoint = device.getEndpoint(1);
const binds = ['msTemperatureMeasurement'];
await bind(endpoint, coordinatorEndpoint, binds);
await configureReporting.temperature(endpoint, {min: 1, max: 5, change: 1});
},
};
module.exports = definition;
but still I'm getting and error:
Aug 03 10:28:10 raspberrypi npm[5741]: Zigbee2MQTT:error 2021-08-03 10:28:10: Failed to configure 'kitchen', attempt 2 (ReferenceError: bind is not defined Aug 03 10:28:10 raspberrypi npm[5741]: at Object.configure (/opt/zigbee2mqtt/lib/util/externally-loaded.js:22:9) Aug 03 10:28:10 raspberrypi npm[5741]: at Configure.configure (/opt/zigbee2mqtt/lib/extension/configure.js:137:45) Aug 03 10:28:10 raspberrypi npm[5741]: at Configure.onZigbeeEvent (/opt/zigbee2mqtt/lib/extension/configure.js:119:18) Aug 03 10:28:10 raspberrypi npm[5741]: at Controller.callExtensionMethod (/opt/zigbee2mqtt/lib/controller.js:397:44))
After a while it start's OK, but temperature sensor isn't reporting. What should I do to force report every 30 seconds ?
I also notice that when device finally report data it's flooding 16 times same data in one second
your code is missing this part
const bind = async (endpoint, target, clusters) => {
for (const cluster of clusters) {
await endpoint.bind(cluster, target);
}
};
add it before const definition = {
piece
Thanks, now its ok:
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 e = exposes.presets;
const ea = exposes.access;
const bind = async (endpoint, target, clusters) => {
for (const cluster of clusters) {
await endpoint.bind(cluster, target);
}
};
const definition = {
zigbeeModel: ['RH3052'],
model: 'RH3052',
vendor: 'TUYATEC-yg5dcbfu',
description: 'Temperature & humidity sensor with display',
supports: 'temperature and humidity',
fromZigbee: [fz.battery, fz.temperature, fz.humidity],
toZigbee: [],
exposes: [e.humidity(), e.temperature(), e.battery()],
meta: {configureKey: 1},
configure: async (device, coordinatorEndpoint) => {
const endpoint = device.getEndpoint(1);
const binds = ['msTemperatureMeasurement'];
await bind(endpoint, coordinatorEndpoint, binds);
await configureReporting.temperature(endpoint, {min: 1, max: 5, change: 1});
},
};
module.exports = definition;
What about repeated messages? It looks like this:
08/04/2021 8:07:17 AM
{"battery":81,"humidity":48.12,"linkquality":134,"temperature":24.05,"voltage":2800}
08/04/2021 8:07:17 AM(-0 seconds)
{"battery":81,"humidity":48.12,"linkquality":134,"temperature":24.05,"voltage":2800}
08/04/2021 8:07:17 AM(-0 seconds)
{"battery":81,"humidity":48.12,"linkquality":134,"temperature":24.05,"voltage":2800}
08/04/2021 8:07:17 AM(-0 seconds)
{"battery":81,"humidity":48.12,"linkquality":134,"temperature":24.05,"voltage":2800}
08/04/2021 8:07:17 AM(-0 seconds)
{"battery":81,"humidity":48.12,"linkquality":134,"temperature":24.05,"voltage":2800}
08/04/2021 8:07:17 AM(-0 seconds)
{"battery":81,"humidity":48.12,"linkquality":134,"temperature":24.05,"voltage":2800}
08/04/2021 8:07:17 AM(-0 seconds)
{"battery":81,"humidity":48.12,"linkquality":134,"temperature":24.05,"voltage":2800}
08/04/2021 8:07:17 AM(-0.01 seconds)
{"battery":81,"humidity":48.12,"linkquality":134,"temperature":24.05,"voltage":2800}
08/04/2021 8:02:20 AM(-4.96 minutes)
{"battery":81,"humidity":48.12,"temperature":24.05,"voltage":2800}
08/04/2021 8:01:18 AM(-61.8 seconds)
{"battery":81,"humidity":48.12,"linkquality":136,"temperature":24.05,"voltage":2800}
08/04/2021 8:01:18 AM(-0 seconds)
{"battery":81,"humidity":48.12,"linkquality":136,"temperature":24.05,"voltage":2800}
08/04/2021 8:01:18 AM(-0.05 seconds)
{"battery":81,"humidity":48.12,"linkquality":136,"temperature":24.05,"voltage":2800}
08/04/2021 8:01:18 AM(-0 seconds)
{"battery":81,"humidity":48.12,"linkquality":136,"temperature":24.05,"voltage":2800}
08/04/2021 8:01:18 AM(-0 seconds)
{"battery":81,"humidity":48.12,"linkquality":136,"temperature":24.05,"voltage":2800}
08/04/2021 8:01:18 AM(-0 seconds)
{"battery":81,"humidity":48.12,"linkquality":136,"temperature":24.05,"voltage":2800}
08/04/2021 8:01:18 AM(-0 seconds)
{"battery":81,"humidity":48.12,"linkquality":136,"temperature":24.05,"voltage":2800}
08/04/2021 8:01:18 AM(-0 seconds)
{"battery":81,"humidity":48.12,"linkquality":136,"temperature":24.05,"voltage":2800}
Discussed in https://github.com/Koenkk/zigbee2mqtt/discussions/8217