Skip to content

Commit

Permalink
Reduced logs for some log messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Sowen committed Dec 29, 2021
1 parent 2219763 commit 6f94011
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 24 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Improvements

- **HmIP-MOD**: Added "lightSwitch" config option to disable light switch if not available.
- **General**: Reduced verbosity of log messages. Some frequent log messages have log level debug now.

### Bugfix

Expand Down
6 changes: 3 additions & 3 deletions src/devices/HmIPBlind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {CharacteristicGetCallback, CharacteristicSetCallback, CharacteristicValu

import {HmIPPlatform} from '../HmIPPlatform';
import {HmIPDevice, HmIPGroup, Updateable} from '../HmIPState';
import {HmIPShutter} from "./HmIPShutter";
import {HmIPShutter} from './HmIPShutter';

interface BlindChannel {
functionalChannelType: string;
Expand Down Expand Up @@ -66,9 +66,9 @@ export class HmIPBlind extends HmIPShutter implements Updateable {
const blindChannel = <BlindChannel>channel;

const slatsLevelHomeKit = HmIPBlind.slatsHmIPToHomeKit(blindChannel.slatsLevel);
if (slatsLevelHomeKit != this.slatsLevel) {
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.platform.log.debug('Current blind slats level of %s changed to %s°', this.accessory.displayName, this.slatsLevel.toFixed(0));
this.service.updateCharacteristic(this.platform.Characteristic.CurrentHorizontalTiltAngle, this.slatsLevel);
this.service.updateCharacteristic(this.platform.Characteristic.TargetHorizontalTiltAngle, this.slatsLevel);
}
Expand Down
4 changes: 2 additions & 2 deletions src/devices/HmIPClimateSensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ export class HmIPClimateSensor extends HmIPGenericDevice implements Updateable {

if (climateSensorChannel.actualTemperature !== this.actualTemperature) {
this.actualTemperature = climateSensorChannel.actualTemperature;
this.platform.log.info('Current temperature of %s changed to %s °C', this.accessory.displayName, this.actualTemperature);
this.platform.log.debug('Current temperature of %s changed to %s °C', this.accessory.displayName, this.actualTemperature);
this.temperatureService.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.actualTemperature);
}

if (climateSensorChannel.humidity !== this.humidity) {
this.humidity = climateSensorChannel.humidity;
this.platform.log.info('Current relative humidity of %s changed to %s %%', this.accessory.displayName, this.humidity);
this.platform.log.debug('Current relative humidity of %s changed to %s %%', this.accessory.displayName, this.humidity);
this.humidityService.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, this.humidity);
}

Expand Down
2 changes: 1 addition & 1 deletion src/devices/HmIPDimmer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class HmIPDimmer extends HmIPGenericDevice implements Updateable {
}

this.brightness = brightness;
this.platform.log.info('Brightness of %s changed to %s %%', this.accessory.displayName, this.brightness.toFixed(0));
this.platform.log.debug('Brightness of %s changed to %s %%', this.accessory.displayName, this.brightness.toFixed(0));
this.service.updateCharacteristic(this.platform.Characteristic.Brightness, this.brightness);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/devices/HmIPDoorLockDrive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class HmIPDoorLockDrive extends HmIPGenericDevice implements Updateable {

if (doorLockChannel.motorState !== null && doorLockChannel.motorState !== this.motorState) {
this.motorState = doorLockChannel.motorState;
this.platform.log.info('Door lock drive motor state of %s changed to %s', this.accessory.displayName, this.motorState);
this.platform.log.debug('Door lock drive motor state of %s changed to %s', this.accessory.displayName, this.motorState);
this.updateHmKitLockTargetState();
this.service.updateCharacteristic(this.platform.Characteristic.LockTargetState, this.targetLockState);
}
Expand Down
9 changes: 4 additions & 5 deletions src/devices/HmIPGarageDoor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export class HmIPGarageDoor extends HmIPGenericDevice implements Updateable {
private service: Service;
private switchService: Service | undefined;

private withLightSwitch = true;
private currentDoorState: DoorState = DoorState.CLOSED;
private previousDoorState: DoorState = DoorState.CLOSED;
private processing = false;
Expand All @@ -56,8 +55,6 @@ export class HmIPGarageDoor extends HmIPGenericDevice implements Updateable {
) {
super(platform, accessory);

this.withLightSwitch = this.accessoryConfig?.['lightSwitch'] === true;

this.platform.log.debug(`Created garage door ${accessory.context.device.label}`);
this.service = this.accessory.getService(this.platform.Service.GarageDoorOpener)
|| this.accessory.addService(this.platform.Service.GarageDoorOpener);
Expand All @@ -73,7 +70,9 @@ export class HmIPGarageDoor extends HmIPGenericDevice implements Updateable {
this.service.getCharacteristic(this.platform.Characteristic.ObstructionDetected)
.on('get', this.handleObstructionDetectedGet.bind(this));

if (this.withLightSwitch) {
const withLightSwitch = this.accessoryConfig?.['lightSwitch'] === true;

if (withLightSwitch) {
this.switchService = this.accessory.getService(this.platform.Service.Switch)
|| this.accessory.addService(this.platform.Service.Switch);

Expand Down Expand Up @@ -149,7 +148,7 @@ export class HmIPGarageDoor extends HmIPGenericDevice implements Updateable {

if (doorChannel.processing !== null && doorChannel.processing !== this.processing) {
this.processing = doorChannel.processing;
this.platform.log.info('Garage door processing state of %s changed to %s', this.accessory.displayName, this.processing);
this.platform.log.debug('Garage door processing state of %s changed to %s', this.accessory.displayName, this.processing);
if (!this.processing && this.currentDoorState !== DoorState.OPEN && this.currentDoorState !== DoorState.CLOSED){
this.service.updateCharacteristic(this.platform.Characteristic.CurrentDoorState,
this.platform.Characteristic.CurrentDoorState.STOPPED);
Expand Down
6 changes: 3 additions & 3 deletions src/devices/HmIPHeatingThermostat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,19 @@ export class HmIPHeatingThermostat extends HmIPGenericDevice implements Updateab

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

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

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);
this.platform.log.debug('Current valve position of %s changed to %s', this.accessory.displayName, this.valvePosition);
}

if (heatingThermostatChannel.valveState !== this.valveState) {
Expand Down
2 changes: 1 addition & 1 deletion src/devices/HmIPLightSensor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class HmIPLightSensor extends HmIPGenericDevice implements Updateable {

if (lightSensorChannel.averageIllumination !== null && lightSensorChannel.averageIllumination !== this.averageIllumination) {
this.averageIllumination = lightSensorChannel.averageIllumination;
this.platform.log.info('Average light level of %s changed to %s lx', this.accessory.displayName, this.averageIllumination);
this.platform.log.debug('Average light level of %s changed to %s lx', this.accessory.displayName, this.averageIllumination);
this.service.updateCharacteristic(this.platform.Characteristic.CurrentAmbientLightLevel, this.averageIllumination);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/devices/HmIPMotionDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class HmIPMotionDetector extends HmIPGenericDevice implements Updateable

if (motionDetectionChannel.motionDetected !== null && motionDetectionChannel.motionDetected !== this.motionDetected) {
this.motionDetected = motionDetectionChannel.motionDetected;
this.platform.log.info('Motion detector state of %s changed to %s', this.accessory.displayName, this.motionDetected);
this.platform.log.debug('Motion detector state of %s changed to %s', this.accessory.displayName, this.motionDetected);
this.service.updateCharacteristic(this.platform.Characteristic.MotionDetected, this.motionDetected);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/devices/HmIPPresenceDetector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class HmIPPresenceDetector extends HmIPGenericDevice implements Updateabl

if (presenceDetectionChannel.presenceDetected !== null && presenceDetectionChannel.presenceDetected !== this.presenceDetected) {
this.presenceDetected = presenceDetectionChannel.presenceDetected;
this.platform.log.info('Presence detector state of %s changed to %s', this.accessory.displayName, this.presenceDetected);
this.platform.log.debug('Presence detector state of %s changed to %s', this.accessory.displayName, this.presenceDetected);
this.service.updateCharacteristic(this.platform.Characteristic.OccupancyDetected, this.presenceDetected
? this.platform.Characteristic.OccupancyDetected.OCCUPANCY_DETECTED
: this.platform.Characteristic.OccupancyDetected.OCCUPANCY_NOT_DETECTED);
Expand Down
4 changes: 2 additions & 2 deletions src/devices/HmIPShutter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ export class HmIPShutter extends HmIPGenericDevice implements Updateable {
const shutterLevelHomeKit = HmIPShutter.shutterHmIPToHomeKit(shutterChannel.shutterLevel);
if (shutterLevelHomeKit !== this.shutterLevel) {
this.shutterLevel = shutterLevelHomeKit;
this.platform.log.info('Current shutter level of %s changed to %s %%', this.accessory.displayName, this.shutterLevel.toFixed(0));
this.platform.log.debug('Current shutter level of %s changed to %s %%', this.accessory.displayName, this.shutterLevel.toFixed(0));
this.service.updateCharacteristic(this.platform.Characteristic.CurrentPosition, this.shutterLevel);
this.service.updateCharacteristic(this.platform.Characteristic.TargetPosition, this.shutterLevel);
}

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.platform.log.debug('Processing state of shutter/blind %s changed to %s', this.accessory.displayName, this.processing);
this.service.updateCharacteristic(this.platform.Characteristic.PositionState, this.processing ?
this.platform.Characteristic.PositionState.DECREASING : this.platform.Characteristic.PositionState.STOPPED);
}
Expand Down
4 changes: 2 additions & 2 deletions src/devices/HmIPSwitchMeasuring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ export class HmIPSwitchMeasuring extends HmIPGenericDevice implements Updateable
if (switchMeasuringChannel.currentPowerConsumption !== null
&& switchMeasuringChannel.currentPowerConsumption !== this.currentPowerConsumption) {
this.currentPowerConsumption = switchMeasuringChannel.currentPowerConsumption;
this.platform.log.info('Switch power consumption of %s changed to %s W',
this.platform.log.debug('Switch power consumption of %s changed to %s W',
this.accessory.displayName, this.currentPowerConsumption.toFixed(1));
this.service.updateCharacteristic(this.platform.customCharacteristic.characteristic.ElectricPower, this.currentPowerConsumption);
}

if (switchMeasuringChannel.energyCounter !== null && switchMeasuringChannel.energyCounter !== this.energyCounter) {
this.energyCounter = switchMeasuringChannel.energyCounter;
this.platform.log.info('Switch energy counter of %s changed to %s kWh',
this.platform.log.debug('Switch energy counter of %s changed to %s kWh',
this.accessory.displayName, this.energyCounter.toFixed(3));
this.service.updateCharacteristic(this.platform.customCharacteristic.characteristic.ElectricalEnergy, this.energyCounter);
}
Expand Down
4 changes: 2 additions & 2 deletions src/devices/HmIPWallMountedThermostat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ export class HmIPWallMountedThermostat extends HmIPGenericDevice implements Upda

if (wthChannel.actualTemperature !== null && wthChannel.actualTemperature !== this.actualTemperature) {
this.actualTemperature = wthChannel.actualTemperature;
this.platform.log.info('Current temperature of %s changed to %s °C', this.accessory.displayName, this.actualTemperature);
this.platform.log.debug('Current temperature of %s changed to %s °C', this.accessory.displayName, this.actualTemperature);
this.service.updateCharacteristic(this.platform.Characteristic.CurrentTemperature, this.actualTemperature);
}

if (wthChannel.humidity !== null && wthChannel.humidity !== this.humidity) {
this.humidity = wthChannel.humidity;
this.platform.log.info('Current relative humidity of %s changed to %s %%', this.accessory.displayName, this.humidity);
this.platform.log.debug('Current relative humidity of %s changed to %s %%', this.accessory.displayName, this.humidity);
this.service.updateCharacteristic(this.platform.Characteristic.CurrentRelativeHumidity, this.humidity);
}

Expand Down

0 comments on commit 6f94011

Please sign in to comment.