Hi everyone. I hope you can help me.
I’ve moved every single ZigBee Devices from my Tuya Gateway to a Sonoff ZigBee Dongle in ZigBee2MQTT. It feels so good to be out of the Tuya Cloud universe, however I’m having trouble adding support for one single device.
The Alarm / siren model: TS0224 from iAlarm (Tuya)
I’ve really been trying a lot to create my own custom converter using the documentation on zigbee2mqtt.io. But I simply can’t make it work. The controls show up just fine, and I can click them without receiving an error, but nothing actually happens with the alarm/siren itself.
This is what my custom converter looks like now:
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 e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const tzDatapoints = {
...tuya.tz.datapoints,
key: ['alarm_state', 'alarm_volume', 'alarm_time']
}
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: [
{
// The model ID from: Device with modelID 'TS0601' is not supported
// You may need to add \u0000 at the end of the name in some cases
modelID: 'TS0224',
// The manufacturer name from: Device with modelID 'TS0601' is not supported.
manufacturerName: '_TZ3000_cipibmnp'
},
],
model: 'TS0224',
vendor: 'TuYa',
description: 'Tuya Smart Light & Sound Siren ',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tzDatapoints],
onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
configure: tuya.configureMagicPacket,
exposes: [
exposes.enum('alarm_state', ea.STATE_SET, ['alarm_sound', 'alarm_light', 'alarm_sound_light', 'normal']).withDescription('The alarm state'),
exposes.enum('alarm_volume', ea.STATE_SET, ['low', 'middle', 'high', 'mute']).withDescription('Volume of siren'),
exposes.numeric('alarm_time', ea.STATE_SET).withValueMin(60).withValueMax(3600).withValueStep(1)
.withUnit('s').withDescription('Alarm time')],
meta: {
// All datapoints go in here
tuyaDatapoints: [
[1, 'alarm_state', tuya.valueConverterBasic.lookup({'alarm_sound': tuya.enum(0), 'alarm_light': tuya.enum(1), 'alarm_sound_light': tuya.enum(2), 'normal': tuya.enum(3)})],
[5, 'alarm_volume', tuya.valueConverterBasic.lookup({'low': tuya.enum(0), 'middle': tuya.enum(1), 'high': tuya.enum(2), 'mute': tuya.enum(3)})],
[7, 'alarm_time', tuya.valueConverter.raw]
],
}
};
module.exports = definition;
I’ve added the datapoints according to the guide, going to the Tuya IoT Hub etc.
These are the messages/commands that I’m allowed to send from the debugging tool in Tuya IoT Hub.
And as mentioned. The exposes show up just fine, but don’t do anything at all:
I feel like I’m so close to finally getting my devices off the Tuya Cloud, but I’m stuck with this one. Hope anyone can help