Skip to content

Commit

Permalink
set/correct BatteryLevel Characteristic (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed May 5, 2019
1 parent 9106c26 commit 7830060
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions homematic-devices/hm-cc-vg-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ module.exports = class HmCcVg1 extends Accessory {
lowbat = lowbat || lowbatDps[ldp];
});
batteryService.update('StatusLowBattery', lowbat ? hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW : hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL);
batteryService.update('BatteryLevel', lowbat ? 0 : 100);
});
});

Expand Down
1 change: 1 addition & 0 deletions homematic-devices/hmip-heating.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ module.exports = class HmipHeating extends Accessory {
lowbat = lowbat || lowbatDps[ldp];
});
batteryService.update('StatusLowBattery', lowbat ? hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_LOW : hap.Characteristic.StatusLowBattery.BATTERY_LEVEL_NORMAL);
batteryService.update('BatteryLevel', lowbat ? 0 : 100);
});
});

Expand Down
4 changes: 3 additions & 1 deletion homematic-devices/hmip-swo-b.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ module.exports = class HmipSwo extends Accessory {
.get('StatusLowBattery', config.deviceAddress + ':0.LOW_BAT', (value, c) => {
return value ? c.BATTERY_LEVEL_LOW : c.BATTERY_LEVEL_NORMAL;
})
.get('BatteryLevel', config.deviceAddress + ':0.OPERATING_VOLTAGE', this.percent)
.get('BatteryLevel', config.deviceAddress + ':0.OPERATING_VOLTAGE', val => {
return this.percent(val, null, 3, 4.5);
})
.update('ChargingState', 2);

if (this.option('HumiditySensor')) {
Expand Down

0 comments on commit 7830060

Please sign in to comment.