Skip to content

Commit

Permalink
Use overrides for ValveAccessory (#376)
Browse files Browse the repository at this point in the history
* Use overrides for ValveAccessory

* Fix code style
  • Loading branch information
monkeycatdog authored Sep 30, 2023
1 parent 63ff35f commit bf6f551
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/accessory/ValveAccessory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ export default class ValveAccessory extends BaseAccessory {
this.accessory.removeService(oldService);
}

const schema = this.device.schema.filter((schema) => schema.code.startsWith('switch') && schema.type === TuyaDeviceSchemaType.Boolean);
const schema = SCHEMA_CODE.ON.map(code => this.getSchema(code))
.filter((s: TuyaDeviceSchema | undefined): s is TuyaDeviceSchema => !!s && s.type === TuyaDeviceSchemaType.Boolean);

for (const _schema of schema) {
const name = (schema.length === 1) ? this.device.name : _schema.code;
this.configureValve(_schema, name);
Expand Down

0 comments on commit bf6f551

Please sign in to comment.