Skip to content

Commit b8aea08

Browse files
committed
Invert direction for Smartwings shades
Inspired by ZHA's approach, and feedback form SmartWings support, I confirmed that this converter works and am now proposing that we merge it to the main codebase. For shades to work well, you still need to invert their Zigbee state (press Up & Down together for 5s, then Press the P button under the battery cover once).
1 parent 46d86e8 commit b8aea08

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/devices/smartwings.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ import tz from '../converters/toZigbee';
33
import * as exposes from '../lib/exposes';
44
import * as reporting from '../lib/reporting';
55
import {DefinitionWithExtend} from '../lib/types';
6+
import {getOptions} from '../lib/utils';
7+
8+
9+
const backwards_cover_state = {
10+
key: ['state'],
11+
convertSet: async (entity, key, value, meta) => {
12+
const lookup = {'open': 'downClose', 'close': 'upOpen', 'stop': 'stop', 'on': 'downClose', 'off': 'upOpen'};
13+
utils.assertString(value, key);
14+
value = value.toLowerCase();
15+
await entity.command('closuresWindowCovering', lookup[value], {}, getOptions(meta.mapped, entity));
16+
},
17+
};
618

719
const e = exposes.presets;
820

@@ -13,7 +25,7 @@ const definitions: DefinitionWithExtend[] = [
1325
vendor: 'Smartwings',
1426
description: 'Roller shade',
1527
fromZigbee: [fz.cover_position_tilt, fz.battery],
16-
toZigbee: [tz.cover_state, tz.cover_position_tilt],
28+
toZigbee: [backwards_cover_state, tz.cover_position_tilt],
1729
meta: {battery: {dontDividePercentage: true}, coverInverted: true},
1830
configure: async (device, coordinatorEndpoint) => {
1931
const endpoint = device.getEndpoint(1);

0 commit comments

Comments
 (0)