[New device support]: Tuya Zigbee Sensor de Gas Natural para el hogar, Detector de fugas de Gas GLP inteligente, protección contra incendios
Link
https://es.aliexpress.com/item/1005005936314298.html
Database entry
{"1":"Gas Detection State","2":"Detected Gas","6":"Alarm Ringtone","7":"Alarm Time","8":"Auto-Detect","9":"Auto-Detect Result","10":"Preheat","13":"Alarm Switch","16":"Silence"}
Comments
Hello, I followed the guide to add new zigbee devices for Tuya, and diving into the tuya.ts repository I wrote this converter. I wonder if before adding it as an external converter, what I have put in would work and not break my Zigbe2MQTT.
External converter
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 extend = require('zigbee-herdsman-converters/lib/extend');
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: [
{
// 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: 'TS0601',
// The manufacturer name from: Device with modelID 'TS0601' is not supported.
manufacturerName: '_TZE204_zougpkpy',
},
],
model: 'TS0601_new',
vendor: 'TuYa',
description: 'Combustible gas detector',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
configure: tuya.configureMagicPacket,
exposes: [
e.gas(), tuya.exposes.gasValue().withUnit('LEL'), tuya.exposes.selfTest(), tuya.exposes.selfTestResult(),
tuya.exposes.silence(),
e.enum('alarm_ringtone', ea.STATE_SET, ['1', '2', '3', '4', '5']).withDescription('Ringtone of the alarm'),
e.numeric('alarm_time', ea.STATE_SET).withValueMin(1).withValueMax(180).withValueStep(1)
.withUnit('s').withDescription('Alarm time'),
e.binary('preheat', ea.STATE, true, false).withDescription('Indicates sensor preheat is active'),
],
meta: {
tuyaDatapoints: [
[1, 'gas', tuya.valueConverter.trueFalseEnum0],
[2, 'gas_value', tuya.valueConverter.divideBy10],
[6, 'alarm_ringtone', tuya.valueConverterBasic.lookup({'1': 0, '2': 1, '3': 2, '4': 3, '5': 4})],
[7, 'alarm_time', tuya.valueConverter.raw],
[8, 'self_test', tuya.valueConverter.raw],
[9, 'self_test_result', tuya.valueConverter.selfTestResult],
[10, 'preheat', tuya.valueConverter.raw],
[13, null, null], // alarm_switch; ignore for now since it is unclear what it does
[16, 'silence', tuya.valueConverter.raw],
],
},
};
module.exports = definition;
Supported color modes
No response
Color temperature range
No response
does z2m start and does the device work when using this ext converter?
This is what I want to know if I activate it. Know if it is well done?
This is what I want to know if I activate it. Know if it is well done?
[08:11:59] INFO: Preparing to start... [08:12:00] INFO: Socat not enabled [08:12:02] ERROR: Got unexpected response from the API: Service not enabled [08:12:02] INFO: Starting Zigbee2MQTT...
But, it detects the gas and does not activate the sensor....
I'm going to link it to Tuya and see something else.....
May be [1, 'gas', tuya.valueConverter.trueFalseEnum0],?
It doesn't work either
[1, 'gas', tuya.valueConverterBasic.lookup({'alarm': tuya.enum(0), 'normal': tuya.enum(1)})]
Well the gas is sue works:
Detected:
But at startup it gives this error:
[09:56:33] INFO: Preparing to start... [09:56:33] INFO: Socat not enabled [09:56:35] ERROR: Got unexpected response from the API: Service not enabled [09:56:35] INFO: Starting Zigbee2MQTT...
And the tone selection doesn't work, any ideas?
Works perfectly
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 extend = require('zigbee-herdsman-converters/lib/extend');
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: '_TZE204_zougpkpy',
},
],
model: 'TZE204_zougpkpy',
vendor: 'TuYa',
description: 'Combustible gas detector',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
configure: tuya.configureMagicPacket,
exposes: [
e.gas(), tuya.exposes.gasValue().withUnit('LEL'), tuya.exposes.selfTest(), tuya.exposes.selfTestResult(),
tuya.exposes.silence(),
e.enum('alarm_ringtone', ea.STATE_SET, [
'melody1', 'melody2', 'melody3', 'melody4', 'melody5',
]).withDescription('Ringtone of the alarm'),
e.numeric('alarm_time', ea.STATE_SET).withValueMin(1).withValueMax(180).withValueStep(1)
.withUnit('s').withDescription('Alarm time'),
e.binary('preheat', ea.STATE, true, false).withDescription('Indicates sensor preheat is active'),
],
meta: {
tuyaDatapoints: [
[1, 'gas', tuya.valueConverterBasic.lookup({'alarm': tuya.enum(0), 'normal': tuya.enum(1)})],
[2, 'gas_value', tuya.valueConverter.divideBy10],
[6, 'alarm_ringtone', tuya.valueConverterBasic.lookup({
'melody1': tuya.enum(0), 'melody2': tuya.enum(1), 'melody3': tuya.enum(2), 'melody4': tuya.enum(3),
'melody5': tuya.enum(4), })],
[7, 'alarm_time', tuya.valueConverter.raw],
[8, 'self_test', tuya.valueConverter.raw],
[9, 'self_test_result', tuya.valueConverter.selfTestResult],
[10, 'preheat', tuya.valueConverter.raw],
[13, null, null], // alarm_switch; ignore for now since it is unclear what it does
[16, 'silence', tuya.valueConverter.raw],
],
},
};
module.exports = definition;
What is the next step?
@Waterbrain integrated it, thanks!
Changes will be available in the dev branch in a few hours from now. (https://www.zigbee2mqtt.io/advanced/more/switch-to-dev-branch.html)
This is the current status of my converter:
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 extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
const tuya = require('zigbee-herdsman-converters/lib/tuya');
const definition = {
fingerprint: [
{
modelID: 'TS0601',
manufacturerName: '_TZE204_zougpkpy',
},
],
model: 'TZE204_zougpkpy',
vendor: 'TuYa',
description: 'Combustible gas detector',
fromZigbee: [tuya.fz.datapoints],
toZigbee: [tuya.tz.datapoints],
onEvent: tuya.onEventSetTime, // Add this if you are getting no converter for 'commandMcuSyncTime'
configure: tuya.configureMagicPacket,
exposes: [
e.gas(), tuya.exposes.gasValue().withUnit('LEL'), tuya.exposes.selfTest(), tuya.exposes.selfTestResult(),
tuya.exposes.silence(),
e.enum('gas_detection_state', ea.STATE, ['alarm', 'normal']).withDescription('State of sensor'),
e.enum('alarm_ringtone', ea.STATE_SET, [
'melody1', 'melody2', 'melody3', 'melody4', 'melody5',
]).withDescription('Ringtone of the alarm'),
e.numeric('alarm_time', ea.STATE_SET).withValueMin(1).withValueMax(180).withValueStep(1)
.withUnit('s').withDescription('Alarm time'),
e.binary('preheat', ea.STATE, true, false).withDescription('Indicates sensor preheat is active'),
],
meta: {
tuyaDatapoints: [
[1, 'gas_detection_state', tuya.valueConverterBasic.lookup({ 'alarm': tuya.enum(0), 'normal': tuya.enum(1) })],
[2, 'gas_value', tuya.valueConverter.divideBy10],
[6, 'alarm_ringtone', tuya.valueConverterBasic.lookup({
'melody1': tuya.enum(0), 'melody2': tuya.enum(1), 'melody3': tuya.enum(2), 'melody4': tuya.enum(3),
'melody5': tuya.enum(4),
})],
[7, 'alarm_time', tuya.valueConverter.raw],
[8, 'self_test', tuya.valueConverter.raw],
[9, 'self_test_result', tuya.valueConverter.selfTestResult],
[10, 'preheat', tuya.valueConverter.raw],
[13, null, null], // alarm_switch; ignore for now since it is unclear what it does
[16, 'silence', tuya.valueConverter.raw],
],
},
};
module.exports = definition;
But the detector status does not work for me:
Although it is detecting gas, the status is still false (Gas value 13 LEL and Gas detection state alarm).
And in Home Assitant states:
I don't know if it's because of doing so many tests or why this happens. The installation of zigbee2MQTT, as you can see, is in Homeassitant.
In addons store I see:
If I install Zigbee2MQTT Edge could you help me?
The thing is that in the documentation to debug the Zigbee protocol it talks about installing a tool that I cannot install on my HomeAssitant.
Maybe we can manage to close the gas valve by reading the mqtt lel level via nodered.
Maybe this way we can reset the alarm when it activates.
But if we do it as I have it, in "Gas detector state" it does change the states of "alarm" or "normal".
I am trying to contact the seller to see if we can clear up any problems.