Last active
January 4, 2023 17:39
-
-
Save Koenkk/a5ef6a151f1cc63a01183b47e3404541 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 globalStore = require('zigbee-herdsman-converters/lib/store'); | |
const e = exposes.presets; | |
const ea = exposes.access; | |
const fzLocal = { | |
gateway_connection_status: { | |
cluster: 'manuSpecificTuya', | |
type: ['commandMcuGatewayConnectionStatus'], | |
convert: async (model, msg, publish, options, meta) => { | |
// "payload" can have the following values: | |
// 0x00: The gateway is not connected to the internet. | |
// 0x01: The gateway is connected to the internet. | |
// 0x02: The request timed out after three seconds. | |
const payload = {payloadSize: 1,payload: 1} | |
await msg.endpoint.command('manuSpecificTuya', 'mcuGatewayConnectionStatus', payload, {}); | |
}, | |
}, | |
} | |
const definition = { | |
fingerprint: tuya.fingerprint('TS0601', ['_TZE200_yjjdcqsq', '_TZE200_nvups4nh']), | |
model: 'ZTH01', | |
vendor: 'TuYa', | |
description: 'Temperature and humidity', | |
fromZigbee: [tuya.fz.datapoints, fzLocal.gateway_connection_status], | |
toZigbee: [tuya.tz.datapoints], | |
configure: tuya.configureMagicPacket, | |
exposes: [e.temperature(), e.humidity(), tuya.exposes.batteryState()], | |
meta: { | |
tuyaDatapoints: [ | |
[1, 'temperature', tuya.valueConverter.divideBy10], | |
[2, 'humidity', tuya.valueConverter.raw], | |
[3, 'battery_state', tuya.valueConverter.batteryState], | |
// [9, 'temperature_unit', tuya.valueConverter.raw], Does not have any effect on the device | |
], | |
}, | |
} | |
module.exports = definition; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment