Skip to content

Commit

Permalink
fix(ignore): J1 test failures
Browse files Browse the repository at this point in the history
  • Loading branch information
sjorge committed Apr 28, 2024
1 parent 24ebe72 commit 35d0520
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 30 deletions.
30 changes: 1 addition & 29 deletions src/devices/ubisys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -870,38 +870,10 @@ const definitions: Definition[] = [
toZigbee: [tz.cover_state, tz.cover_position_tilt, tz.metering_power,
ubisys.tz.configure_j1, ubisys.tz.configure_device_setup,
tz.currentsummdelivered],
exposes: (device, options) => {
const coverExpose = e.cover();
const coverType = (device?.getEndpoint(1).getClusterAttributeValue('closuresWindowCovering', 'windowCoveringType') ?? undefined);
switch (coverType) { // cf. Ubisys J1 Technical Reference Manual, chapter 7.2.5.1 Calibration
case 0: // Roller Shade, Lift only
case 1: // Roller Shade two motors, Lift only
case 2: // Roller Shade exterior, Lift only
case 3: // Roller Shade two motors exterior, Lift only
case 4: // Drapery, Lift only
case 5: // Awning, Lift only
case 9: // Projector Screen, Lift only
coverExpose.withPosition();
break;
case 6: // Shutter, Tilt only
case 7: // Tilt Blind, Tilt only
coverExpose.withTilt();
break;
case 8: // Tilt Blind, Lift & Tilt
default:
coverExpose.withPosition().withTilt();
break;
}
return [
coverExpose,
e.power().withAccess(ea.STATE_GET),
e.energy().withAccess(ea.STATE_GET),
e.linkquality(),
];
},
extend: [
ubisysModernExtend.addCustomClusterManuSpecificUbisysDeviceSetup(),
ubisysModernExtend.addCustomClusterClosuresWindowCovering(),
ubisysModernExtend.cover(),
],
configure: async (device, coordinatorEndpoint) => {
const endpoint1 = device.getEndpoint(1);
Expand Down
35 changes: 34 additions & 1 deletion src/lib/ubisys.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Fz, Tz, ModernExtend, Configure} from './types';
import {ModernExtend, Fz, Tz, Configure, Expose} from './types';
import {presets as e, access as ea} from './exposes';
import {numeric, NumericArgs, deviceAddCustomCluster, setupConfigureForReporting} from './modernExtend';
import {Zcl} from 'zigbee-herdsman';
Expand Down Expand Up @@ -222,4 +222,37 @@ export const ubisysModernExtend = {

return {exposes: [expose], fromZigbee, toZigbee, configure, isModernExtend: true};
},
cover: (): ModernExtend => {
// XXX: in the future we should split fromZigbee/toZigbee, onEvent,... and have these as seperate modernExtends

const exposes: Expose[] = [];
exposes.push((device: Zh.Device, options) => {

Check failure on line 229 in src/lib/ubisys.ts

View workflow job for this annotation

GitHub Actions / ci

Argument of type '(device: Zh.Device, options: any) => void' is not assignable to parameter of type 'Expose'.

Check failure on line 229 in src/lib/ubisys.ts

View workflow job for this annotation

GitHub Actions / ci

Cannot find namespace 'Zh'.

Check failure on line 229 in src/lib/ubisys.ts

View workflow job for this annotation

GitHub Actions / ci

Parameter 'options' implicitly has an 'any' type.
const coverExpose = e.cover();
const coverType = (device?.getEndpoint(1).getClusterAttributeValue('closuresWindowCovering', 'windowCoveringType') ?? undefined);
switch (coverType) { // cf. Ubisys J1 Technical Reference Manual, chapter 7.2.5.1 Calibration
case 0: // Roller Shade, Lift only
case 1: // Roller Shade two motors, Lift only
case 2: // Roller Shade exterior, Lift only
case 3: // Roller Shade two motors exterior, Lift only
case 4: // Drapery, Lift only
case 5: // Awning, Lift only
case 9: // Projector Screen, Lift only
coverExpose.withPosition();
break;
case 6: // Shutter, Tilt only
case 7: // Tilt Blind, Tilt only
coverExpose.withTilt();
break;
case 8: // Tilt Blind, Lift & Tilt
default:
coverExpose.withPosition().withTilt();
break;
}
});
exposes.push(e.power().withAccess(ea.STATE_GET));
exposes.push(e.energy().withAccess(ea.STATE_GET));
exposes.push(e.linkquality());

return {exposes: exposes, isModernExtend: true};
},
};

0 comments on commit 35d0520

Please sign in to comment.