Skip to content

Commit

Permalink
Fix to support 1st generation thermostats without Eco mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
adriancable committed Oct 6, 2020
1 parent 2a854a3 commit 3ec167c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 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.10](https://github.com/chrisjshull/homebridge-nest/releases/tag/v4.4.10).
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).

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
7 changes: 6 additions & 1 deletion lib/nest-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,12 @@ class Connection {
thisDevice.name = (thisDevice.name || thisDevice.where_name || 'Nest') + ' Thermostat';
thisDevice.fan_timer_active = (thisDevice.fan_timer_timeout > 0) || thisDevice.hvac_fan_state;
thisDevice.previous_hvac_mode = thisDevice.target_temperature_type.toLowerCase();
thisDevice.hvac_mode = (thisDevice.eco.mode == 'manual-eco' || thisDevice.eco.mode == 'auto-eco') ? 'eco' : thisDevice.previous_hvac_mode;
thisDevice.has_eco_mode = !!thisDevice.eco;
if (thisDevice.has_eco_mode) {
thisDevice.hvac_mode = (thisDevice.eco.mode == 'manual-eco' || thisDevice.eco.mode == 'auto-eco') ? 'eco' : thisDevice.previous_hvac_mode;
} else {
thisDevice.hvac_mode = thisDevice.previous_hvac_mode;
}
thisDevice.software_version = thisDevice.current_version;
thisDevice.hvac_state = (thisDevice.can_heat && thisDevice.hvac_heater_state) ? 'heating' : (thisDevice.can_cool && thisDevice.hvac_ac_state ? 'cooling' : 'off');
thisDevice.is_online = track[deviceId] && track[deviceId].online;
Expand Down
7 changes: 2 additions & 5 deletions lib/nest-thermostat-accessory.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,15 @@ class NestThermostatAccessory extends NestDeviceAccessory {
if (this.device.has_fan && !this.platform.optionSet('Thermostat.Fan.Disable', this.device.serial_number, this.device.device_id)) {
const thermostatFanService = this.addService(Service.Fan, 'Fan', 'fan.' + this.device.serial_number);
const formatFanState = function (val) {
if (val) {
return 'On';
}
return 'Off';
return val ? 'On' : 'Off';
};
this.bindCharacteristic(thermostatFanService, Characteristic.On, 'Fan State', this.getFanState, this.setFanState, formatFanState);
}

thermostatService.addOptionalCharacteristic(Characteristic.StatusActive);
bindCharacteristic(Characteristic.StatusActive, 'Online status', this.getOnlineStatus);

if (!this.platform.optionSet('Thermostat.Eco.Disable', this.device.serial_number, this.device.device_id)) {
if (this.device.has_eco_mode && !this.platform.optionSet('Thermostat.Eco.Disable', this.device.serial_number, this.device.device_id)) {
const thermostatEcoModeService = this.addService(Service.Switch, 'Eco Mode', 'eco_mode.' + this.device.serial_number);
this.bindCharacteristic(thermostatEcoModeService, Characteristic.On, 'Eco Mode', this.getEcoMode, this.setEcoMode);
}
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.10",
"version": "4.4.11",
"warnings": [
{
"code": "ENOTSUP",
"required": {
"node": ">=7.0.0",
"homebridge": ">=0.2.5"
},
"pkgid": "[email protected].10"
"pkgid": "[email protected].11"
}
]
}

0 comments on commit 3ec167c

Please sign in to comment.