-
-
Notifications
You must be signed in to change notification settings - Fork 142
Allow setting climate mode & set target temperature min/max/step from hass data #178
Allow setting climate mode & set target temperature min/max/step from hass data #178
Conversation
Current temperature does not need min/max values, it has a default already.
@andersonshatch, thanks for your PR! By analyzing the history of the files in this pull request, we identified @robbiet480 and @Minims to be potential reviewers. |
accessories/climate.js
Outdated
|
||
var that = this; | ||
|
||
this.client.callService(this.domain, 'set_operation_mode', serviceData, function(data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space before function parentheses space-before-function-paren
serviceData.entity_id = this.entity_id; | ||
|
||
var mode = ''; | ||
switch (value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected a default case default-case
} else { | ||
callback(communicationError); | ||
} | ||
}); | ||
}, | ||
|
||
setTargetHeatingCoolingState: function (value, callback, context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'context' is defined but never used no-unused-vars
accessories/climate.js
Outdated
state = Characteristic.TargetHeatingCoolingState.OFF; | ||
break; | ||
} | ||
callback(null, state); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected tab character no-tabs
Mixed spaces and tabs no-mixed-spaces-and-tabs
Thanks! 🐬 🍪 💯 |
This PR includes 2 enhancements to the climate accessory:
The ability to set the operation mode of the climate device.
Currently, the 4 HomeKit thermostat modes are Off, Heat, Cool & Auto, these are respectively mapped to the home-assistant climate modes of idle, heat, cool & auto.
In addition, the HK mode is now properly set based on the home-assistant operation mode.
(in future it will be nice to customise this mapping in the homebridge config as climate devices in hass may have different modes (e.g. 'dry', 'fan_only'), but this is a good first step)
The target temperature minimum temperature, maximum temperature and temperature step are now retrieved from the home-assistant climate device's attributes, rather than being hard coded in the climate accessory.
I removed the min/max values which were previously set on the current temperature attribute, as it's possible that those values will be outside the min/max target temperatures of the climate device, and the current temperature attribute itself seems to have sensible defaults.