Skip to content

Commit

Permalink
Add proper typing and fix lookup
Browse files Browse the repository at this point in the history
Got those types from another part of the codebase so hopefully they are
correct, need them for CI to pass.
  • Loading branch information
Korri committed Jan 27, 2025
1 parent b8aea08 commit 3272f66
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/devices/smartwings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import fz from '../converters/fromZigbee';
import tz from '../converters/toZigbee';
import * as exposes from '../lib/exposes';
import * as reporting from '../lib/reporting';
import {DefinitionWithExtend} from '../lib/types';
import {getOptions} from '../lib/utils';
import {DefinitionWithExtend, Zh} from '../lib/types';
import {getOptions, assertString, getFromLookup} from '../lib/utils';


const backwards_cover_state = {
key: ['state'],
convertSet: async (entity, key, value, meta) => {
convertSet: async (entity: Zh.Endpoint, key: string, value: number | string, meta: any) => {
const lookup = {'open': 'downClose', 'close': 'upOpen', 'stop': 'stop', 'on': 'downClose', 'off': 'upOpen'};
utils.assertString(value, key);
assertString(value, key);
value = value.toLowerCase();
await entity.command('closuresWindowCovering', lookup[value], {}, getOptions(meta.mapped, entity));
await entity.command('closuresWindowCovering', getFromLookup(value, lookup), {}, getOptions(meta.mapped, entity));
},
};

Expand Down

0 comments on commit 3272f66

Please sign in to comment.