Code
- 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 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 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: '_TZE284_aao3yzhs',
- },
- ],
- model: 'TS0601_soil_3',
- vendor: 'TuYa',
- description: 'Soil sensor',
- fromZigbee: [tuya.fz.datapoints],
- toZigbee: [tuya.tz.datapoints],
- onEvent: tuya.onEventSetTime,
- configure: tuya.configureMagicPacket,
- exposes: [e.temperature(), e.soil_moisture(), tuya.exposes.temperatureUnit(), e.battery(), tuya.exposes.batteryState()],
- meta: {
- // All datapoints go in here
- tuyaDatapoints: [
- [3, 'soil_moisture', tuya.valueConverter.raw],
- [5, 'temperature', tuya.valueConverter.divideBy10],
- [9, 'temperature_unit', tuya.valueConverter.temperatureUnit],
- [14, 'battery_state', tuya.valueConverter.batteryState],
- [15, 'battery', tuya.valueConverter.raw],
- ],
- },
- extend: [
- // A preferred new way of extending functionality.
- ],
- };
- module.exports = definition;