Skip to content

Commit

Permalink
1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrandlehner committed Aug 18, 2023
1 parent 5457dc2 commit 11c4c2b
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 55 deletions.
55 changes: 26 additions & 29 deletions config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,10 @@
"temperature_unit": {
"title": "Define Temperature Unit",
"type": "string",
"required": true,
"default": "C",
"oneOf": [{
"title": "Fahrenheit",
"enum": [
"F"
]
},
{
"title": "Celsius",
"enum": [
"C"
]
}
]
"oneOf": [{"title": "Fahrenheit", "enum": ["F"]},
{"title": "Celsius", "enum": ["C"]}]
},
"uuid": {
"title": "Client UUID token if needed",
Expand All @@ -44,7 +34,8 @@
},
"system": {
"type": "string",
"title": "Daikin default or Skyfi",
"title": "Default Daikin device or Skyfi-model?",
"description": "Try with Default first before choosing the Skyfi-option. Consult the documentation for more information.",
"enum": [ "Default", "Skyfi" ],
"default": "Default",
"required": true
Expand All @@ -57,10 +48,11 @@
},
"swingMode": {
"title": "Swing mode",
"description": "Some Daikin ACs support different swing modes.",
"description": "Apple Home allows to enable OSCILLATE. However most Daikin ACs support different swing modes. This setting allows to choose the swing-mode used if oscillation is enabled.",
"type": "string",
"default": "1",
"oneOf": [
"default": "1",
"required": true,
"oneOf": [
{ "title": "Vertical Swing (default)", "enum": ["1"] },
{ "title": "Horizontal Swing", "enum": ["2"] },
{ "title": "3D Swing", "enum": ["3"] }
Expand All @@ -74,17 +66,22 @@
},
"fanMode": {
"title": "Fan mode",
"description": "Choose between normal fan or dry mode",
"type": "string",
"enum": [ "FAN", "DRY" ],
"default": "FAN"
"description": "If in DRY-mode, switching on the FAN in Apple-Home will start the AC in dry mode. If in FAN-mode, it will only activate the FAN.",
"type": "string",
"default": "FAN",
"required": true,
"oneOf": [
{ "title": "FAN", "enum": ["FAN"] },
{ "title": "DRY", "enum": ["DRY"] }
]
},
"fanPowerMode": {
"title": "Fan power mode",
"description": "Should Fan power only affect the fan or complete device.",
"type": "string",
"enum": [ "FAN only", "Complete Device" ],
"default": "FAN only"
"default": "FAN only",
"required": true,
"enum": [ "FAN only", "Complete Device" ]
},
"fanName": {
"title": "FAN name",
Expand All @@ -95,27 +92,27 @@
},
"defaultMode": {
"title": "Default operation mode",
"description": "When turning on the Daikin device in HomeBridge using a single-tap, the default operation mode will be applied.",
"description": "When turning on the Daikin device in HomeBridge using a single-tap, the default operation mode will be applied. The Daikin-Auto-mode does not match Apple-Homekit - so it is advised to use either COOL- or HEAT-mode if possible.",
"type": "string",
"default": "3",
"oneOf": [
{ "title": "Auto (default)", "enum": ["1"] },
{ "title": "Cool", "enum": ["3"] },
{ "title": "Auto", "enum": ["1"] },
{ "title": "Cool (default)", "enum": ["3"] },
{ "title": "Heat", "enum": ["4"] }
],
"default": "1",
"required": true
},
"enableHumiditySensor": {
"title": "Humidity sensor enabled",
"description": "Enables humidity sensor if Daikin device is equipped with one.",
"description": "Enables humidity sensor if present in Daikin device.",
"type": "boolean",
"default": false
},
"enableTemperatureSensor": {
"title": "Temperature sensor enabled",
"description": "Enables temperature sensor in HomeKit.",
"type": "boolean",
"default": true
"default": false
},
"response": {
"title": "Response",
Expand Down
47 changes: 24 additions & 23 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ Daikin.prototype = {
request.set('X-Daikin-uuid', this.uuid);
// .disableTLSCerts(); // the units use a self-signed cert and the CA doesn't seem to be publicly available
// the units use a self-signed cert and the CA doesn't seem to be publicly available.
// Node.js 18 supports OpenSSL 3.0 which requires secure renegotiation by default.
// Node.js 18 utilizes OpenSSL 3.0 which requires secure renegotiation by default.
const unsafeAgent = new https.Agent({
rejectUnauthorized: false,
secureOptions: crypto.constants.SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION,
Expand Down Expand Up @@ -408,7 +408,7 @@ Daikin.prototype = {
const responseValues = this.parseResponse(body);
this.log.debug('getActive: Power is: %s, Mode is %s', responseValues.pow, responseValues.mode);
let HomeKitState = '0';
if (responseValues.mode === '6' || responseValues.mode === '2' || responseValues.mode === '1') // If AC is in Fan-mode, or an Humidity-mode then show AC OFF in HomeKit
if (responseValues.mode === '6' || responseValues.mode === '2' || responseValues.mode === '1') // If AC is in Fan-mode, or in Humidity-mode then show AC OFF in HomeKit
HomeKitState = '0';
else
if (responseValues.pow === '1')
Expand Down Expand Up @@ -605,7 +605,7 @@ Daikin.prototype = {
}
}

this.log.debug('getTargetHeaterCollerState is %s', status);
this.log.debug('getTargetHeaterCoolerState is %s', status);
callback(null, status);
});
},
Expand Down Expand Up @@ -802,7 +802,7 @@ Daikin.prototype = {
},

daikinSpeedToRaw: function (daikinSpeed) {
let raw = 5; // FV 16.6.2021 Setting minimum Speed for default value below...
let raw;
this.log.debug('daikinSpeedtoRaw: got value %s', daikinSpeed);
switch (daikinSpeed) {
case 'A': {
Expand Down Expand Up @@ -834,8 +834,8 @@ Daikin.prototype = {
break;}

default: {
// do nothing
this.log.debug('daikinSpeedtoRaw: default case - not changing speed. Message is for debugging purpose only.');
raw = 5;
this.log.debug('daikinSpeedtoRaw: Invalid speed value. Setting default raw value to 5');
}
}

Expand All @@ -848,20 +848,21 @@ rawToDaikinSpeed: function (rawFanSpeed) {
let f_rate = 'A';
rawFanSpeed = Number(rawFanSpeed);
this.log.debug('rawToDaikinSpeed: numberized value %s', rawFanSpeed);
if ((rawFanSpeed > 0) && (rawFanSpeed <= 9)) {// from 1% to 5%, we set the SILENT mode
f_rate = 'B';
} else if ((rawFanSpeed > 9) && (rawFanSpeed < 20)) {
f_rate = 'A';
} else if ((rawFanSpeed >= 20) && (rawFanSpeed < 30)) {
f_rate = '3';
} else if ((rawFanSpeed >= 30) && (rawFanSpeed < 40)) {
f_rate = '4';
} else if ((rawFanSpeed >= 40) && (rawFanSpeed < 60)) {
f_rate = '5';
} else if ((rawFanSpeed >= 60) && (rawFanSpeed < 80)) {
f_rate = '6';
} else if ((rawFanSpeed >= 80) && (rawFanSpeed <= 100)) {
f_rate = '7';
const speedRanges = [
{min: 1, max: 9, value: 'B'}, // silent fan speed
{min: 9, max: 20, value: 'A'}, // Auto fan speed
{min: 20, max: 30, value: '3'},
{min: 30, max: 40, value: '4'},
{min: 40, max: 60, value: '5'},
{min: 60, max: 80, value: '6'},
{min: 80, max: 100, value: '7'},
];

for (const range of speedRanges) {
if (rawFanSpeed >= range.min && rawFanSpeed < range.max) {
f_rate = range.value;
break;
}
}

this.log.debug('rawToDaikinSpeed: Daikin Speed is %s', f_rate);
Expand All @@ -876,12 +877,12 @@ getFanStatus: function (callback) {
},
getFanStatusFV(callback) { // FV 210510: Wrapper for service call to early return
const counter = ++this.counter;
this.log.debug('getFanStatusFV: early callback with cached Status: %s (%d).', this.powerDescription[this.Fan_Status], counter);
this.log.debug('getFanStatusFV: early callback with cached Status: %s (counter: %d).', this.powerDescription[this.Fan_Status], counter);
callback(null, this.Fan_Status);
this.getFanStatus((error, HomeKitState) => {
this.Fan_Status = HomeKitState;
this.FanService.getCharacteristic(Characteristic.On).updateValue(this.Fan_Status); // FV210504
this.log.debug('getFanStatusFV: update Status: %s (%d).', this.powerDescription[this.Fan_Status], counter);
this.log.debug('getFanStatusFV: update Status: %s (counter: %d).', this.Fan_Status ? 'on' : 'off', counter);
});
},

Expand All @@ -898,7 +899,7 @@ getFanStatus: function (callback) {
currentPOW = 1;

const targetFanMode = this.fanMode; // FAN or Dehumidify */
this.log.info('setFanStatus: HomeKit requested to turn the FAN %s.', this.powerDescription[targetPOW]);
this.log.info('setFanStatus: HomeKit requested to turn the FAN %s.', this.powerDescription[targetPOW]);
this.log.debug('setFanStatus: Current Power is: %s.', this.powerDescription[currentPOW]);
this.log.debug('setFanStatus: Current Mode is: %s.', this.modeDescription[responseValues.mode]);

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-daikin-local",
"version": "1.0.3",
"version": "1.0.4",
"description": "daikin plugin for homebridge: https://github.com/nfarina/homebridge",
"license": "MIT",
"keywords": [
Expand Down

0 comments on commit 11c4c2b

Please sign in to comment.