Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Allow setting climate mode & set target temperature min/max/step from hass data #178

Merged
merged 3 commits into from
Jul 19, 2017

Conversation

andersonshatch
Copy link
Contributor

This PR includes 2 enhancements to the climate accessory:

  1. 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)

  2. 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.

Current temperature does not need min/max values, it has a default
already.
@mention-bot
Copy link

@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.


var that = this;

this.client.callService(this.domain, 'set_operation_mode', serviceData, function(data) {

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) {

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) {

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

state = Characteristic.TargetHeatingCoolingState.OFF;
break;
}
callback(null, state);

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

@robbiet480 robbiet480 merged commit 3336c6f into home-assistant:master Jul 19, 2017
@robbiet480
Copy link
Member

Thanks! 🐬 🍪 💯

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants