@ -10,25 +10,26 @@ const e = exposes.presets;
const ea = exposes . access ;
const ea = exposes . access ;
class Barrier extends Base {
/ * c l a s s B a r r i e r e x t e n d s B a s e {
constructor ( ) {
constructor ( ) {
super ( )
super ( ) ;
this . type = 'barrier' ;
this . type = 'barrier' ;
this . features = [ ] ;
this . features = [ ] ;
}
}
barrierPosition( ) {
with barrierPosition( ) {
this . features . push ( new Numeric ( 'position' access . ALL ) . withValueMin ( 0 ) . withValueMax ( 100 ) . withDescription ( 'Barrier Position' )
this . features . push ( new Numeric ( 'position' , access . ALL ) . withValueMin ( 0 ) . withValueMax ( 100 ) . withDescription ( 'Barrier Position' ) ) ;
return this ;
return this ;
}
}
barrierMovement( ) {
with barrierMovement( ) {
this . features . push ( new Enum ( 'state' , access . ALL ) , [ 'OPEN' , 'CLOSE' , 'AJAR' ] )
this . features . push ( new Enum ( 'state' , access . ALL ) , [ 'OPEN' , 'CLOSE' , 'AJAR' ] ) ;
return this ;
return this ;
}
}
} * /
const fzlocal1 = {
const fzlocal1 = {
moving _state : {
moving _state : {
cluster : 'barrierControl' ,
cluster : 'barrierControl' ,
key : [ 'moving_state' ] ,
type : [ 'attributeReport' , 'readResponse' ] ,
type : [ 'attributeReport' , 'readResponse' ] ,
convert : ( model , msg , publish , options , meta ) => {
convert : ( model , msg , publish , options , meta ) => {
const movingState = msg . data [ '256' ] ;
const movingState = msg . data [ '256' ] ;
@ -80,15 +81,17 @@ const fzlocal1 = {
//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 : {
cluster : 'barrierControl' ,
key : [ 'go_to_percent' ] ,
key : [ 'go_to_percent' ] ,
convertSet : async ( entity , key , value , meta ) => {
convertSet : async ( entity , key , value , meta ) => {
await entity . command ( 'barrierControl' , 'go_to_percent' , 0x64 , utils . getOptions ( meta . mapped , entity ) ) ;
await entity . command ( 'barrierControl' , 'go_to_percent' , 0x64 , utils . getOptions ( meta . mapped , entity ) ) ;
} ,
} ,
} ,
} ,
button : {
barrierControl : {
cluster : 'barrierControl' ,
key : [ 'stop' ] ,
key : [ 'stop' ] ,
convertSet async ( entity , key , value , meta ) => {
convertSet : async ( entity , key , value , meta ) => {
await entity . command ( 'barrierControl' , 'stop' ) ;
await entity . command ( 'barrierControl' , 'stop' ) ;
}
}
} ,
} ,
@ -100,12 +103,15 @@ const definition = {
model : 'Digi GarageDoor homemade' ,
model : 'Digi GarageDoor homemade' ,
vendor : 'Digi Nathan' ,
vendor : 'Digi Nathan' ,
description : 'Garage door xbee unit it begins' ,
description : 'Garage door xbee unit it begins' ,
fromZigbee : [ fz . on _off , fzlocal1 . moving _state , fzlocal1 . position ] ,
fromZigbee : [ fzlocal1 . moving _state , fzlocal1 . position ] ,
toZigbee : [ tz . on _off , tzlocal . go _to _percent ] , // tzlocal.go_to_percent, tzlocal.stop],
toZigbee : [ tz local. go _to _percent , tzlocal . barrierControl ] , //, tzlocal.stop], // tzlocal.go_to_percent, tzlocal.stop],
meta : { disableDefaultResponse : true } ,
meta : { disableDefaultResponse : true } ,
exposes : [ ] , //, e.cover_position()],
exposes : [ exposes . enum ( 'barrier Movement' , exposes . access . STATE , [ "stopped" , "closing" , "opening" ] ) . withProperty ( 'movingState' ) . withDescription ( "barrier movement" ) ,
exposes . enum ( 'Barrier Position' , exposes . access . STATE , [ "Closed" , "Ajar" , "Open" ] ) . withProperty ( 'barrierPosition' ) . withDescription ( "barrier movement" ) ,
exposes . binary ( 'Button' , exposes . access . STATE _SET , "Button" , "Button" ) . withValueToggle ( "Button" ) . withProperty ( 'stop' ) . withDescription ( 'button for garage door' ) ] , //, e.cover_position()],
configure : async ( device , coordinatorEndpoint , logger ) => {
configure : async ( device , coordinatorEndpoint , logger ) => {
const endpoint = device . getEndpoint ( 8 ) ;
const endpoint = device . getEndpoint ( 1 ) ;
await reporting . moving _state
} ,
} ,
} ;
} ;