[New device support]: Motion Sensor TS0202, _TZ3000_lf56vpxj · Issue #19105 · Koenkk/zigbee2mqtt · GitHub seems to have the same
Some guidance here please my-motion.js below
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 ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const utils = require('zigbee-herdsman-converters/lib/utils');
const e = exposes.presets;
const ea = exposes.access;
const definition = {
fingerprint: [
{modelID: 'TS0202', manufacturerName: '_TZ3000_lf56vpxj'},
],
model: 'ZP01',
vendor: 'TuYa',
description: 'Motion sensor',
fromZigbee: [fz.ias_occupancy_alarm_1, fz.battery, fz.ignore_basic_report, fz.ias_occupancy_alarm_1_report],
toZigbee: [],
exposes: [e.occupancy(), e.battery_low(), e.battery(), e.battery_voltage()],
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(1);
await reporting.bind(endpoint, coordinatorEndpoint, ['genPowerCfg']);
try {
await reporting.batteryPercentageRemaining(endpoint);
} catch (error) {/* Fails for some https://github.com/Koenkk/zigbee2mqtt/issues/13708*/}
},
};
module.exports = definition;
Tells me to add to configuration.yaml
external_converters:
- my-motion.js
Check config in Dev tools
Error
Configuration invalid! Integration error: external_converters - Integration 'external_conv
Tried [Zigbee2MQTT - Tuya 4-button Scene Switch (TS0044) - #20 by daniguarana](https://this link)
Added my-motion.js
to config/zigbee2mqtt/my-motion.js
restarted zigbee2mqtt
Check yaml view
data_path: /config/zigbee2mqtt
external_converters:
- my-motion.js
devices: devices.yaml
groups: groups.yaml
Restarted zigbee2mqtt service
Error
[services.d] done.
[17:01:58] INFO: Handing over control to Zigbee2mqtt Core ...
> [email protected] start /app
> node index.js
(node:353) UnhandledPromiseRejectionWarning: internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'zigbee-herdsman-converters/lib/extend'
Require stack:
- /app/lib/util/utils.js
- /app/lib/util/settings.js
- /app/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at /app/lib/util/externally-loaded.js:5:16
at Script.runInContext (vm.js:143:18)
at Script.runInNewContext (vm.js:148:17)
at Object.runInNewContext (vm.js:303:38)
at loadModuleFromText (/app/lib/util/utils.js:156:8)
at loadModuleFromFile (/app/lib/util/utils.js:162:12)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:353) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:353) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[17:02:04] INFO: Handing over control to Zigbee2mqtt Core ...
Ideas? Where or what am I doing wrong here?