Closed Waterbrain closed 8 months ago
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.
I can close the gas valve according to the nodered lel level. Successful. https://hizliresim.com/biej18e
Perfect. Are you using it as an external converter?
Yes I'm using. But when it alarmed, the gas value appeared false. I solved it by reading the LEL value with nodered.
If you use the last abobe use Gas detection state get "alarm" or "normal"
I did it, I'll check it when I get home.
Hello I tried. I see alarm - normal states. But gas state is entity state It doesn't change. In this case, triggering automation will not be possible.
The same thing happens with the old one, doesn't it? The case is that the datapoints that you expose are:
{"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"}
The gas that does not work in any of the two is already exposed in:
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'),
And in te tuya page:
gas_sensor_status | Enum | { "range": [ "alarm", "normal" ] } -- | -- | -- gas_sensor_value | Integer | { "unit": "LEL", "min": 0, "max": 1000, "scale": 1, "step": 1 } alarm_time | Integer | { "unit": "s", "min": 1, "max": 180, "scale": 0, "step": 1 } self_checking | Boolean | "{true,false}" checking_result | Enum | { "range": [ "checking", "check_success", "check_failure", "others" ] } preheat | Boolean | "{true,false}" alarm_switch | Boolean | "{true,false}" muffling | Boolean | "{true,false}"
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
Supported color modes
No response
Color temperature range
No response