@@ -60,7 +60,22 @@ const getApplicableCalibrationModes = (isNLLVSwitch: boolean): KeyValueString =>
60
60
61
61
export const legrandOptions = { manufacturerCode : Zcl . ManufacturerCode . LEGRAND_GROUP , disableDefaultResponse : true } ;
62
62
63
- export const _067776 = {
63
+ export const eLegrand = {
64
+ identify : ( ) => {
65
+ return e
66
+ . enum ( 'identify' , ea . SET , [ 'identify' ] )
67
+ . withDescription ( 'Blinks the built-in LED to make it easier to identify the device' )
68
+ . withCategory ( 'config' ) ;
69
+ } ,
70
+ ledInDark : ( ) => {
71
+ return e
72
+ . binary ( 'led_in_dark' , ea . ALL , 'ON' , 'OFF' )
73
+ . withDescription ( 'Enables the built-in LED allowing to see the switch in the dark' )
74
+ . withCategory ( 'config' ) ;
75
+ } ,
76
+ ledIfOn : ( ) => {
77
+ return e . binary ( 'led_if_on' , ea . ALL , 'ON' , 'OFF' ) . withDescription ( 'Enables the LED on activity' ) . withCategory ( 'config' ) ;
78
+ } ,
64
79
getCover : ( device : Zh . Device ) => {
65
80
const c = e . cover_position ( ) ;
66
81
@@ -93,24 +108,6 @@ export const _067776 = {
93
108
} ,
94
109
} ;
95
110
96
- export const eLegrand = {
97
- identify : ( ) => {
98
- return e
99
- . enum ( 'identify' , ea . SET , [ 'identify' ] )
100
- . withDescription ( 'Blinks the built-in LED to make it easier to identify the device' )
101
- . withCategory ( 'config' ) ;
102
- } ,
103
- ledInDark : ( ) => {
104
- return e
105
- . binary ( 'led_in_dark' , ea . ALL , 'ON' , 'OFF' )
106
- . withDescription ( 'Enables the built-in LED allowing to see the switch in the dark' )
107
- . withCategory ( 'config' ) ;
108
- } ,
109
- ledIfOn : ( ) => {
110
- return e . binary ( 'led_if_on' , ea . ALL , 'ON' , 'OFF' ) . withDescription ( 'Enables the LED on activity' ) . withCategory ( 'config' ) ;
111
- } ,
112
- } ;
113
-
114
111
export const readInitialBatteryState : OnEvent = async ( type , data , device , options ) => {
115
112
if ( [ 'deviceAnnounce' ] . includes ( type ) ) {
116
113
const endpoint = device . getEndpoint ( 1 ) ;
@@ -220,4 +217,43 @@ export const fzLegrand = {
220
217
return payload ;
221
218
} ,
222
219
} satisfies Fz . Converter ,
220
+ command_cover : {
221
+ cluster : 'closuresWindowCovering' ,
222
+ type : [ 'attributeReport' , 'readResponse' ] ,
223
+ convert : ( model , msg , publish , options , meta ) => {
224
+ const payload : KeyValueAny = { } ;
225
+ if ( msg . data . tuyaMovingState !== undefined ) {
226
+ if ( ( 0 , utils . hasAlreadyProcessedMessage ) ( msg , model ) ) return ;
227
+ if ( msg . data [ 'tuyaMovingState' ] === 0 ) {
228
+ // return {
229
+ // action: 'open',
230
+ // };
231
+ payload [ 'action' ] = ( 0 , utils . postfixWithEndpointName ) ( 'OPEN' , msg , model , meta ) ;
232
+ ( 0 , utils . addActionGroup ) ( payload , msg , model ) ;
233
+ }
234
+ if ( msg . data [ 'tuyaMovingState' ] === 100 ) {
235
+ // return {
236
+ // action: 'closed',
237
+ // };
238
+ payload [ 'action' ] = ( 0 , utils . postfixWithEndpointName ) ( 'CLOSE' , msg , model , meta ) ;
239
+ ( 0 , utils . addActionGroup ) ( payload , msg , model ) ;
240
+ }
241
+ if ( msg . data [ 'tuyaMovingState' ] >= 1 && msg . data [ 'tuyaMovingState' ] < 100 ) {
242
+ // return {
243
+ // action: 'stop',
244
+ // };
245
+ payload [ 'action' ] = ( 0 , utils . postfixWithEndpointName ) ( 'STOP' , msg , model , meta ) ;
246
+ ( 0 , utils . addActionGroup ) ( payload , msg , model ) ;
247
+ }
248
+ }
249
+ return payload ;
250
+ } ,
251
+ } satisfies Fz . Converter ,
252
+ identify : {
253
+ cluster : 'genIdentify' ,
254
+ type : [ 'attributeReport' , 'readResponse' ] ,
255
+ convert : ( model , msg , publish , options , meta ) => {
256
+ return { } ;
257
+ } ,
258
+ } satisfies Fz . Converter ,
223
259
} ;
0 commit comments