Skip to content

Commit

Permalink
HmIP-eTRV fixes. Shutter/Blind progress indicator fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Sowen committed Feb 12, 2021
1 parent 07c0e3c commit 3d6e456
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 29 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
## 0.2.3 (2021-02-12)

### New devices

- **HmIP-eTRV-C**: Heating-thermostat compact without display

### Improvements

- **HmIP-eTRV**: Fixed update of valve position. Show valve position changes in logs.
- **HmIP-eTRV**: Valve position > 0 indicates current cooling/heating state: HEAT. Valve position = 0 indicates current
heating cooling/heating state: OFF.
- **HmIP-eTRV**: Added logs for setting ignored values (target cooling/heating mode, display units).
- **HmIP-eTRV**: Target cooling/heating mode is now ignored. Will be used for future mapping of custom states.
- **HmIP-eTRV**: Show changes of valve state in logs.

### Bugfix

- **Shutter/Blind**: Fixed spinning progress indicator in Home app.
- **HmIP-eTRV-C**: HmIP-eTRV-C was listed but not actually supported.

## 0.2.2 (2021-02-11)

### New devices
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ button and note the "auth_token" that is being generated, add it to your config.

- HmIP-HAP (Access Point)
- HmIP-eTRV (Radiator Thermostat)
- HmIP-eTRV-C (Heating-thermostat compact without display)
- HmIP-eTRV-2 (Radiator Thermostat)
- HmIP-eTRV-B (Radiator Thermostat - basic)
- HmIP-eTRV-C (Heating-thermostat - compact without display)
- HmIP-FROLL (Shutter Actuator - flush-mount)
- HmIP-BROLL (Shutter Actuator - brand-mount)
- HmIP-FBL (Blind Actuator - flush-mount)
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "homebridge-homematicip",
"version": "0.2.2",
"version": "0.2.3",
"description": "Homematic IP plugin for homebridge",
"license": "Apache-2.0",
"author": "Marc Sowen <marc.sowen@gmail.com>",
Expand Down
3 changes: 2 additions & 1 deletion src/HmIPPlatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ export class HmIPPlatform implements DynamicPlatformPlugin {
|| device.type === 'TEMPERATURE_HUMIDITY_SENSOR_OUTDOOR'
|| device.type === 'TEMPERATURE_HUMIDITY_SENSOR_DISPLAY') {
homebridgeDevice = new HmIPClimateSensor(this, hmIPAccessory.accessory);
} else if (device.type === 'HEATING_THERMOSTAT') {
} else if (device.type === 'HEATING_THERMOSTAT'
|| device.type === 'HEATING_THERMOSTAT_COMPACT') {
homebridgeDevice = new HmIPHeatingThermostat(this, hmIPAccessory.accessory);
} else if (device.type === 'FULL_FLUSH_SHUTTER'
|| device.type === 'BRAND_SHUTTER') {
Expand Down
10 changes: 8 additions & 2 deletions src/devices/HmIPBlind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,19 @@ export class HmIPBlind extends HmIPShutter implements Updateable {
if (slatsLevelHomeKit != this.slatsLevel) {
this.slatsLevel = slatsLevelHomeKit;
this.platform.log.info('Current blind slats level of %s changed to %s', this.accessory.displayName, this.slatsLevel.toFixed(0));
this.service.updateCharacteristic(this.platform.Characteristic.CurrentHorizontalTiltAngle, slatsLevelHomeKit);
this.service.updateCharacteristic(this.platform.Characteristic.CurrentHorizontalTiltAngle, this.slatsLevel);
}

}
}
}

protected updateProcessingState() {
super.updateProcessingState();
if (!this.processing) {
this.service.updateCharacteristic(this.platform.Characteristic.TargetHorizontalTiltAngle, this.slatsLevel);
}
}

private static slatsHmIPToHomeKit(hmIPValue: number): number {
return -90 + (hmIPValue * 180.0);
}
Expand Down
73 changes: 55 additions & 18 deletions src/devices/HmIPHeatingThermostat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,25 @@ import {HmIPPlatform} from '../HmIPPlatform';
import {HmIPDevice, HmIPGroup, Updateable} from '../HmIPState';
import {HmIPGenericDevice} from './HmIPGenericDevice';

