Skip to content

[External Converter]: TS0601 from _TZE204_p3vfyekv #32434

Description

@shabbir-bombay

Link

https://ar.aliexpress.com/item/1005002598036962.html?gatewayAdapt=glo2ara

Database entry

{"id":45,"type":"Router","ieeeAddr":"0xa4c13818ae165c46","nwkAddr":43734,"manufId":4417,"manufName":"_TZE204_p3vfyekv","powerSource":"Mains (single phase)","modelId":"TS0601","epList":[1,242],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[4,5,61184,0],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"65506":56,"65508":0,"65534":0,"modelId":"TS0601","manufacturerName":"_TZE204_p3vfyekv","powerSource":1,"zclVersion":3,"appVersion":74,"stackVersion":0,"hwVersion":1,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":74,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"interviewState":"SUCCESSFUL","meta":{"configured":"0.0.0"},"lastSeen":1781356758978}

Zigbee2MQTT version

2.12.0 (unknown)

External converter

import tuyaPkg from 'zigbee-herdsman-converters/lib/tuya';
import exposesPkg from 'zigbee-herdsman-converters/lib/exposes';
const tuya = tuyaPkg;
const e = exposesPkg.presets;
const ea = exposesPkg.access;

// Convert brightness 10-1000 (Tuya) to 0-254 (HA) and back
const brightnessConverter = {
    from: (v) => Math.round((v - 10) / (1000 - 10) * 254),
    to: (v) => Math.round(v / 254 * (1000 - 10) + 10),
};

const definition = {
    fingerprint: [
        {
            modelID: 'TS0601',
            manufacturerName: '_TZE204_p3vfyekv',
        },
    ],
    model: 'TS0601_dimmer',
    vendor: 'Tuya',
    description: 'Single channel dimmer module',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
    onEvent: tuya.onEventSetTime,
    configure: tuya.configureMagicPacket,
    exposes: [
        // DP 1 - Power on/off + brightness (light entity)
        e.light()
            .withBrightness()
            .withMinBrightness()
            .withMaxBrightness(),

        // DP 4 - Light type (led/incandescent/halogen)
        e.enum('led_type', ea.STATE_SET, ['led', 'incandescent', 'halogen'])
            .withDescription('Type of light bulb connected'),

        // DP 14 - Power-on behavior
        e.enum('power_on_behavior', ea.STATE_SET, ['off', 'on', 'memory'])
            .withDescription('Behavior after power restore'),
    ],
    meta: {
        tuyaDatapoints: [
            // DP 1 - Switch
            [1,  'state',          tuya.valueConverter.onOff],
            // DP 2 - Brightness (10-1000 → 0-254)
            [2,  'brightness',     brightnessConverter],
            // DP 3 - Min brightness
            [3,  'min_brightness', brightnessConverter],
            // DP 4 - Light type
            [4,  'led_type',       tuya.valueConverterBasic.lookup({
                'led': 'led', 'incandescent': 'incandescent', 'halogen': 'halogen'
            })],
            // DP 5 - Max brightness
            [5,  'max_brightness', brightnessConverter],
            // DP 14 - Power-on behavior
            [14, 'power_on_behavior', tuya.valueConverterBasic.lookup({
                'off': 'off', 'on': 'on', 'memory': 'memory'
            })],
        ],
    },
};

export default definition;

What does/doesn't work with the external definition?

What works:

Power on/off (DP 1) — toggles the dimmer correctly
Brightness control (DP 2) — dimming works correctly when scaled from 10-1000 to 0-254
Min brightness (DP 3) — sets the minimum dim level correctly
Max brightness (DP 5) — sets the maximum dim level correctly
Light type selection (DP 4) — switching between led/incandescent/halogen works
Power-on behavior (DP 14) — off/on/memory restore behavior works correctly

Notes

software_build_id: undefined
date_code: ``
endpoints:

{"1":{"clusters":{"input":["genGroups","genScenes","manuSpecificTuya","genBasic"],"output":["genOta","genTime"]}},"242":{"clusters":{"input":[],"output":["greenPower"]}}}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions