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

TS0601 _TZE204_dvosyycn 8 Chanel switch #19591

Closed
gvlad01 opened this issue Nov 5, 2023 · 19 comments
Closed

TS0601 _TZE204_dvosyycn 8 Chanel switch #19591

gvlad01 opened this issue Nov 5, 2023 · 19 comments
Labels
new device support New device support request

Comments

@gvlad01
Copy link

gvlad01 commented Nov 5, 2023

Link

https://de.aliexpress.com/item/1005006132345060.html?spm=a2g0o.store_pc_allProduct.8148356.27.58973f3bJVxxt6&pdp_npi=4%40dis%21EUR%21%E2%82%AC%200%2C94%21%E2%82%AC%200%2C66%21%21%217.18%215.03%21%402103890116992174001185725e3478%2112000035903085154%21sh%21DE%21179425550%21

Database entry

Router, 0xa4c138636d03a45d

Comments

Hello, are there any plans to integrate this module into zigbee2MQTT?
This module has 8 inputs and 8 outputs, I believe this is from the same manufacturer as the 24 channel module https://www.zigbee2mqtt.io/devices/ZYXH.html#tuya-zyxh
I can't convert myself, I don't know
Thank you very much

External converter

No response

Supported color modes

No response

Color temperature range

No response

@gvlad01 gvlad01 added the new device support New device support request label Nov 5, 2023
@DennisDeKoster
Copy link

Same here. Got one today, not knowing how easy or difficult it would be haha. I'll keep searching how to implement is. If I find it before anyone else can help us, I'll share it here.

@gvlad01
Copy link
Author

gvlad01 commented Dec 14, 2023

Great, thank you.

@DennisDeKoster
Copy link

DennisDeKoster commented Dec 16, 2023

Hi gvlad01,

I got mine working using parts of code from the converter for the 5-way switch. I found out it's not a really a separate 8 input + 8 output module out of the box. The inputs and outputs are linked together. So when input 1 is activated, output 1 will be so too. I couldn't find a way to change any settings on it (I don't have a Tuya gateway). So my plan is to use an input to signal from an external device and leave its corresponding output not connected. And use a separate output for something else and leave its input not connected.

Here's how I got mine working in Home Assistant:

  • Create a converter file, something like "TS0601_8_way_switch.js" with the code below and place the file in homeassistant/config/zigbee2mqtt/
  • Add these lines to your /homeassistant/zigbee2mqtt/configuration.yaml
external_converters:
  - TS0601_8_way_switch.js
  • Restart Zigbee2mqtt and add the device when it is running again.

I've added unused datapoints with null, so those will be ignored. I don't know if that is really necessary though.
Let me know if yours is working.

Kind regards,
Dennis

Converter 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 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: '_TZE204_dvosyycn',
        },
    ],
    model: 'TS0601_8_way_switch',
    vendor: 'TuYa',
    description: '8 way switch',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
    onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
    configure: tuya.configureMagicPacket,
    exposes: [
        // Here you should put all functionality that your device exposes
        ...Array.from({length: 8}, (_, i) => tuya.exposes.switch().withEndpoint(`l${i + 1}`))
    ],
    endpoint: (device) => {
        return {'l1': 1, 'l2': 1, 'l3': 1, 'l4': 1, 'l5': 1, 'l6': 1, 'l7': 1, 'l8': 1};
    },
    meta: {
        // All datapoints go in here
        multiEndpoint: true,
        tuyaDatapoints: [
            [1, 'state_l1', tuya.valueConverter.onOff],
            [2, 'state_l2', tuya.valueConverter.onOff],
            [3, 'state_l3', tuya.valueConverter.onOff],
            [4, 'state_l4', tuya.valueConverter.onOff],
            [5, 'state_l5', tuya.valueConverter.onOff],
            [6, 'state_l6', tuya.valueConverter.onOff],
            [0x65, 'state_l7', tuya.valueConverter.onOff],
            [0x66, 'state_l8', tuya.valueConverter.onOff],
            [0x67, 'null', null],
            [0x68, 'null', null],
            [0x69, 'null', null],
            [0x6A, 'null', null],
            [0x6B, 'null', null],
            [0x6C, 'null', null],
            [0x6D, 'null', null],
            [0x6E, 'null', null],
            [0xB6, 'null', null],           //Datapoint 182?
            [0xB7, 'null', null],           //Datapoint 183?
            [0xB8, 'null', null],           //Datapoint 184?
            [0xB9, 'null', null],           //Datapoint 185?
            [0xBA, 'null', null],           //Datapoint 186?
            [0xBB, 'null', null],           //Datapoint 187?
            [0xBC, 'null', null],           //Datapoint 188?
            [0xBD, 'null', null],           //Datapoint 189?
        ],
    },
};