enum ValveState {
STATE_NOT_AVAILABLE = "STATE_NOT_AVAILABLE",
RUN_TO_START = "RUN_TO_START",
WAIT_FOR_ADAPTION = "WAIT_FOR_ADAPTION",
ADAPTION_IN_PROGRESS = "ADAPTION_IN_PROGRESS",
ADAPTION_DONE = "ADAPTION_DONE",
TOO_TIGHT = "TOO_TIGHT",
ADJUSTMENT_TOO_BIG = "ADJUSTMENT_TOO_BIG",
ADJUSTMENT_TOO_SMALL = "ADJUSTMENT_TOO_SMALL",
ERROR_POSITION = "ERROR_POSITION",
}

interface HeatingThermostatChannel {
functionalChannelType: string;
valveActualTemperature: number;
setPointTemperature: number;
valvePosition: number;
temperatureOffset: number;
valveState: string;
valveState: ValveState;
groups: string[];
}

Expand All @@ -29,6 +41,7 @@ export class HmIPHeatingThermostat extends HmIPGenericDevice implements Updateab
private valveActualTemperature = 0;
private setPointTemperature = 0;
private valvePosition = 0;
private valveState: ValveState = ValveState.ERROR_POSITION;
private heatingGroupId = '';

constructor(
Expand Down Expand Up @@ -59,20 +72,20 @@ export class HmIPHeatingThermostat extends HmIPGenericDevice implements Updateab
this.service.getCharacteristic(this.platform.Characteristic.TemperatureDisplayUnits)
.on('get', this.handleTemperatureDisplayUnitsGet.bind(this))
.on('set', this.handleTemperatureDisplayUnitsSet.bind(this));

}

handleCurrentHeatingCoolingStateGet(callback: CharacteristicGetCallback) {
callback(null, this.valveActualTemperature <= (this.setPointTemperature + 0.1) && this.valvePosition > 0 ?
this.platform.Characteristic.CurrentHeatingCoolingState.HEAT : this.platform.Characteristic.CurrentHeatingCoolingState.COOL);
callback(null, this.valvePosition > 0 ?
this.platform.Characteristic.CurrentHeatingCoolingState.HEAT : this.platform.Characteristic.CurrentHeatingCoolingState.OFF);
}

handleTargetHeatingCoolingStateGet(callback: CharacteristicGetCallback) {
callback(null, this.valveActualTemperature <= (this.setPointTemperature + 0.1) && this.valvePosition > 0 ?
this.platform.Characteristic.CurrentHeatingCoolingState.HEAT : this.platform.Characteristic.CurrentHeatingCoolingState.COOL);
callback(null, this.platform.Characteristic.TargetHeatingCoolingState.AUTO);
}

handleTargetHeatingCoolingStateSet(value: CharacteristicValue, callback: CharacteristicSetCallback) {
this.platform.log.info('Ignoring setting heating/cooling state for %s to %s', this.accessory.displayName,
this.getTargetHeatingCoolingStateName(<number>value));
callback(null);
}

Expand All @@ -99,38 +112,62 @@ export class HmIPHeatingThermostat extends HmIPGenericDevice implements Updateab
}

handleTemperatureDisplayUnitsSet(value: CharacteristicValue, callback: CharacteristicSetCallback) {
this.platform.log.info('Ignoring setting display units for %s to %s', this.accessory.displayName,
value == 0 ? "CELSIUS" : "FAHRENHEIT");
callback(null);
}

handleCurrentActuationGet(callback: CharacteristicGetCallback) {
callback(null, this.valvePosition);
}

