Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.21k stars 1.68k forks source link

[New device support]: EWAY CASA Smart Vertical Blinds Vertical Slats Tuya Zigbee Motor #24649

Open Mrsash2020 opened 2 weeks ago

Mrsash2020 commented 2 weeks ago

Link

https://vi.aliexpress.com/item/1005006902297209.html

Database entry

Three Curtain motors:

{"id":55,"type":"Router","ieeeAddr":"0x7cc6b6fffe68838f","nwkAddr":8189,"manufId":4098,"manufName":"_TZE200_cs05mqku","powerSource":"Mains (single phase)","modelId":"TS0601","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[0,4,5,61184],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"65503":"�ݻ.f�ݻ.\u0012�ݻ.\u0012\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000f\u0000\u0000\u0000\u0000\u0012\u0000\u0000\u0000\u0000\u0012\u0000\u0000\u0000\u0000\u0007","65506":31,"65508":0,"modelId":"TS0601","manufacturerName":"_TZE200_cs05mqku","stackVersion":0,"dateCode":"","appVersion":65,"zclVersion":3}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":65,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1730809823100}

{"id":57,"type":"Router","ieeeAddr":"0x7cc6b6fffe681d46","nwkAddr":29236,"manufId":4098,"manufName":"_TZE200_cs05mqku","powerSource":"Mains (single phase)","modelId":"TS0601","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[0,4,5,61184],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"65503":"\u0000\u0000\u0000\u0000e\u0000\u0000\u0000\u0000\u0012\u0000\u0000\u0000\u0000\u0012","65506":31,"65508":0,"modelId":"TS0601","manufacturerName":"_TZE200_cs05mqku","powerSource":1,"zclVersion":3,"appVersion":65,"stackVersion":0,"hwVersion":1,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":65,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1730809906486}

