Koenkk / Koenkk/zigbee2mqtt

[External Converter]: Tuya TS0601 _TZE200_rgeapp2c 2 switches + 2 covers Semicom touch panel. External converter problem

Open
#32,438 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

external converter
Dominant language
TypeScript
Stars
15.7k
Forks
2k
Avg merge
18h 55m
Merged PRs (30d)
35

Description

Link

https://www.semicom.co.il/sz-4gev2t2n-w

Database entry

{"id":3,"type":"Router","ieeeAddr":"0xa4c138cfb65f95d9","nwkAddr":57685,"manufId":4417,"manufName":"_TZE200_rgeapp2c","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":{"65503":"-��1i.��1i.��1i","65506":53,"65508":0,"65534":0,"stackVersion":0,"dateCode":"","manufacturerName":"_TZE200_rgeapp2c","zclVersion":3,"appVersion":65,"modelId":"TS0601","powerSource":1,"hwVersion":1}}},"binds":[],"configuredReportings":[],"meta":{}},"242":{"profId":41440,"epId":242,"devId":97,"inClusterList":[],"outClusterList":[33],"clusters":{},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":65,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"interviewState":"SUCCESSFUL","meta":{"configured":"0.0.0"},"lastSeen":1782834139568}

Zigbee2MQTT version

2.12.0-1

External converter
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const exposes = require('zigbee-herdsman-converters/lib/exposes');

const e = exposes.presets;
const ea = exposes.access;

const definition = {
    fingerprint: [
        {
            modelID: 'TS0601',
            manufacturerName: '_TZE200_rgeapp2c',
        },
    ],
    model: 'TS0601_TZE200_rgeapp2c',
    vendor: 'Tuya',
    description: 'Semicom touch panel: 2 lights + 2 shutters)',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
    onEvent: tuya.onEventSetTime,
    configure: tuya.configureMagicPacket,
    //options: [exposes.options.invert_cover()],
    exposes: [
        // Expose Switches to Home Assistant
        e.switch().withEndpoint('s1'),
        e.switch().withEndpoint('s2'),
        // Expose Shutters/Covers to Home Assistant
        e.cover_position().withEndpoint('c1').setAccess('position', ea.STATE_SET),
        e.cover_position().withEndpoint('c2').setAccess('position', ea.STATE_SET),
    ],
    endpoint: (device) => {
        return {'s1': 1, 's2': 1, 'c1': 1, 'c2': 1};
    },
    meta: {
        multiEndpoint: true,
        tuyaDatapoints: [
            // --- LIGHTS / SWITCHES ---
            [101, 'state_s1', tuya.valueConverter.onOff],
            [102, 'state_s2', tuya.valueConverter.onOff],
            
            // --- SHUTTERS / COVERS ---
            // Cover 1 (DP 1 for state/control, DP 2 for position)
            [1, 'state_c1', tuya.valueConverterBasic.lookup({'OPEN': tuya.enum(0), 'STOP': tuya.enum(1), 'CLOSE': tuya.enum(2)})],
            //[1, 'state_c1', tuya.valueConverter.coverState],
            [2, 'position_c1', tuya.valueConverter.coverPosition],
            
            // Cover 2 (DP 4 for state/control, DP 5 for position)
            [4, 'state_c2', tuya.valueConverterBasic.lookup({'OPEN': tuya.enum(0), 'STOP': tuya.enum(1), 'CLOSE': tuya.enum(2)})],
            //[4, 'state_c2', tuya.valueConverter.coverState],
            [5, 'position_c2', tuya.valueConverter.coverPosition],
            
        ],
    },
};

module.exports = definition;
What does/doesn't work with the external definition?

Since this device came up as unsupported, I wrote an external converter for it.
This converter works very well at the Z2M device level (both controlling and getting the correct status from the panel).
But at the HASS level, status from the covers is wrong:
button pressed => reported activity (comment):
Down (close) => was closed (correct)
Down again (stop) => was opened (should be "was stopped")
Up (open) => No activity (should be "was opened").

I also tried a simple one-cover converter to try to isolate the problem, and it behaves the same: perfect at the Z2M level, but bad state at the HASS/MQTT device. The one-cover converter I used:

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

const e = exposes.presets;
const ea = exposes.access;

const definition = {
fingerprint: [
{
modelID: 'TS0601',
manufacturerName: '_TZE200_rgeapp2c',
},
],
model: 'TS0601_TZE200_rgeapp2c',
vendor: 'Tuya',
description: 'Semicom 1 cover test for 2 lights + 2 covers panel',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime,
configure: tuya.configureMagicPacket,
//options: [exposes.options.invert_cover()],
exposes: [
e.cover_position().setAccess('position', ea.STATE_SET),
],
meta: {
tuyaDatapoints: [
[1, 'state', tuya.valueConverterBasic.lookup({
OPEN: tuya.enum(0),
STOP: tuya.enum(1),
CLOSE: tuya.enum(2),
})],
[2, 'position', tuya.valueConverter.coverPosition],
],
},
};

module.exports = definition;

Notes

I would greatly appreciate your help with this.
Thank you

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied external converter and the tuya.fz.datapoints, tuya.valueConverter.coverPosition, and cover-state converter entry points. Reproduce the close, stop, and open button actions, then trace how their states reach the HASS/MQTT device. Done means both covers report closed, stopped, or opened correctly at the HASS level.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.