Open alex-v-fraser opened 4 months ago
I did some external converter which made my curtains work better. In button mode it works fine. Motor limits work but they give some errors when I push set or reset limit:
Error 2024-05-05 08:58:42 Exception while calling fromZigbee converter: Value 'true' is not allowed, expected one of [object Object],[object Object]}
Error 2024-05-05 08:58:42 Exception while calling fromZigbee converter: Value 'false' is not allowed, expected one of [object Object],[object Object]}
Position mode works now but there are also some bugs. It shows correct fully closed or opened position. But when it fully closed and I try to slide it up by 25% - it moves up by 75%. So when I need to fully close it - I move slider up by fully open position. Motor revers mode changes arrows buttons, but there's no changes in position mode. I suppose, I need to set position to 100% as fully closed, and 0% as fully open. Any ideas?
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 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 tuya = require('zigbee-herdsman-converters/lib/tuya');
const definition = {
fingerprint: tuya.fingerprint('TS0601', ['_TZE200_fzo2pocs']),
model: 'ZM24E2',
vendor: 'Zemismart',
description: 'Tubular motor',
extend: [],
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime,
configure: tuya.configureMagicPacket,
exposes: [
// e.cover(),
// e.cover_position(),
e.enum('reverse_direction', ea.STATE_SET, ['forward', 'back']).withDescription('Reverse the motor direction'),
// e.enum('border', ea.STATE_SET, ['up', 'down', 'up_delete', 'down_delete', 'remove_top_bottom']),
e.enum('click_control', ea.STATE_SET, ['up', 'down']).withDescription('Single motor steps'),
e.binary('motor_fault', ea.STATE, true, false),
e.cover_position().setAccess('position', ea.STATE_SET),
e.enum('upper_stroke_limit', ea.STATE_SET, ['SET', 'RESET']).withDescription('Reset / Set the upper stroke limit'),
e.enum('middle_stroke_limit', ea.STATE_SET, ['SET', 'RESET']).withDescription('Reset / Set the middle stroke limit'),
e.enum('lower_stroke_limit', ea.STATE_SET, ['SET', 'RESET']).withDescription('Reset / Set the lower stroke limit'),
],
meta: {
tuyaDatapoints: [
[1, 'state', tuya.valueConverterBasic.lookup({'OPEN': tuya.enum(0), 'STOP': tuya.enum(1), 'CLOSE': tuya.enum(2)})],
[2, 'position', tuya.valueConverter.coverPosition],
[3, 'position', tuya.valueConverter.raw],
[5, 'reverse_direction', tuya.valueConverterBasic.lookup({'forward': tuya.enum(0), 'back': tuya.enum(1)})],
[12, 'motor_fault', tuya.valueConverter.trueFalse1],
[13, 'battery', tuya.valueConverter.raw],
[16, 'border', tuya.valueConverterBasic.lookup({
'up': tuya.enum(0), 'down': tuya.enum(1), 'up_delete': tuya.enum(2), 'down_delete': tuya.enum(3),
'remove_top_bottom': tuya.enum(4)})],
[20, 'click_control', tuya.valueConverterBasic.lookup({'up': tuya.enum(0), 'down': tuya.enum(1)})],
[103, 'upper_stroke_limit', tuya.valueConverterBasic.lookup({'SET': tuya.enum(1), 'RESET': tuya.enum(0)})],
[104, 'middle_stroke_limit', tuya.valueConverterBasic.lookup({'SET': tuya.enum(1), 'RESET': tuya.enum(0)})],
[105, 'lower_stroke_limit', tuya.valueConverterBasic.lookup({'SET': tuya.enum(1), 'RESET': tuya.enum(0)})],
],
},
extend: [],
};
module.exports = definition;
Found invert_cover: true
in devices.yaml. Changed to invert_cover: false
.
I don't remember if I wrote it there before.
Now it works as expected, except for errors when setting/resetting motor limits.
If anyone competent can help with these errors - we could add a new device to Z2M.
Link
https://www.zemismart.com/products/zm24-zb
Database entry
{"id":31,"type":"Router","ieeeAddr":"xxxxxxxxxxxxxxx","nwkAddr":60890,"manufId":4098,"manufName":"_TZE200_fzo2pocs","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","65506":31,"65508":0,"modelId":"TS0601","manufacturerName":"_TZE200_fzo2pocs","powerSource":1,"zclVersion":3,"appVersion":72,"stackVersion":0,"hwVersion":1,"dateCode":""}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":72,"stackVersion":0,"hwVersion":1,"dateCode":"","zclVersion":3,"interviewCompleted":true,"meta":{"configured":332242049},"lastSeen":1714847433521}
Comments
My new device appears in Zigbee2MQTT as ZM25TQ (but it's really ZM24E2, Only "Stop"/"Up"/"Down" buttons work. Motor limits don't work, position is always 88%, motor doesn't move when I change its position. And I'm stupid in coding. Please help.
External definition