Skip to content

Commit

Permalink
style(platform): more consistent naming
Browse files Browse the repository at this point in the history
- use "Motion Sensor" in service naming
- use `front_hw_model` for Hardware
  • Loading branch information
johannrichard committed Dec 4, 2020
1 parent d104708 commit 3231fac
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/platform.ts
Expand Up @@ -287,7 +287,7 @@ export class DingzDaHomebridgePlatform implements DynamicPlatformPlugin {
address: address,
mac: mac.toUpperCase(),
token: token,
model: info.puck_hw_model ?? 'dingz',
model: info.front_hw_model ?? 'dingz',
hwInfo: info,
accessoryClass: 'DingzDaAccessory',
};
Expand Down Expand Up @@ -527,7 +527,7 @@ export class DingzDaHomebridgePlatform implements DynamicPlatformPlugin {
// Add one device based on address and name
private addMyStromPIRDevice({
address,
name = 'Motion Sensor',
name,
token,
}: {
address: string;
Expand All @@ -536,7 +536,7 @@ export class DingzDaHomebridgePlatform implements DynamicPlatformPlugin {
}): boolean {
// Run a diacovery of changed things every 10 seconds
this.log.debug(
`Add configured/discovered myStrom PIR device -> ${name} (${address})`,
`Add configured/discovered myStrom PIR device -> (${address})`,
);
const success = this.getMyStromDeviceInfo({
address,
Expand All @@ -552,13 +552,15 @@ export class DingzDaHomebridgePlatform implements DynamicPlatformPlugin {
);
}

const pirName: string =
name ?? 'my PIR ' + info.mac.toUpperCase().substr(6, 6);
const deviceInfo: DeviceInfo = {
name: info.name ?? name,
name: pirName,
address: address,
mac: info.mac.toUpperCase(),
token: token,
model: '110',
hwInfo: info,
hwInfo: info as MyStromDeviceInfo,
accessoryClass: 'MyStromPIRAccessory',
};

Expand Down

0 comments on commit 3231fac

Please sign in to comment.