Last active
April 14, 2023 10:20
-
-
Save Koenkk/86ea747a683752fd6ff9390abf9fda55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ota = require('zigbee-herdsman-converters/lib/ota'); | |
const tuya = require('zigbee-herdsman-converters/lib/tuya'); | |
const utils = require('zigbee-herdsman-converters/lib/utils'); | |
const e = exposes.presets; | |
const ea = exposes.access; | |
const definition = { | |
fingerprint: tuya.fingerprint('TS0601', ['_TZE200_yojqa8xn']), | |
model: 'TS0601_gas_sensor', | |
vendor: 'TuYa', | |
description: 'Gas sensor', | |
fromZigbee: [tuya.fzDataPoints], | |
toZigbee: [tuya.tzDataPoints], | |
configure: tuya.configureMagicPacket, | |
exposes: [e.gas()], | |
meta: { | |
tuyaDatapoints: [ | |
[1, 'gas', tuya.valueConverter.true0ElseFalse], | |
[2, 'detected_gas', tuya.valueConverter.raw], | |
[6, 'alarm_ringtone', tuya.valueConverter.raw], | |
[7, 'alarm_time', tuya.valueConverter.raw], | |
[8, 'auto_detect', tuya.valueConverter.raw], | |
[9, 'auto_detect_result', tuya.valueConverter.raw], | |
[11, 'preheat', tuya.valueConverter.raw], | |
], | |
}, | |
}; | |
module.exports = definition; |
My current version for converter is:
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: '_TZE200_yojqa8xn'}],
model: 'TS0601_gas_sensor',
vendor: 'TuYa',
description: 'Natural gas sensor',
fromZigbee: [tuya.fzDataPoints],
toZigbee: [tuya.tzDataPoints],
configure: tuya.configureMagicPacket,
exposes: [
exposes.binary('gas', ea.STATE, 'detected', 'not detected').withDescription('Indicates whether the device detected gas'),
exposes.numeric('gas_value', ea.STATE).withDescription('Measured gas concentration').withUnit('LEL'),
exposes.enum('alarm_ringtone', ea.STATE_SET, ['RingTone 1', 'RingTone 2', 'RingTone 3', 'RingTone 4', 'RingTone 5'])
.withDescription('Alarm RingTone'),
exposes.numeric('alarm_time', ea.STATE_SET).withValueMin(1).withValueMax(180).withValueStep(1)
.withUnit('s').withDescription('Alarm time'),
tuya.exposes.selfTest(), tuya.exposes.selfTestResult(),
exposes.binary('preheat', ea.STATE, true, false),
exposes.binary('alarm_switch', ea.STATE_SET, true, false),
tuya.exposes.silence()
],
meta: {
tuyaDatapoints: [
[1, 'gas', tuya.valueConverterBasic.lookup({'detected': tuya.enum(0),'not detected': tuya.enum(1)})],
[2, 'gas_value', tuya.valueConverter.divideBy10],
[6, 'alarm_ringtone', tuya.valueConverterBasic.lookup
({'RingTone 1': 0, 'RingTone 2': 1, 'RingTone 3': 2, 'RingTone 4': 3, 'RingTone 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, 'alarm_switch', tuya.valueConverter.raw],
[16, 'silence', tuya.valueConverter.raw],
],
},
};
module.exports = definition;
BUT, I have an issue f.e. with DP 13 'alarm_switch'.
When trying to send command , got in log:
debug 2022-12-01 21:45:53: Received MQTT message on 'zigbee2mqtt/sGas Boiler/set' with data '{"alarm_switch":true}'
error 2022-12-01 21:45:53: No converter available for 'alarm_switch' (true)
Tried to find where (in code) this error generated, but can't find.
Looks I can't use any other key not included in tuya.tuyaTz.datapoints.key !?!?!
I've created the pr, please check the comments: Koenkk/zigbee-herdsman-converters#5065
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for looking into this, could you make a PR?