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

Local External converter for covers _TZE200_g5xqosu7 #7308

Closed
Killi77 opened this issue Apr 2, 2024 · 7 comments
Closed

Local External converter for covers _TZE200_g5xqosu7 #7308

Killi77 opened this issue Apr 2, 2024 · 7 comments

Comments

@Killi77
Copy link

Killi77 commented Apr 2, 2024

Dear @Koenkk , I set up an external converter for my curtains since natively are not supported in Z2M. I got it up and working yesterday. This morning I install a the new update for Zigbe2mqtt and the curtain motor came "unsupported" again. It seems that the update caused the issue. I can't confirm that but I didn't do any changes to my setup only the Z2M update that popped up in HA. Here is my converter. Can you please check where may be the problem, please?

'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 tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
// Since a lot of TuYa devices use the same modelID, but use different datapoints
// it's necessary to provide a fingerprint instead of a zigbeeModel
fingerprint: [
{
// The model ID from: Device with modelID 'TS0601' is not supported
// You may need to add \u0000 at the end of the name in some cases
modelID: 'TS0601',
// The manufacturer name from: Device with modelID 'TS0601' is not supported.
manufacturerName: '_TZE200_g5xqosu7',
},
],
model: 'TS0601_new',
vendor: 'TuYa',
description: 'Cover motors',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
options: [exposes.options.invert_cover()],
exposes: [
e.cover_position().setAccess('position', ea.STATE_SET),
e.enum('reverse_direction', ea.STATE_SET, ['true', 'false'])
.withDescription('Reverse the motor direction'),
],
meta: {
tuyaDatapoints: [
[1, 'state', tuya.valueConverterBasic.lookup({'OPEN': tuya.enum(0), 'STOP': tuya.enum(1), 'CLOSE': tuya.enum(2)})],
[2, 'position', tuya.valueConverter.coverPositionInverted],
[3, 'position', tuya.valueConverter.coverPositionInverted],
[5, 'reverse_direction', tuya.valueConverterBasic.lookup({'true': tuya.enum(0), 'false': tuya.enum(1)})],
],
},
};
module.exports = definition;`

Zigbee motor 01

Thank you.

@Killi77 Killi77 changed the title Local External converter for covers _TZE200_g5xqosu Local External converter for covers _TZE200_g5xqosu7 Apr 2, 2024
@true9741
Copy link

true9741 commented Apr 2, 2024

Hi @Koenkk, the same happens to me, I am developing a converter for Smart Circuit breaker TOQCB2-80.
In the log appears the following message:

error 2024-04-02 10:12:31: Failed to load external converter file 'toqcb2_80.js' (Cannot find module 'zigbee-herdsman-converters/lib/extend'
Require stack:
- /app/dist/util/utils.js
- /app/dist/util/settings.js
- /app/index.js)
error 2024-04-02 10:12:31: Probably there is a syntax error in the file or the external converter is not compatible with the current Zigbee2MQTT version
error 2024-04-02 10:12:31: Note that external converters are not meant for long term usage, it's meant for local testing after which a pull request should be created to add out-of-the-box s>

I think the problem is in the following line of the converters:

const extend = require('zigbee-herdsman-converters/lib/extend');

I have checked that this file extend is not longer present in the lib folder of your source repository.

thank you.

@true9741
Copy link

true9741 commented Apr 2, 2024

Hi Sorry @Koenkk, Problem solved removing the line

const extend = require('zigbee-herdsman-converters/lib/extend');

I imagine is not longer needed.

Sorry for disturb you.

@Killi77
Copy link
Author

Killi77 commented Apr 2, 2024

@true9741 :) You are treasure! You came to this discussion as a gift for me :) I'm not that skilled IT and don't know how you figured it out but it works for me as well!
Thank you so much.
Issue closed.
@Koenkk I'm still adjusting the converter for _TZE200_g5xqosu7. Want to make sure it'll adapt all features. Once I'm done and convinced all is OK I'll let you post you the file so you can release it.
Thank you.

@Koenkk
Copy link
Owner

Koenkk commented Apr 3, 2024

Good that you found the issue, please make a PR to add out-of-the-box support for these devices 😄

@Killi77
Copy link
Author

Killi77 commented Apr 26, 2024

@true9741 :) You are treasure! You came to this discussion as a gift for me :) I'm not that skilled IT and don't know how you figured it out but it works for me as well!
Thank you so much.
Issue closed.
@Koenkk I'm still adjusting the converter for _TZE200_g5xqosu7. Want to make sure it'll adapt all features. Once I'm done and convinced all is OK I'll let you post you the file so you can release it.
Thank you.

@Killi77
Copy link
Author

Killi77 commented Apr 26, 2024

@Koenkk this is the final converter that woks with _TZE200_g5xqosu7 curtain motor

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 e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');

const definition = {
// Since a lot of TuYa devices use the same modelID, but use different datapoints
// it's necessary to provide a fingerprint instead of a zigbeeModel
fingerprint: [
{
// The model ID from: Device with modelID 'TS0601' is not supported
// You may need to add \u0000 at the end of the name in some cases
modelID: 'TS0601',
// The manufacturer name from: Device with modelID 'TS0601' is not supported.
manufacturerName: '_TZE200_g5xqosu7',
},
],
model: 'TS0601_new',
vendor: 'TuYa',
description: 'Cover motors',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
configure: tuya.configureMagicPacket,
options: [exposes.options.invert_cover()],
exposes: [
e.cover_position().setAccess('position', ea.STATE_SET),
e.enum('reverse_direction', ea.STATE_SET, ['true', 'false'])
.withDescription('Reverse the motor direction'),
e.binary('motor_fault', ea.STATE, true, false),
],
meta: {
tuyaDatapoints: [
[1, 'state', tuya.valueConverterBasic.lookup({'OPEN': tuya.enum(0), 'STOP': tuya.enum(1), 'CLOSE': tuya.enum(2)})],
[2, 'position', tuya.valueConverter.coverPositionInverted],
[3, 'position', tuya.valueConverter.coverPositionInverted],
[5, 'reverse_direction', tuya.valueConverterBasic.lookup({'true': tuya.enum(0), 'false': tuya.enum(1)})],
[12, 'motor_fault', tuya.valueConverter.trueFalse1],
],
},
};
module.exports = definition;

@Koenkk
Copy link
Owner

Koenkk commented Apr 27, 2024

Added, thanks!

Changes will be available in the dev branch in a few hours from now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants