matterbridge-zigbee2mqtt 2.5.0-dev.5 → 2.5.0-dev.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/entity.js CHANGED
@@ -134,6 +134,10 @@ export class ZigbeeEntity extends EventEmitter {
134
134
  this.updateAttributeIfChanged(this.bridgedDevice, undefined, WindowCovering.Cluster.id, 'currentPositionLiftPercent100ths', value * 100);
135
135
  }
136
136
  if (key === 'moving' && this.isDevice) {
137
+ const reversed = this.lastPayload.motor_direction === 'reversed';
138
+ if (reversed && (value === 'UP' || value === 'DOWN')) {
139
+ value = reversed ? (value === 'UP' ? 'DOWN' : 'UP') : value;
140
+ }
137
141
  if (value === 'UP') {
138
142
  const status = WindowCovering.MovementStatus.Opening;
139
143
  this.updateAttributeIfChanged(this.bridgedDevice, undefined, WindowCovering.Cluster.id, 'operationalStatus', { global: status, lift: status, tilt: status });
@@ -1193,21 +1197,22 @@ export class ZigbeeDevice extends ZigbeeEntity {
1193
1197
  });
1194
1198
  }
1195
1199
  if (zigbeeDevice.bridgedDevice.hasClusterServer(WindowCoveringCluster.id)) {
1200
+ const reversed = zigbeeDevice.lastPayload.motor_direction === 'reversed';
1196
1201
  zigbeeDevice.bridgedDevice.addCommandHandler('upOrOpen', async () => {
1197
1202
  zigbeeDevice.log.debug(`Command upOrOpen called for ${zigbeeDevice.ien}${device.friendly_name}${rs}${db}`);
1198
- if (zigbeeDevice.isDevice && zigbeeDevice.propertyMap.has('position'))
1199
- await zigbeeDevice.bridgedDevice?.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', 0, zigbeeDevice.log);
1203
+ if (zigbeeDevice.propertyMap.has('position'))
1204
+ await zigbeeDevice.bridgedDevice?.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', reversed ? 10000 : 0, zigbeeDevice.log);
1200
1205
  else
1201
- await zigbeeDevice.bridgedDevice?.setWindowCoveringTargetAndCurrentPosition(0);
1202
- zigbeeDevice.publishCommand('upOrOpen', device.friendly_name, { state: 'OPEN' });
1206
+ await zigbeeDevice.bridgedDevice?.setWindowCoveringTargetAndCurrentPosition(reversed ? 10000 : 0);
1207
+ zigbeeDevice.publishCommand('upOrOpen', device.friendly_name, { state: reversed ? 'CLOSE' : 'OPEN' });
1203
1208
  });
1204
1209
  zigbeeDevice.bridgedDevice.addCommandHandler('downOrClose', async () => {
1205
1210
  zigbeeDevice.log.debug(`Command downOrClose called for ${zigbeeDevice.ien}${device.friendly_name}${rs}${db}`);
1206
- if (zigbeeDevice.isDevice && zigbeeDevice.propertyMap.has('position'))
1207
- await zigbeeDevice.bridgedDevice?.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', 10000, zigbeeDevice.log);
1211
+ if (zigbeeDevice.propertyMap.has('position'))
1212
+ await zigbeeDevice.bridgedDevice?.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', reversed ? 0 : 10000, zigbeeDevice.log);
1208
1213
  else
1209
- await zigbeeDevice.bridgedDevice?.setWindowCoveringTargetAndCurrentPosition(10000);
1210
- zigbeeDevice.publishCommand('downOrClose', device.friendly_name, { state: 'CLOSE' });
1214
+ await zigbeeDevice.bridgedDevice?.setWindowCoveringTargetAndCurrentPosition(reversed ? 0 : 10000);
1215
+ zigbeeDevice.publishCommand('downOrClose', device.friendly_name, { state: reversed ? 'OPEN' : 'CLOSE' });
1211
1216
  });
1212
1217
  zigbeeDevice.bridgedDevice.addCommandHandler('stopMotion', async () => {
1213
1218
  zigbeeDevice.log.debug(`Command stopMotion called for ${zigbeeDevice.ien}${device.friendly_name}${rs}${db}`);
@@ -1216,7 +1221,7 @@ export class ZigbeeDevice extends ZigbeeEntity {
1216
1221
  });
1217
1222
  zigbeeDevice.bridgedDevice.addCommandHandler('goToLiftPercentage', async ({ request: { liftPercent100thsValue } }) => {
1218
1223
  zigbeeDevice.log.debug(`Command goToLiftPercentage called for ${zigbeeDevice.ien}${device.friendly_name}${rs}${db} request liftPercent100thsValue: ${liftPercent100thsValue}`);
1219
- if (zigbeeDevice.isDevice && zigbeeDevice.propertyMap.has('position'))
1224
+ if (zigbeeDevice.propertyMap.has('position'))
1220
1225
  await zigbeeDevice.bridgedDevice?.setAttribute(WindowCoveringCluster.id, 'targetPositionLiftPercent100ths', liftPercent100thsValue, zigbeeDevice.log);
1221
1226
  else
1222
1227
  await zigbeeDevice.bridgedDevice?.setWindowCoveringTargetAndCurrentPosition(liftPercent100thsValue);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "matterbridge-zigbee2mqtt",
3
- "version": "2.5.0-dev.5",
3
+ "version": "2.5.0-dev.6",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "matterbridge-zigbee2mqtt",
9
- "version": "2.5.0-dev.5",
9
+ "version": "2.5.0-dev.6",
10
10
  "license": "Apache-2.0",
11
11
  "dependencies": {
12
12
  "moment": "2.30.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "matterbridge-zigbee2mqtt",
3
- "version": "2.5.0-dev.5",
3
+ "version": "2.5.0-dev.6",
4
4
  "description": "Matterbridge zigbee2mqtt plugin",
5
5
  "author": "https://github.com/Luligu",
6
6
  "license": "Apache-2.0",