@@ -2,7 +2,20 @@ import fz from '../converters/fromZigbee';
2
2
import tz from '../converters/toZigbee' ;
3
3
import * as exposes from '../lib/exposes' ;
4
4
import * as reporting from '../lib/reporting' ;
5
- import { DefinitionWithExtend } from '../lib/types' ;
5
+ import { DefinitionWithExtend , Tz , Zh } from '../lib/types' ;
6
+ import { assertString , getFromLookup , getOptions } from '../lib/utils' ;
7
+
8
+ const tzLocal = {
9
+ backwards_cover_state : {
10
+ key : [ 'state' ] ,
11
+ convertSet : async ( entity : Zh . Endpoint , key : string , value : number | string , meta : Tz . Meta ) => {
12
+ const lookup = { open : 'downClose' , close : 'upOpen' , stop : 'stop' , on : 'downClose' , off : 'upOpen' } ;
13
+ assertString ( value , key ) ;
14
+ value = value . toLowerCase ( ) ;
15
+ await entity . command ( 'closuresWindowCovering' , getFromLookup ( value , lookup ) , { } , getOptions ( meta . mapped , entity ) ) ;
16
+ } ,
17
+ } ,
18
+ } ;
6
19
7
20
const e = exposes . presets ;
8
21
@@ -13,7 +26,7 @@ const definitions: DefinitionWithExtend[] = [
13
26
vendor : 'Smartwings' ,
14
27
description : 'Roller shade' ,
15
28
fromZigbee : [ fz . cover_position_tilt , fz . battery ] ,
16
- toZigbee : [ tz . cover_state , tz . cover_position_tilt ] ,
29
+ toZigbee : [ tzLocal . backwards_cover_state , tz . cover_position_tilt ] ,
17
30
meta : { battery : { dontDividePercentage : true } , coverInverted : true } ,
18
31
configure : async ( device , coordinatorEndpoint ) => {
19
32
const endpoint = device . getEndpoint ( 1 ) ;
0 commit comments