{"id":58,"type":"Router","ieeeAddr":"0x3c2ef5fffe961978","nwkAddr":52114,"manufId":4098,"manufName":"_TZE200_cs05mqku","powerSource":"Mains (single phase)","modelId":"TS0601","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":81,"inClusterList":[0,4,5,61184],"outClusterList":[25,10],"clusters":{"genBasic":{"attributes":{"65503":"\u0000\u0000\u0000\u0000\u0005\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0005\u0000\u0000\u0000\u0000\u0005\u0000\u0000\u0000\u0000\u0005\u0000\u0000\u0000\u0000f\u0000\u0000\u0000\u0000\u0012\u0000\u0000\u0000\u0000\u0012","65506":31,"65508":0,"modelId":"TS0601","manufacturerName":"_TZE200_cs05mqku","powerSource":1,"zclVersion":3,"appVersion":65,"stackVersion":0,"hwVersion":1,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":65,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1730809841990}

Zigbee2MQTT version

1.41.0-1

Comments

I tried to follow the instructions to add external converter but it does not expose the entities I think I should be seeing.

I generated the external definition

const definition = {
    zigbeeModel: ['TS0601'],
    model: 'TS0601',
    vendor: '_TZE200_cs05mqku',
    description: 'Automatically generated definition',
    extend: [],
    meta: {},
};

module.exports = definition;

added info to the external converter named TS0601.js and moved it to config\zigbee2mqtt

const {} = require('zigbee-herdsman-converters/lib/modernExtend');
// Add the lines below
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 ota = require('zigbee-herdsman-converters/lib/ota');
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', // Update this with the real model of the device (written on the device itself or product page)
    vendor: '_TZE200_cs05mqku', // Update this with the real vendor of the device (written on the device itself or product page)
    description: 'EWAY CASA Smart Vertical Blinds Tuya Motor', // Description of the device, copy from vendor site. (only used for documentation and startup logging)
    extend: [],
    fromZigbee: [], // We will add this later
    toZigbee: [], // Should be empty, unless device can be controlled (e.g. lights, switches).
    exposes: [e.battery(), e.temperature(), e.humidity()], // Defines what this device exposes, used for e.g. Home Assistant discovery and in the frontend
};

module.exports = definition;

added

external_converters:

External definition

const {} = require('zigbee-herdsman-converters/lib/modernExtend');
// Add the lines below
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 ota = require('zigbee-herdsman-converters/lib/ota');
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', // Update this with the real model of the device (written on the device itself or product page)
    vendor: '_TZE200_cs05mqku', // Update this with the real vendor of the device (written on the device itself or product page)
    description: 'EWAY CASA Smart Vertical Blinds Tuya Motor', // Description of the device, copy from vendor site. (only used for documentation and startup logging)
    extend: [],
    fromZigbee: [], // We will add this later
    toZigbee: [], // Should be empty, unless device can be controlled (e.g. lights, switches).
    exposes: [e.battery(), e.temperature(), e.humidity()], // Defines what this device exposes, used for e.g. Home Assistant discovery and in the frontend
};

module.exports = definition;

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

Nothing. I have temp, humidity etc which isnt what I should be seeing in a curtain motor I think.

before this screen said unsupported image

before this screen had no entities. image

Mrsash2020 commented 2 weeks ago

Ok so basically scoured this forum for solutions and used another post to get this working but limited

Open, Close, Stop - works. The Position works - works.

Unsure if working: Set upper limit Set bottom limit Factory reset

Its basically a vertical blind motor with tilt left and right in couple of degrees of rotation. So the motor left and right work but at one set position for both. If I do it with the RF remote it moves depending on last position until fully tilted in one direction or the other.

removed e.enum('opening_mode', ea.STATE_SET, ['tilt', 'lift']).withDescription('Opening mode'), but pretty sure this I needed this but it does nothing.

removed e.battery(), as mine is AC powered

Any help would be appreciated.

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 modernExtend = require('zigbee-herdsman-converters/lib/modernExtend');
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: [{modelID: 'TS0601', manufacturerName: '_TZE200_cs05mqku'}],
    model: 'TS0601',
    vendor: 'Tuya',
    description: 'Eway Tuya Curtain',
    fromZigbee: [tuya.fz.datapoints],
    toZigbee: [tuya.tz.datapoints],
    configure: tuya.configureMagicPacket,
    exposes: [
        e.text('work_state', ea.STATE),
        e.cover_position().setAccess('position', ea.STATE_SET),
        e.enum('motor_direction', ea.STATE_SET, ['left', 'right']).withDescription('Motor side'),
        e.enum('set_upper_limit', ea.STATE_SET, ['start', 'stop']).withDescription('Learning'),
        e.enum('set_bottom_limit', ea.STATE_SET, ['start', 'stop']).withDescription('Learning'),
        e.enum('factory_reset', ea.STATE_SET, ['SET']).withDescription('Remove limits'),
    ],
    whiteLabel: [tuya.whitelabel('Tuya', 'TS0601', 'Eway Tuya Curtain', ['_TZE200_cs05mqku'])],
    meta: {
        // All datapoints go in here
        tuyaDatapoints: [
        [1, 'state', tuya.valueConverterBasic.lookup({CLOSE: tuya.enum(2), STOP: tuya.enum(1), OPEN: tuya.enum(0)})],
            [2, 'position', tuya.valueConverter.coverPositionInverted],
            [3, 'position', tuya.valueConverter.coverPositionInverted],
            [7, 'work_state', tuya.valueConverterBasic.lookup({standby: tuya.enum(0), success: tuya.enum(1), learning: tuya.enum(2)})],
            [101, 'motor_direction', tuya.valueConverterBasic.lookup({left: tuya.enum(0), right: tuya.enum(1)})],
            [103, 'set_upper_limit', tuya.valueConverterBasic.lookup({start: tuya.enum(1), stop: tuya.enum(0)})],
            [104, 'set_bottom_limit', tuya.valueConverterBasic.lookup({start: tuya.enum(1), stop: tuya.enum(0)})],
            [102, 'factory_reset', tuya.valueConverter.setLimit],
        ],
    },
};

module.exports = definition;