Skip to content

Commit

Permalink
Merge pull request #9 from ApolloSK/patch-3
Browse files Browse the repository at this point in the history
Fix PLUGABLE_SWITCH
  • Loading branch information
jogibear9988 authored Jan 18, 2019
2 parents 5c8ae4e + 1ea4bf1 commit 02c6e55
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,16 @@ class HmIpCloudAccesspointAdapter extends utils.Adapter {
promises.push(this.setStateAsync('devices.' + device.id + '.info.label', device.label, true));
switch (device.type) {
case 'FULL_FLUSH_SWITCH_MEASURING':
case 'PLUGABLE_SWITCH':
case 'PLUGABLE_SWITCH_MEASURING': {
promises.push(this.setStateAsync('devices.' + device.id + '.channels.1.on', device.functionalChannels['1'].on, true));
promises.push(this.setStateAsync('devices.' + device.id + '.channels.1.energyCounter', device.functionalChannels['1'].energyCounter, true));
promises.push(this.setStateAsync('devices.' + device.id + '.channels.1.currentPowerConsumption', device.functionalChannels['1'].currentPowerConsumption, true));
break;
}
case 'PLUGABLE_SWITCH': {
promises.push(this.setStateAsync('devices.' + device.id + '.channels.1.on', device.functionalChannels['1'].on, true));
break;
}
case 'BRAND_WALL_MOUNTED_THERMOSTAT':
case 'WALL_MOUNTED_THERMOSTAT_PRO':
case 'TEMPERATURE_HUMIDITY_SENSOR_DISPLAY': {
Expand Down Expand Up @@ -302,7 +305,6 @@ class HmIpCloudAccesspointAdapter extends utils.Adapter {
promises.push(this.setObjectNotExistsAsync('devices.' + device.id + '.info.label', { type: 'state', common: { name: 'type', type: 'string', role: 'info', read: true, write: false }, native: {} }));
switch (device.type) {
case 'FULL_FLUSH_SWITCH_MEASURING':
case 'PLUGABLE_SWITCH':
case 'PLUGABLE_SWITCH_MEASURING': {
promises.push(this.setObjectNotExistsAsync('devices.' + device.id + '.channels.1', { type: 'channel', common: {}, native: {} }));
promises.push(this.setObjectNotExistsAsync('devices.' + device.id + '.channels.1.on', { type: 'state', common: { name: 'on', type: 'boolean', role: 'switch', read: true, write: true }, native: { id: device.id, channel: 1, parameter: 'switchState' } }));
Expand All @@ -311,6 +313,11 @@ class HmIpCloudAccesspointAdapter extends utils.Adapter {
promises.push(this.setObjectNotExistsAsync('devices.' + device.id + '.channels.1.resetEnergyCounter', { type: 'state', common: { name: 'on', type: 'boolean', role: 'button', read: false, write: true }, native: { id: device.id, channel: 1, parameter: 'resetEnergyCounter' } }));
break;
}
case 'PLUGABLE_SWITCH': {
promises.push(this.setObjectNotExistsAsync('devices.' + device.id + '.channels.1', { type: 'channel', common: {}, native: {} }));
promises.push(this.setObjectNotExistsAsync('devices.' + device.id + '.channels.1.on', { type: 'state', common: { name: 'on', type: 'boolean', role: 'switch', read: true, write: true }, native: { id: device.id, channel: 1, parameter: 'switchState' } }));
break;
}
case 'BRAND_WALL_MOUNTED_THERMOSTAT':
case 'WALL_MOUNTED_THERMOSTAT_PRO':
case 'TEMPERATURE_HUMIDITY_SENSOR_DISPLAY': {
Expand Down

0 comments on commit 02c6e55

Please sign in to comment.