Skip to content

Commit

Permalink
Merge pull request aholstenson#149 from pieter/power-fix
Browse files Browse the repository at this point in the history
Plug devices: Properly set initial power state
  • Loading branch information
aholstenson authored May 17, 2018
2 parents 3490031 + a74d6de commit dbd66fd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/devices/capabilities/power.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { Thing, SwitchablePower } = require('abstract-things');

module.exports = Thing.mixin(Parent => class extends Parent.with(SwitchablePower) {
propertyUpdated(key, value) {
if(key === 'power') {
if(key === 'power' && value !== undefined) {
this.updatePower(value);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/devices/gateway/plug.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = class Plug extends SubDevice

this.defineProperty('status', {
name: 'power',
mapper: v => v === 'on'
mapper: v => (v === '') ? undefined : (v === 'on')
});

this.defineProperty('load_voltage', {
Expand Down

0 comments on commit dbd66fd

Please sign in to comment.