diff --git a/.github/ISSUE_TEMPLATE/----------------------zigbee.md b/.github/ISSUE_TEMPLATE/----------------------zigbee.md index ffcc7cf..6f6e9ba 100644 --- a/.github/ISSUE_TEMPLATE/----------------------zigbee.md +++ b/.github/ISSUE_TEMPLATE/----------------------zigbee.md @@ -8,3 +8,16 @@ assignees: Batyushin, sprut666666 --- Ознакомиться с инструкцией: https://wiki.sprut.ai/ru/spruthub/materials/setup-sprutstick-sniffer-to-add-new-device + +Для добавления поддержки нового устройства в хаб, необходимо: + +1) Спарить устройство с хабом, и убедиться, что оно не поддерживается хабом. Устройство должно появиться на вкладке контроллеров, но не появиться в списке аксессуаров. Модель устройства должна определиться как "Unknown". +2) Найти в интернете или на корпусе/упаковке/инструкции название модели и производителя, и указать их в сообщении. +3) Указать ссылку на сайт производителя с описанием устройства, и pdf файл с описанием настроек и другой информации, если есть. +4) В хабе, напротив устройства нажать на кнопку "Информация" (i), появится подробная информация об устройстве. Ее нужно скопировать (с помощью кнопки в верхнем правом углу) и вставить в сообщение. + +Если на вкладке информации напротив Manufacturer Id/Device Type/Device Id стоит значение "7FFFFFFF" то необходимо вначале переспарить устройство. + +В названии issue указать название производителя и модели. + +Для интеграции нового ZigBee устройства _TZ321C_fkzihax8 (TS0225), ознакомьтесь с детальной информацией, предоставленной в описании issue. diff --git a/README.md b/README.md index 780a20b..f02adde 100644 --- a/README.md +++ b/README.md @@ -77,3 +77,8 @@ [Первые эмоции от Wiren Board](https://youtu.be/keUKt7OPDWA) ### [История изменений](https://t.me/SprutHub) + +### Поддерживаемые устройства + +#### ZigBee +- _TZ321C_fkzihax8 (TS0225) diff --git a/src/devices/zigbee/_TZ321C_fkzihax8.ts b/src/devices/zigbee/_TZ321C_fkzihax8.ts new file mode 100644 index 0000000..a9f743f --- /dev/null +++ b/src/devices/zigbee/_TZ321C_fkzihax8.ts @@ -0,0 +1,98 @@ +import { ZigBeeDevice } from 'zigbee-herdsman-converters'; + +const definition: ZigBeeDevice = { + zigbeeModel: ['TS0225'], + model: 'TS0225', + vendor: '_TZ321C_fkzihax8', + description: 'Presence sensor with magnet and rotating platform', + supports: 'occupancy', + fromZigbee: [ + { + cluster: 'genBasic', + type: ['attributeReport', 'readResponse'], + convert: (model, msg, publish, options, meta) => { + const result: any = {}; + if (msg.data.hasOwnProperty('0x0000')) { + result.zclVersion = msg.data['0x0000']; + } + if (msg.data.hasOwnProperty('0x0001')) { + result.applicationVersion = msg.data['0x0001']; + } + if (msg.data.hasOwnProperty('0x0002')) { + result.stackVersion = msg.data['0x0002']; + } + if (msg.data.hasOwnProperty('0x0003')) { + result.hwVersion = msg.data['0x0003']; + } + if (msg.data.hasOwnProperty('0x0004')) { + result.manufacturerName = msg.data['0x0004']; + } + if (msg.data.hasOwnProperty('0x0005')) { + result.modelId = msg.data['0x0005']; + } + if (msg.data.hasOwnProperty('0x0006')) { + result.dateCode = msg.data['0x0006']; + } + if (msg.data.hasOwnProperty('0x0007')) { + result.powerSource = msg.data['0x0007']; + } + return result; + }, + }, + { + cluster: 'genPowerCfg', + type: ['attributeReport', 'readResponse'], + convert: (model, msg, publish, options, meta) => { + const result: any = {}; + if (msg.data.hasOwnProperty('0x0020')) { + result.batteryVoltage = msg.data['0x0020'] / 10; + } + if (msg.data.hasOwnProperty('0x0021')) { + result.batteryPercentageRemaining = msg.data['0x0021']; + } + return result; + }, + }, + { + cluster: 'msOccupancySensing', + type: ['attributeReport', 'readResponse'], + convert: (model, msg, publish, options, meta) => { + const result: any = {}; + if (msg.data.hasOwnProperty('0x0000')) { + result.occupancy = msg.data['0x0000'] === 1; + } + return result; + }, + }, + ], + toZigbee: [], + exposes: [ + { + type: 'numeric', + name: 'battery_voltage', + property: 'batteryVoltage', + access: 1, + unit: 'V', + description: 'Battery voltage', + }, + { + type: 'numeric', + name: 'battery_percentage_remaining', + property: 'batteryPercentageRemaining', + access: 1, + unit: '%', + description: 'Remaining battery percentage', + }, + { + type: 'binary', + name: 'occupancy', + property: 'occupancy', + access: 1, + value_on: true, + value_off: false, + description: 'Indicates whether the device detected occupancy', + }, + ], +}; + +module.exports = definition; diff --git a/src/devices/zigbee/index.ts b/src/devices/zigbee/index.ts new file mode 100644 index 0000000..db7b541 --- /dev/null +++ b/src/devices/zigbee/index.ts @@ -0,0 +1,7 @@ +import { definition as TZ321C_fkzihax8 } from './_TZ321C_fkzihax8'; + +const devices = [ + TZ321C_fkzihax8, +]; + +export default devices;