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 tz = require('zigbee-herdsman-converters/converters/toZigbee');
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 extend = require('zigbee-herdsman-converters/lib/extend');
const e = exposes.presets;
const ea = exposes.access;
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 = {
const fzlocal1 = {
moving_state: {
cluster: 'barrierControl',
type: ['attributeReport','readResponse'],
convert: (model, msg, publish, options, meta) => {
const movingState = msg.data['movingState']
const movingState = msg.data['256'];
const lookup = {
0: 'Stopped',
1: 'Closing',
2: 'Opening',
};
return lookup[movingState];
const action = lookup[movingState]
return {'movingState': action}
},
},
barrier_position: {
position: {
cluster: 'barrierControl',
type: ['attributeReport','readResponse'],
convert: (model, msg, publish, options, meta) => {
const barrierPosition = msg.data['barrierPosition']
return barrierPosition;
const barrierPosition = msg.data['2560'];
const lookup = {
0x00: 'Closed',
0x32: 'ajar',
0x64: 'Open',
};
const action = lookup[barrierPosition]
return {'barrierPosition': action}
},
},
open_period: {
cluster: 'barrierControl',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
const openPeriod = msg.data['openPeriod']
return openPeriod
const openPeriod = msg.data['openPeriod'];
return openPeriod;
},
},
close_period: {
cluster: 'barrierControl',
type: ['attributeReport', 'readResponse'],
convert: (model, msg, publish, options, meta) => {
const closePeriod = msg.data['closePeriod']
return closePeriod
},
const closePeriod = msg.data['closePeriod'];
return closePeriod;
},
},
};
@ -72,11 +64,26 @@ const fzLocal = {
//key is the value defined map of k:v for command
const tzlocal ={
go_to_percent: {
key: ['goToPercent'],
key: ['go_to_percent'],
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;

Loading…
Cancel
Save