Skip to content

Commit

Permalink
New: Add name of the lamp to the Moonlight Mode switch
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Okonetchnikov authored and okonet committed Jan 4, 2020
1 parent d9fe7dc commit d528461
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bulbs/moonlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ const MoonlightMode = Device =>
class extends Device {
constructor(props, platform) {
super(props, platform);
const { bright, active_mode } = props;
const { bright, active_mode, name } = props;
this.bright = bright;
this.activeMode = active_mode || 0;

this.moonlightModeService =
this.accessory.getService(global.Service.Switch) ||
this.accessory.addService(new global.Service.Switch('Moonlight Mode'));
this.accessory.addService(
new global.Service.Switch(`Moonlight Mode ${name}`)
);

this.moonlightModeService
.getCharacteristic(global.Characteristic.On)
Expand Down

0 comments on commit d528461

Please sign in to comment.