public updateDevice(hmIPDevice: HmIPDevice, groups: { [key: string]: HmIPGroup }) {
super.updateDevice(hmIPDevice, groups);
for (const id in hmIPDevice.functionalChannels) {
const channel = hmIPDevice.functionalChannels[id];
if (channel.functionalChannelType === 'HEATING_THERMOSTAT_CHANNEL') {
const wthChannel = <HeatingThermostatChannel>channel;
const heatingThermostatChannel = <HeatingThermostatChannel>channel;

if (wthChannel.setPointTemperature !== this.setPointTemperature) {
this.platform.log.info(`Target temperature of ${this.accessory.displayName} changed to ${wthChannel.setPointTemperature}`);
this.setPointTemperature = wthChannel.setPointTemperature;
if (heatingThermostatChannel.setPointTemperature !== this.setPointTemperature) {
this.setPointTemperature = heatingThermostatChannel.setPointTemperature;
this.platform.log.info('Target temperature of %s changed to %s', this.accessory.displayName, this.setPointTemperature);
this.service.updateCharacteristic(this.platform.Characteristic.TargetTemperature, this.setPointTemperature);
}

if (wthChannel.valveActualTemperature !== this.valveActualTemperature) {
this.platform.log.info(`Current temperature of ${this.accessory.displayName} changed to ${wthChannel.valveActualTemperature}`);
this.valveActualTemperature = wthChannel.valveActualTemperature;
if (heatingThermostatChannel.valveActualTemperature !== this.valveActualTemperature) {
this.valveActualTemperature = heatingThermostatChannel.valveActualTemperature;
this.platform.log.info('Current temperature of %s changed to %s', this.accessory.displayName, this.valveActualTemperature);
this.service.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.valveActualTemperature);
}

for (const groupId of wthChannel.groups) {
if (heatingThermostatChannel.valvePosition !== this.valvePosition) {
this.valvePosition = heatingThermostatChannel.valvePosition;
this.platform.log.info('Current valve position of %s changed to %s', this.accessory.displayName, this.valvePosition);
}

if (heatingThermostatChannel.valveState !== this.valveState) {
this.valveState = heatingThermostatChannel.valveState;
this.platform.log.info('Current valve state of %s changed to %s', this.accessory.displayName, this.valveState);
}

for (const groupId of heatingThermostatChannel.groups) {
if (groups[groupId].type === 'HEATING') {
this.heatingGroupId = groupId;
}
}
}
}
}

private getTargetHeatingCoolingStateName(heatingCoolingState: number): string {
switch (heatingCoolingState) {
case this.platform.Characteristic.TargetHeatingCoolingState.OFF:
return "OFF";
case this.platform.Characteristic.TargetHeatingCoolingState.HEAT:
return "HEAT";
case this.platform.Characteristic.TargetHeatingCoolingState.COOL:
return "COOL";
case this.platform.Characteristic.TargetHeatingCoolingState.AUTO:
return "AUTO";
default:
return "UNKNOWN";
}
}

}
16 changes: 13 additions & 3 deletions src/devices/HmIPShutter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import {HmIPPlatform} from '../HmIPPlatform';
import {HmIPDevice, HmIPGroup, Updateable} from '../HmIPState';
import {HmIPGenericDevice} from './HmIPGenericDevice';
import {HmIPBlind} from './HmIPBlind';

interface ShutterChannel {
functionalChannelType: string;
Expand All @@ -28,7 +29,7 @@ export class HmIPShutter extends HmIPGenericDevice implements Updateable {

// Values are HomeKit style (100..0)
protected shutterLevel = 0;
private processing = false;
protected processing = false;

constructor(
platform: HmIPPlatform,
Expand Down Expand Up @@ -106,13 +107,22 @@ export class HmIPShutter extends HmIPGenericDevice implements Updateable {
if (shutterChannel.processing != this.processing) {
this.processing = shutterChannel.processing;
this.platform.log.info('Processing state of shutter/blind %s changed to %s', this.accessory.displayName, this.processing);
this.service.updateCharacteristic(this.platform.Characteristic.PositionState,
shutterChannel.processing ? this.platform.Characteristic.PositionState.DECREASING : this.platform.Characteristic.PositionState.STOPPED);
this.updateProcessingState();
}

}
}
}

protected updateProcessingState() {
if (this.processing) {
this.service.updateCharacteristic(this.platform.Characteristic.PositionState, this.platform.Characteristic.PositionState.DECREASING);
} else {
this.service.updateCharacteristic(this.platform.Characteristic.PositionState, this.platform.Characteristic.PositionState.STOPPED);
this.service.updateCharacteristic(this.platform.Characteristic.TargetPosition, this.shutterLevel);
}
}

protected static shutterHmIPToHomeKit(hmIPValue: number): number {
return (1 - hmIPValue) * 100.0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ export const PLUGIN_NAME = 'homebridge-homematicip';
/**
* Version to be used in protocol communication
*/
export const PLUGIN_VERSION = '0.2.2';
export const PLUGIN_VERSION = '0.2.3';

0 comments on commit 3d6e456

Please sign in to comment.