module.exports = definition;

Koenkk added a commit to Koenkk/zigbee-herdsman-converters that referenced this issue Dec 17, 2023
@Koenkk
Copy link
Owner

Koenkk commented Dec 17, 2023

I've added the switch!

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

@gvlad01
Copy link
Author

gvlad01 commented Dec 29, 2023

So, I added the device,
everything works,
thank you again 🤝

@DennisDeKoster
Copy link

No problem 😊

@Koenkk Koenkk closed this as completed Dec 30, 2023
@iN-etlaM
Copy link

I got a 8 gang Tuya switch as well.
In my case only Switch (l8 endpoint) works. from 1-7 i get this message for example: "No converter available for 'state_l7' ("ON")"
Can you help me? :) Thanks in advance

@clumsy-stefan
Copy link

I have a similar device which also reports as TZE204_dvosyycn. However it seems to have 8 analog input's (0-5.5V/VCC) and 8 digital outputs from aliexpress here

I managed to amend the definitions, so that I can read the analog input's and the digital outputs. By default inputs and outputs are linked together, so if an input goes to high (~ >4V) the respective output also changes. However according to the description it's possible to decouple the input's from the output's with a config setting and then use tehm sepparately (which is what I'm trying to acheive). Unfortunately I don't succeed in configuring, as I don't know which cluster/setting has to be changed.

Also I don't exactly know what the DP 0x67-0x6E really do. They only get transferred rarely..

Any help would be appreciated.

To read all the exposed datapoints from this board I ammended the config as follows:

    {
        fingerprint: [
            { modelID: 'TS0601', manufacturerName: '_TZE200_vmcgja59' },
            { modelID: 'TS0601', manufacturerName: '_TZE204_dvosyycn' },
        ],
        model: 'TS0601_switch_8',
        vendor: 'TuYa',
        description: 'ZYXH 8 gang switch',
        fromZigbee: [tuya.fz.datapoints,fzLocal.TS110E_switch_type],
        toZigbee: [tuya.tz.datapoints,fzLocal.TS110E_switch_type],
        configure: tuya.configureMagicPacket,
        exposes: [
            ...Array.from({ length: 8 }, (_, i) => tuya.exposes.switch().withEndpoint(`l${i + 1}`)),
            ...Array.from({ length: 8 }, (_, i) => e.binary(`set`, ea.STATE, true, false).withEndpoint(`a${i + 1}`).withDescription(`Bool a${i + 1}`)),
            ...Array.from({ length: 8 }, (_, i) => e.voltage().withEndpoint(`a${i + 1}`).withDescription(`Voltage ${i + 1}`)),
        ],
        endpoint: (device) => {
            return { 'l1': 1, 'l2': 1, 'l3': 1, 'l4': 1, 'l5': 1, 'l6': 1, 'l7': 1, 'l8': 1,
                    'a1': 1, 'a2': 1, 'a3': 1, 'a4': 1,'a5': 1, 'a6': 1,'a7': 1, 'a8': 1,
            };
        },
        meta: {
            multiEndpoint: true,
            tuyaDatapoints: [
                [1, 'state_l1', tuya.valueConverter.onOff],
                [2, 'state_l2', tuya.valueConverter.onOff],
                [3, 'state_l3', tuya.valueConverter.onOff],
                [4, 'state_l4', tuya.valueConverter.onOff],
                [5, 'state_l5', tuya.valueConverter.onOff],
                [6, 'state_l6', tuya.valueConverter.onOff],
                [0x65, 'state_l7', tuya.valueConverter.onOff],
                [0x66, 'state_l8', tuya.valueConverter.onOff],
                [0x67, 'set_a1', tuya.valueConverter.trueFalse],
                [0x68, 'set_a2', tuya.valueConverter.trueFalse],
                [0x69, 'set_a3', tuya.valueConverter.trueFalse],
                [0x6A, 'set_a4', tuya.valueConverter.trueFalse],
                [0x6B, 'set_a5', tuya.valueConverter.trueFalse],
                [0x6C, 'set_a6', tuya.valueConverter.trueFalse],
                [0x6D, 'set_a7', tuya.valueConverter.trueFalse],
                [0x6E, 'set_a8', tuya.valueConverter.trueFalse],
                [0xB6, 'voltage_a1', tuya.valueConverter.divideBy10],
                [0xB7, 'voltage_a2', tuya.valueConverter.divideBy10],
                [0xB8, 'voltage_a3', tuya.valueConverter.divideBy10],
                [0xB9, 'voltage_a4', tuya.valueConverter.divideBy10],
                [0xBA, 'voltage_a5', tuya.valueConverter.divideBy10],
                [0xBB, 'voltage_a6', tuya.valueConverter.divideBy10],
                [0xBC, 'voltage_a7', tuya.valueConverter.divideBy10],
                [0xBD, 'voltage_a8', tuya.valueConverter.divideBy10],
            ],
        },
    },

@pirracas77
Copy link

I have a similar device which also reports as TZE204_dvosyycn. However it seems to have 8 analog input's (0-5.5V/VCC) and 8 digital outputs from aliexpress here

I managed to amend the definitions, so that I can read the analog input's and the digital outputs. By default inputs and outputs are linked together, so if an input goes to high (~ >4V) the respective output also changes. However according to the description it's possible to decouple the input's from the output's with a config setting and then use tehm sepparately (which is what I'm trying to acheive). Unfortunately I don't succeed in configuring, as I don't know which cluster/setting has to be changed.

Also I don't exactly know what the DP 0x67-0x6E really do. They only get transferred rarely..

Any help would be appreciated.

To read all the exposed datapoints from this board I ammended the config as follows:

    {
        fingerprint: [
            { modelID: 'TS0601', manufacturerName: '_TZE200_vmcgja59' },
            { modelID: 'TS0601', manufacturerName: '_TZE204_dvosyycn' },
        ],
        model: 'TS0601_switch_8',
        vendor: 'TuYa',
        description: 'ZYXH 8 gang switch',
        fromZigbee: [tuya.fz.datapoints,fzLocal.TS110E_switch_type],
        toZigbee: [tuya.tz.datapoints,fzLocal.TS110E_switch_type],
        configure: tuya.configureMagicPacket,
        exposes: [
            ...Array.from({ length: 8 }, (_, i) => tuya.exposes.switch().withEndpoint(`l${i + 1}`)),
            ...Array.from({ length: 8 }, (_, i) => e.binary(`set`, ea.STATE, true, false).withEndpoint(`a${i + 1}`).withDescription(`Bool a${i + 1}`)),
            ...Array.from({ length: 8 }, (_, i) => e.voltage().withEndpoint(`a${i + 1}`).withDescription(`Voltage ${i + 1}`)),
        ],
        endpoint: (device) => {
            return { 'l1': 1, 'l2': 1, 'l3': 1, 'l4': 1, 'l5': 1, 'l6': 1, 'l7': 1, 'l8': 1,
                    'a1': 1, 'a2': 1, 'a3': 1, 'a4': 1,'a5': 1, 'a6': 1,'a7': 1, 'a8': 1,
            };
        },
        meta: {
            multiEndpoint: true,
            tuyaDatapoints: [
                [1, 'state_l1', tuya.valueConverter.onOff],
                [2, 'state_l2', tuya.valueConverter.onOff],
                [3, 'state_l3', tuya.valueConverter.onOff],
                [4, 'state_l4', tuya.valueConverter.onOff],
                [5, 'state_l5', tuya.valueConverter.onOff],
                [6, 'state_l6', tuya.valueConverter.onOff],
                [0x65, 'state_l7', tuya.valueConverter.onOff],
                [0x66, 'state_l8', tuya.valueConverter.onOff],
                [0x67, 'set_a1', tuya.valueConverter.trueFalse],
                [0x68, 'set_a2', tuya.valueConverter.trueFalse],
                [0x69, 'set_a3', tuya.valueConverter.trueFalse],
                [0x6A, 'set_a4', tuya.valueConverter.trueFalse],
                [0x6B, 'set_a5', tuya.valueConverter.trueFalse],
                [0x6C, 'set_a6', tuya.valueConverter.trueFalse],
                [0x6D, 'set_a7', tuya.valueConverter.trueFalse],
                [0x6E, 'set_a8', tuya.valueConverter.trueFalse],
                [0xB6, 'voltage_a1', tuya.valueConverter.divideBy10],
                [0xB7, 'voltage_a2', tuya.valueConverter.divideBy10],
                [0xB8, 'voltage_a3', tuya.valueConverter.divideBy10],
                [0xB9, 'voltage_a4', tuya.valueConverter.divideBy10],
                [0xBA, 'voltage_a5', tuya.valueConverter.divideBy10],
                [0xBB, 'voltage_a6', tuya.valueConverter.divideBy10],
                [0xBC, 'voltage_a7', tuya.valueConverter.divideBy10],
                [0xBD, 'voltage_a8', tuya.valueConverter.divideBy10],
            ],
        },
    },

I have a similar device https://www.zigbee2mqtt.io/devices/TY-04Z.html#zyxh-ty-04z.

I would like also to decouple the input's from the output's and use the input as external digital input sensor.
Did you manage to set up this configuration?
Also I opened this issue, as these kind of relays have other options not yet exposed in zigbee2mqtt.
#22145

@clumsy-stefan
Copy link

Yes I could decouple it successfully, see #7232 for a complete template to include. Not sure though if it's possible with your board.
I'm preparing a pull request to be included in z2m, but currently I'm a bit short on time. However you can still include the template from #7232 locally in your installation and use all functions of the board.

@pirracas77
Copy link

Yes I could decouple it successfully, see #7232 for a complete template to include. Not sure though if it's possible with your board. I'm preparing a pull request to be included in z2m, but currently I'm a bit short on time. However you can still include the template from #7232 locally in your installation and use all functions of the board.

Thanks for your quick reply.

Are you sure I is the 7232 ?

@clumsy-stefan
Copy link

clumsy-stefan commented Apr 9, 2024

Sorry, its 7232 but in the zigbee-herdsman-converters repository, see here

EDIT: it's a bit strange how you need to change it though: first set "channel select" (value 1) to the channel you want to decouple, then set the "channel mode" (value 2) to 0 for decoupled, 2 for direct linked, 3 for blinking, etc...

@pirracas77
Copy link

Sorry, its 7232 but in the zigbee-herdsman-converters repository, see here

EDIT: it's a bit strange how you need to change it though: first set "channel select" (value 1) to the channel you want to decouple, then set the "channel mode" (value 2) to 0 for decoupled, 2 for direct linked, 3 for blinking, etc...

thanks, I will take a look

@pirracas77
Copy link

Sorry, its 7232 but in the zigbee-herdsman-converters repository, see here

EDIT: it's a bit strange how you need to change it though: first set "channel select" (value 1) to the channel you want to decouple, then set the "channel mode" (value 2) to 0 for decoupled, 2 for direct linked, 3 for blinking, etc...

Hello again,

I have discovered how decoupling, inching and interlock is managed in my device by Tuya app using IOT Tuya web.

  • DP191 = 108 is for set up interlock
  • DP191 = 131 is for set up JOG (inching)
  • DP191 = 105 is for decoupled, direct linked etc
  • DP191 = 106 is for type of signal (???)
  • DP192 is for select number of channel
  • DP193 depends on if you are in JOG,INCHING or decoupled settings.

Looking in to your converter, I think they are the same as yours. Aren't they?

On the other hand when decoupled is selected, How the values of the imputs are reported to Tuya? I cannot see them.

Thanks in advance

@clumsy-stefan
Copy link

I have no clue what DP190 and DP191 do, I just found that when setting 192 to a certain channel and then setting 193 to the desired channel mode it seems to work...
So, yes, it looks the same.

Values are reported in voltage_a1 through voltage_a8

@pirracas77
Copy link

pirracas77 commented Jun 12, 2024

I have no clue what DP190 and DP191 do, I just found that when setting 192 to a certain channel and then setting 193 to the desired channel mode it seems to work... So, yes, it looks the same.

Values are reported in voltage_a1 through voltage_a8

I realize that DP190 have to be set to 10 in order to start operating as decoupled. In fact, the app also changes and start to show the imputs (previously this section was not there)

image

So now I'm sure that I can use you converter.

@clumsy-stefan
Copy link

Ok, great! Let me know if you ammend the converter, so I can also update it!

@pirracas77
Copy link

DP190

Sadly I don't have any idea how to add the DPs to the already existing converter. I tried to follow the documentation but it is not clear for me. I do not know what I'm doing LOL. I hope someone in the original PR could add them

@pirracas77
Copy link

I have tried to include some datapoint into the converter. I have restarted zigbe2mqtt but the new DP doesn't appear. What I'm doing wrong?

{ fingerprint: tuya.fingerprint('TS0601', ['_TZE200_aqnazj70', '_TZE200_di3tfv5b', '_TZE200_mexisfik', '_TZE204_6wi2mope', '_TZE204_iik0pquw', '_TZE204_aagrxlbd']), model: 'TS0601_switch_4_gang_1', vendor: 'TuYa', description: '4 gang switch', exposes: [ tuya.exposes.switch().withEndpoint('l1'), tuya.exposes.switch().withEndpoint('l2'), tuya.exposes.switch().withEndpoint('l3'), tuya.exposes.switch().withEndpoint('l4'), ...Array.from({ length: 4 }, (_, i) => e.binary(input, ea.STATE, true, false).withEndpoint(a${i + 1}).withDescription(Bool a${i + 1})), ], fromZigbee: [tuya.fz.datapoints], toZigbee: [tuya.tz.datapoints], configure: tuya.configureMagicPacket, whiteLabel: [ tuya.whitelabel('ZYXH', 'TY-04Z', '4 gang switch', ['_TZE204_iik0pquw']), { vendor: 'Norklmes', model: 'MKS-CM-W5' }, { vendor: 'Somgoms', model: 'ZSQB-SMB-ZB' }, { vendor: 'Moes', model: 'WS-EUB1-ZG' }, { vendor: 'AVATTO', model: 'ZGB-WS-EU' }, ], meta: { multiEndpoint: true, tuyaDatapoints: [ [1, 'state_l1', tuya.valueConverter.onOff], [2, 'state_l2', tuya.valueConverter.onOff], [3, 'state_l3', tuya.valueConverter.onOff], [4, 'state_l4', tuya.valueConverter.onOff], [189, 'input_a1', tuya.valueConverter.trueFalse], [188, 'input_a2', tuya.valueConverter.trueFalse], [187, 'input_a3', tuya.valueConverter.trueFalse], [186, 'input_a4', tuya.valueConverter.trueFalse], ], }, endpoint: (device) => { return { 'l1': 1, 'l2': 1, 'l3': 1, 'l4': 1, 'a1': 1, 'a2': 1, 'a3': 1, 'a4': 1 }; }, }

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

No branches or pull requests

6 participants