Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Four-button switch TS0601 not supported. #4644

Closed
mdanilohome opened this issue Sep 9, 2022 · 13 comments
Closed

Four-button switch TS0601 not supported. #4644

mdanilohome opened this issue Sep 9, 2022 · 13 comments
Labels

Comments

@mdanilohome
Copy link

Friend could help me with this device more? I purchased this four-button switch provided by Shawader, model SMKG-4KNL-US/TZB-W and when trying to pair it with zigbee 2mqtt it appears that it is not supported. Do you need an external converter? If so, could you help me with the creation? Thank you very much in advance.
Print Screen Zigbee 2mqtt

@mdanilohome
Copy link
Author

I tried creating and installing an external converter using one of the examples and zigbee 2mqtt stopped working. The following errors appeared:

[17:29:33] INFO: Handing over control to Zigbee2MQTT Core ...
Error: Cannot find module 'TZE200_6wi2mope'
Require stack:

  • /app/dist/util/utils.js
  • /app/dist/util/settings.js
  • /app/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.getExternalConvertersDefinitions (/app/lib/util/utils.ts:167:25)
    at getExternalConvertersDefinitions.next ()
    at new ExternalConverters (/app/lib/extension/externalConverters.ts:12:20)
    at new Controller (/app/lib/controller.ts:84:58)
    at start (/app/index.js:108:18)
    [17:29:43] INFO: Handing over control to Zigbee2MQTT Core ...
    Error: Cannot find module 'TZE200_6wi2mope'
    Require stack:
  • /app/dist/util/utils.js
  • /app/dist/util/settings.js
  • /app/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.getExternalConvertersDefinitions (/app/lib/util/utils.ts:167:25)
    at getExternalConvertersDefinitions.next ()
    at new ExternalConverters (/app/lib/extension/externalConverters.ts:12:20)
    at new Controller (/app/lib/controller.ts:84:58)
    at start (/app/index.js:108:18)

@mdanilohome
Copy link
Author

This was the .js file I added in zigbee 2mqtt:

