Skip to content

Commit 3272f66

Browse files
committed
Add proper typing and fix lookup
Got those types from another part of the codebase so hopefully they are correct, need them for CI to pass.
1 parent b8aea08 commit 3272f66

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/devices/smartwings.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import fz from '../converters/fromZigbee';
22
import tz from '../converters/toZigbee';
33
import * as exposes from '../lib/exposes';
44
import * as reporting from '../lib/reporting';
5-
import {DefinitionWithExtend} from '../lib/types';
6-
import {getOptions} from '../lib/utils';
5+
import {DefinitionWithExtend, Zh} from '../lib/types';
6+
import {getOptions, assertString, getFromLookup} from '../lib/utils';
77

88

99
const backwards_cover_state = {
1010
key: ['state'],
11-
convertSet: async (entity, key, value, meta) => {
11+
convertSet: async (entity: Zh.Endpoint, key: string, value: number | string, meta: any) => {
1212
const lookup = {'open': 'downClose', 'close': 'upOpen', 'stop': 'stop', 'on': 'downClose', 'off': 'upOpen'};
13-
utils.assertString(value, key);
13+
assertString(value, key);
1414
value = value.toLowerCase();
15-
await entity.command('closuresWindowCovering', lookup[value], {}, getOptions(meta.mapped, entity));
15+
await entity.command('closuresWindowCovering', getFromLookup(value, lookup), {}, getOptions(meta.mapped, entity));
1616
},
1717
};
1818

0 commit comments

Comments
 (0)