valid converters fzlocal1

removed switch expose
need to add expose for barrier and movement and toggle button
master
Nathan Wagner 3 years ago
parent ddc2bfdf3c
commit 3e612a8025

@ -3,66 +3,58 @@
const fz = require('zigbee-herdsman-converters/converters/fromZigbee'); const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee'); const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes'); const exposes = require('zigbee-herdsman-converters/lib/exposes');
const reporting = require('zigbee-herdsman-converters/lib/reporting');
const utils = require('zigbee-herdsman-converters/lib/utils'); const utils = require('zigbee-herdsman-converters/lib/utils');
const extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets; const e = exposes.presets;
const ea = exposes.access; const ea = exposes.access;
const fzlocal1 = {
const definition = {
zigbeeModel: ['Digi GarageDoor'],
model: 'Digi GarageDoor homemade',
vendor: 'Digi NathaF',
description: 'Garage door xbee unit',
fromZigbee: [fz.on_off, fzlocal.moving_state, fzlocal.barrier_position, fzlocal.open_period, fzlocal.close_period],
toZigbee: [tz.on_off, tzlocal.barrier_position, tzlocal.stop],
meta: {disableDefaultResponse: true},
exposes: [e.switch(),e.cover_position()],
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(8);
await reporting.bind(endpoint, coordinatorEndpoint, ['genOnOff']);
await reporting.onOff(endpoint);
await reporting.bind(endpoint,coordinatorEndpoint,['barrierControl']);
await reporting.barrierPosition(endpoint);
},
};
const fzLocal = {
moving_state: { moving_state: {
cluster: 'barrierControl', cluster: 'barrierControl',
type: ['attributeReport','readResponse'], type: ['attributeReport','readResponse'],
convert: (model, msg, publish, options, meta) => { convert: (model, msg, publish, options, meta) => {
const movingState = msg.data['movingState'] const movingState = msg.data['256'];
const lookup = { const lookup = {
0: 'Stopped', 0: 'Stopped',
1: 'Closing', 1: 'Closing',
2: 'Opening', 2: 'Opening',
}; };
return lookup[movingState]; const action = lookup[movingState]
return {'movingState': action}
}, },
}, },
barrier_position: {
position: {
cluster: 'barrierControl', cluster: 'barrierControl',
type: ['attributeReport','readResponse'], type: ['attributeReport','readResponse'],
convert: (model, msg, publish, options, meta) => { convert: (model, msg, publish, options, meta) => {
const barrierPosition = msg.data['barrierPosition'] const barrierPosition = msg.data['2560'];
return barrierPosition; const lookup = {
0x00: 'Closed',
0x32: 'ajar',
0x64: 'Open',
};
const action = lookup[barrierPosition]
return {'barrierPosition': action}
},
}, },
open_period: { open_period: {
cluster: 'barrierControl', cluster: 'barrierControl',
type: ['attributeReport', 'readResponse'], type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => { convert: (model, msg, publish, options, meta) => {
const openPeriod = msg.data['openPeriod'] const openPeriod = msg.data['openPeriod'];
return openPeriod return openPeriod;
}, },
}, },
close_period: { close_period: {
cluster: 'barrierControl', cluster: 'barrierControl',
type: ['attributeReport', 'readResponse'], type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => { convert: (model, msg, publish, options, meta) => {
const closePeriod = msg.data['closePeriod'] const closePeriod = msg.data['closePeriod'];
return closePeriod return closePeriod;
},
}, },
}, },
}; };
@ -72,11 +64,26 @@ const fzLocal = {
//key is the value defined map of k:v for command //key is the value defined map of k:v for command
const tzlocal ={ const tzlocal ={
go_to_percent: { go_to_percent: {
key: ['goToPercent'], key: ['go_to_percent'],
convertSet: async (entity, key, value, meta) => { convertSet: async (entity, key, value, meta) => {
await entity.command('barrierControl','goToPercent',0x64,utils.getOptions(meta.mapped, entity)) await entity.command('barrierControl','go_to_percent',0x64,utils.getOptions(meta.mapped, entity))
}, },
}, },
}; };
const definition = {
zigbeeModel: ['Digi GarageDoor'],
model: 'Digi GarageDoor homemade',
vendor: 'Digi Nathan',
description: 'Garage door xbee unit it begins',
fromZigbee: [fz.on_off, fzlocal1.moving_state, fzlocal1.position],
toZigbee: [tz.on_off,tzlocal.go_to_percent],// tzlocal.go_to_percent, tzlocal.stop],
meta: {disableDefaultResponse: true},
exposes: [],//, e.cover_position()],
configure: async (device, coordinatorEndpoint, logger) => {
const endpoint = device.getEndpoint(8);
},
};
module.exports = definition; module.exports = definition;

Loading…
Cancel
Save