const exposes = require('../lib/exposes');
const fz = {...require('../converters/fromZigbee'), legacy: require('../lib/legacy').fromZigbee};
const tz = require('../converters/toZigbee');
const ota = require('../lib/ota');
const tuya = require('../lib/tuya');
const reporting = require('../lib/reporting');
const extend = require('../lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const zosung = require('../lib/zosung');
const utils = require('../lib/utils');
const fzZosung = zosung.fzZosung;
const tzZosung = zosung.tzZosung;
const ez = zosung.presetsZosung;

const fzLocal = {
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_6wi2mope'}],
model: 'SMKG-4KNL-US/TZB-W',
vendor: 'Shawader',
description: 'Wall touch light switch (4 gang)',
exposes: [e.switch().withEndpoint('l1').setAccess('state', ea.STATE_SET),
e.switch().withEndpoint('l2').setAccess('state', ea.STATE_SET),
e.switch().withEndpoint('l3').setAccess('state', ea.STATE_SET),
e.switch().withEndpoint('l4').setAccess('state', ea.STATE_SET),
exposes.enum('indicate_light', ea.STATE_SET, Object.values(tuya.moesSwitch.indicateLight))
.withDescription('Indicator light status'),
exposes.enum('power_on_behavior', ea.STATE_SET, Object.values(tuya.moesSwitch.powerOnBehavior))
.withDescription('Controls the behavior when the device is powered on')],
fromZigbee: [fz.ignore_basic_report, fz.tuya_switch, fz.moes_switch],
toZigbee: [tz.tuya_switch_state, tz.moes_switch],
onEvent: tuya.onEventSetLocalTime,
meta: {multiEndpoint: true},
endpoint: (device) => {
// Endpoint selection is made in tuya_switch_state
return {'l1': 1, 'l2': 1, 'l3': 1, 'l4': 1};
},
configure: async (device, coordinatorEndpoint, logger) => {
await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']);
if (device.getEndpoint(2)) await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']);
if (device.getEndpoint(3)) await reporting.bind(device.getEndpoint(3), coordinatorEndpoint, ['genOnOff']);
if (device.getEndpoint(4)) await reporting.bind(device.getEndpoint(4), coordinatorEndpoint, ['genOnOff']);
// Reports itself as battery which is not correct: Koenkk/zigbee2mqtt#6190
device.powerSource = 'Mains (single phase)';
device.save();
},
}

module.exports = definition;

@mdanilohome
Copy link
Author

I made a correction in the name of the file that was missing the .js in the configuration.yaml of zigbee 2mqtt. The error log now appears as below:

[18:38:57] INFO: Handing over control to Zigbee2MQTT Core ...
node:internal/modules/cjs/loader:936
throw err;
^

Error: Cannot find module '../lib/exposes'
Require stack:

  • /app/dist/util/utils.js
  • /app/dist/util/settings.js
  • /app/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at /app/dist/util/externally-loaded.js:1:17
    at Script.runInContext (node:vm:139:12)
    at Script.runInNewContext (node:vm:144:17)
    at Object.runInNewContext (node:vm:298:38)
    at loadModuleFromText (/app/lib/util/utils.ts:148:8)
    at loadModuleFromFile (/app/lib/util/utils.ts:155:12)

@ciedema
Copy link
Contributor

ciedema commented Sep 10, 2022

Start here https://www.zigbee2mqtt.io/advanced/support-new-devices/01_support_new_devices.html#_1-pairing-the-device-with-zigbee2mqtt

Look the difference between your code, and the examples.

@mdanilohome
Copy link
Author

Hi @ciedema , thank you. I built this converter using as reference the codes contained in the Moes link https://github.com/Koenkk/zigbee-herdsman-converters/blob/master/devices/moes.js that are equivalent to my device, a four-button switch and when paired, my device remains as "not supported".
Are there any corrections or modifications that still need to be made? Would you help me?
I made the changes to include my device specs and created the converter below, but as I said, the device is still not supported:

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const ota = require('zigbee-herdsman-converters/lib/ota');
const tuya = require('zigbee-herdsman-converters/lib/tuya');
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 zosung = require('zigbee-herdsman-converters/lib/zosung');
const utils = require('zigbee-herdsman-converters/lib/utils');
const fzZosung = zosung.fzZosung;
const tzZosung = zosung.tzZosung;
const ez = zosung.presetsZosung;

const fzLocal = {
fingerprint: [{modelID: 'TS0601', manufacturerName: '_TZE200_6wi2mope'}],
model: 'SMKG-4KNL-US/TZB-W',
vendor: 'Shawader',
description: 'Wall touch light switch (4 gang)',
exposes: [e.switch().withEndpoint('l1').setAccess('state', ea.STATE_SET),
e.switch().withEndpoint('l2').setAccess('state', ea.STATE_SET),
e.switch().withEndpoint('l3').setAccess('state', ea.STATE_SET),
e.switch().withEndpoint('l4').setAccess('state', ea.STATE_SET),
exposes.enum('indicate_light', ea.STATE_SET, Object.values(tuya.moesSwitch.indicateLight))
.withDescription('Indicator light status'),
exposes.enum('power_on_behavior', ea.STATE_SET, Object.values(tuya.moesSwitch.powerOnBehavior))
.withDescription('Controls the behavior when the device is powered on')],
fromZigbee: [fz.ignore_basic_report, fz.tuya_switch, fz.moes_switch],
toZigbee: [tz.tuya_switch_state, tz.moes_switch],
onEvent: tuya.onEventSetLocalTime,
meta: {multiEndpoint: true},
endpoint: (device) => {
// Endpoint selection is made in tuya_switch_state
return {'l1': 1, 'l2': 1, 'l3': 1, 'l4': 1};
},
configure: async (device, coordinatorEndpoint, logger) => {
await reporting.bind(device.getEndpoint(1), coordinatorEndpoint, ['genOnOff']);
if (device.getEndpoint(2)) await reporting.bind(device.getEndpoint(2), coordinatorEndpoint, ['genOnOff']);
if (device.getEndpoint(3)) await reporting.bind(device.getEndpoint(3), coordinatorEndpoint, ['genOnOff']);
if (device.getEndpoint(4)) await reporting.bind(device.getEndpoint(4), coordinatorEndpoint, ['genOnOff']);
// Reports itself as battery which is not correct: Koenkk/zigbee2mqtt#6190
device.powerSource = 'Mains (single phase)';
device.save();
},
}

module.exports = definition;

@mdanilohome
Copy link
Author

Follow the LOG

Log device

@ciedema
Copy link
Contributor

ciedema commented Sep 11, 2022

Have you added the convertor into configuration.yaml and is it loading correctly?

@mdanilohome
Copy link
Author

Hi, thanks for the reply. See the image, I believe that everything is correct, both the file with the codes in the correct place, and the line of code from the external converter in the configuration.yaml .
External Converter em configuration yaml

@mdanilohome
Copy link
Author

Log during pairing:
I identified that the device is paired, but I could not identify in this log when the external converter is loaded.
Log during pairing

@mdanilohome
Copy link
Author

I added the external convert line of code through the screen below, restarted zigbee 2mqtt and it crashed on reboot. Previously I was typing the line of code directly into configuration.yaml and although it was not crashing zigbee 2mqtt, I noticed in the previous log that in this condition the external converter was not loading. In this other way, it started to load but presented another error in the log and zigbee 2mqtt crashed.
Line of code inclusion log through z2m settings

@mdanilohome
Copy link
Author

Log during Z2M restart
Log during zigbee 2mqtt restart

@ciedema
Copy link
Contributor

ciedema commented Sep 12, 2022

Remove the toZigbee converters, restart and add one at a time to see what one is causing the error.

@github-actions
Copy link
Contributor

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the stale label Oct 12, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants