Skip to content

Commit

Permalink
Fix for issue where manual fan control caused fan schedule settings t…
Browse files Browse the repository at this point in the history
…o be lost on some thermostats.
  • Loading branch information
adriancable committed Oct 9, 2020
1 parent 3ec167c commit a15552a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![verified-by-homebridge](https://badgen.net/badge/homebridge/verified/purple)](https://github.com/homebridge/homebridge/wiki/Verified-Plugins)
[![Discord](https://img.shields.io/discord/432663330281226270?color=728ED5&logo=discord&label=discord)](https://discord.gg/j5WwJTB)

Nest plug-in for [Homebridge](https://github.com/nfarina/homebridge) using the native Nest API. See what's new in [release 4.4.11](https://github.com/chrisjshull/homebridge-nest/releases/tag/v4.4.11).
Nest plug-in for [Homebridge](https://github.com/nfarina/homebridge) using the native Nest API. See what's new in [release 4.4.12](https://github.com/chrisjshull/homebridge-nest/releases/tag/v4.4.12).

Integrate your Nest Thermostat (including Nest Temperature Sensors), Nest Protect, and Nest x Yale Lock devices into your HomeKit system. Both Nest Accounts (pre-August 2019) and Google Accounts are supported.

Expand Down
19 changes: 18 additions & 1 deletion lib/nest-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -873,6 +873,15 @@ class Connection {
body.device[id].fan_timer_active = fanControlSetting.data.property.value.fanTimerTimeout && fanControlSetting.data.property.value.fanTimerTimeout.value;
body.device[id].fan_timer_timeout = body.device[id].fan_timer_active ? fanControlSetting.data.property.value.fanTimerTimeout.value : 0;
body.device[id].fan_timer_duration = body.device[id].fan_timer_active ? fanControlSetting.data.property.value.fanTimerTimeout.value - Date.now() : 0;

// Protobuf-only fan properties
body.device[id].fan_mode_protobuf = fanControlSetting.data.property.value.mode;
body.device[id].fan_hvac_override_speed_protobuf = fanControlSetting.data.property.value.hvacOverrideSpeed;
body.device[id].fan_schedule_speed_protobuf = fanControlSetting.data.property.value.scheduleSpeed;
body.device[id].fan_schedule_duty_cycle_protobuf = fanControlSetting.data.property.value.scheduleDutyCycle;
body.device[id].fan_schedule_start_time_protobuf = fanControlSetting.data.property.value.scheduleStartTime;
body.device[id].fan_schedule_end_time_protobuf = fanControlSetting.data.property.value.scheduleEndTime;
body.device[id].fan_timer_speed_protobuf = fanControlSetting.data.property.value.timerSpeed;
}
});

Expand Down Expand Up @@ -1555,7 +1564,15 @@ class Connection {
};
newEl.property.value.active = { value: Number(deviceActive) };
} else if (protoType == 'type.nestlabs.com/nest.trait.hvac.FanControlSettingsTrait') {
newEl.property.value = {};
newEl.property.value = {
mode: currentState.device[device].fan_mode_protobuf || 'FAN_MODE_UNSPECIFIED',
hvacOverrideSpeed: currentState.device[device].fan_hvac_override_speed_protobuf || 'FAN_SPEED_SETTING_UNSPECIFIED',
scheduleSpeed: currentState.device[device].fan_schedule_speed_protobuf || 'FAN_SPEED_SETTING_UNSPECIFIED',
scheduleDutyCycle: currentState.device[device].fan_schedule_duty_cycle_protobuf || 0,
scheduleStartTime: currentState.device[device].fan_schedule_start_time_protobuf || 0,
scheduleEndTime: currentState.device[device].fan_schedule_end_time_protobuf || 0,
timerSpeed: currentState.device[device].fan_timer_speed_protobuf || 'FAN_SPEED_SETTING_UNSPECIFIED'
};
// newEl.property.value.updateInfo = updateInfo;
} else if (protoType == 'type.nestlabs.com/nest.trait.hvac.EcoModeStateTrait') {
newEl.property.value = {};
Expand Down
2 changes: 1 addition & 1 deletion lib/nest-device-accessory.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function NestDeviceAccessory(conn, log, device, structure, platform) {
this.structureId = structure.structure_id;
this.platform = platform;

this.log('initing ' + this.deviceType + ' "' + this.name + '":', 'deviceId:', this.deviceId, 'structureId:', this.structureId);
this.log('initing ' + this.deviceType + (device.using_protobuf ? ' (P)' : '') + ' "' + this.name + '":', 'deviceId:', this.deviceId, 'structureId:', this.structureId);
// this.log.debug(this.device);

const id = uuid.generate('nest' + '.' + this.deviceType + '.' + this.deviceId);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
"prepublishOnly": "npm run lint",
"preversion": "npm run lint"
},
"version": "4.4.11",
"version": "4.4.12",
"warnings": [
{
"code": "ENOTSUP",
"required": {
"node": ">=7.0.0",
"homebridge": ">=0.2.5"
},
"pkgid": "[email protected].11"
"pkgid": "[email protected].12"
}
]
}

0 comments on commit a15552a

Please sign in to comment.