Skip to content

Commit

Permalink
Add correct types to motion sensors (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-hellhake authored Feb 20, 2021
1 parent d417d43 commit 32e083b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/zigbee2mqtt/zigbee2mqtt-property.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ export class Zigbee2MqttProperty<T extends PropertyValue> extends Property<T> {
readOnly: !isWritable(expose.access ?? 0),
...additionalProperties,
});

switch (name) {
case 'occupancy': {
const device = (this.getDevice() as unknown) as { '@type': string[] };
device['@type'].push('MotionSensor');
this.setAtType('MotionProperty');
break;
}
}
}

update(value: unknown, _: Record<string, unknown>): void {
Expand Down

0 comments on commit 32e083b

Please sign in to comment.