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

Add light switch - TS0601 - vendor '_TZE204_aagrxlbd' #7133

Closed
rbernardo89 opened this issue Feb 28, 2024 · 1 comment
Closed

Add light switch - TS0601 - vendor '_TZE204_aagrxlbd' #7133

rbernardo89 opened this issue Feb 28, 2024 · 1 comment

Comments

@rbernardo89
Copy link

rbernardo89 commented Feb 28, 2024

I bought a light switch ( 4 gang) of brazilian brand NovaDigital. This device shows unsupported in z2m.
The model looks like a zemismart TB26-4: https://www.zigbee2mqtt.io/devices/TB26-4.html

I was able to add the device creating a converter. I copied the exposes in this case and it works: Koenkk/zigbee2mqtt#20944

Below is the code created:

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

const definition = {
    zigbeeModel: ['TS0601'],
    model: 'TS0601',
    vendor: '_TZE204_aagrxlbd',
    description: 'Light 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
        tuya.exposes.switch().withEndpoint('l1'),
        tuya.exposes.switch().withEndpoint('l2'),
        tuya.exposes.switch().withEndpoint('l3'),
        tuya.exposes.switch().withEndpoint('l4'),
    ],
    endpoint: (device) => {
            return {'l1': 1, 'l2': 1, 'l3': 1, 'l4': 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],
        ],
    },
};

module.exports = definition;

Sorry, I'm a noob to this code issue. With this information, is it possible to add the code to z2m for the next updates?

I tried create a pull request, but i received validation error

Thanks!

@Koenkk
Copy link
Owner

Koenkk commented Feb 29, 2024

Added, thanks!

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

@Koenkk Koenkk closed this as completed Feb 29, 2024
lucasteligioridis added a commit to lucasteligioridis/zigbee-herdsman-converters that referenced this issue Feb 29, 2024
…-converters

* 'master' of github.com:lucasteligioridis/zigbee-herdsman-converters:
  fix(detect): Detect `_TZE204_aagrxlbd` as TuYa TS0601_switch_4_gang_1 Koenkk#7133
  fix: Fix battery percentage doubled for ROBB ROB_200-025-0 Koenkk/zigbee2mqtt#21607
  feat: Enable LED indicator functionality for 41E10PBSWMZ-VW (Koenkk#7131)
  fix(detect): Detect `_TZ3000_4ugnzsli` as Luminea ZX-5232 (Koenkk#7136)
  fix: Fixes issue of passing function to TuYa lookup value converter (Koenkk#7135)
  feat: Add `short_press_2_of_2` action to EnOcean PTM 216Z (Koenkk#7127)
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

2 participants