Skip to content

Commit

Permalink
Merge pull request #131 from Grizzelbee/Dev_4.0.14
Browse files Browse the repository at this point in the history
fixes #130
  • Loading branch information
Grizzelbee authored Apr 19, 2021
2 parents f90f8d2 + 61e6720 commit eccd5d0
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 21 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ Here is a list of what these raw values stand for:

## Changelog

### V4.0.15 (2021-04-19) (Moonglow)
* (grizzelbee) Fix: [130](https://github.com/Grizzelbee/ioBroker.mielecloudservice/issues/130) targetTemp for fridges and freezers will now correctly been updated in action section with current values

### V4.0.14 (2021-04-18) (Alchemy)
* (grizzelbee) Fix: [127](https://github.com/Grizzelbee/ioBroker.mielecloudservice/issues/127) targetTemp for fridges caused exception and crash of adapter

Expand Down
4 changes: 2 additions & 2 deletions io-package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"common": {
"name": "mielecloudservice",
"version": "4.0.14",
"version": "4.0.15",
"news": {
"4.0.14": {
"4.0.15": {
"en": "Bugfix Release - see changelog for details!",
"de": "Bugfix Release - Details siehe Changelog!",
"ru": "Выпуск исправления ошибок - подробности см. В журнале изменений!",
Expand Down
14 changes: 7 additions & 7 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ async function addMieleDeviceState(path, currentDevice, currentDeviceState, setu
await mieleTools.createStateSmartGrid(adapter, setup, path, currentDeviceState.remoteEnable.smartGrid);
await mieleTools.createStateMobileStart(adapter, setup, path, currentDeviceState.remoteEnable.mobileStart);
await mieleTools.createStateTemperature(adapter, setup, path, currentDeviceState.temperature);
await mieleTools.createStateTargetTemperatureFridge(adapter, setup, path, currentDeviceState.targetTemperature.hasOwnProperty('zone')? currentDeviceState.targetTemperature.zone[1].value : {}, actions.targetTemperature[0].min, actions.targetTemperature[0].max);
await mieleTools.createStateTargetTemperatureFridge(adapter, setup, path, currentDeviceState.targetTemperature[0].value_localized, actions.targetTemperature[0].min, actions.targetTemperature[0].max, currentDeviceState.targetTemperature[0].unit);
// Actions
await mieleTools.addSuperCoolingSwitch(adapter, setup, path, actions);
break;
Expand All @@ -569,7 +569,7 @@ async function addMieleDeviceState(path, currentDevice, currentDeviceState, setu
await mieleTools.createStateSmartGrid(adapter, setup, path, currentDeviceState.remoteEnable.smartGrid);
await mieleTools.createStateMobileStart(adapter, setup, path, currentDeviceState.remoteEnable.mobileStart);
await mieleTools.createStateTemperature(adapter, setup, path, currentDeviceState.temperature);
await mieleTools.createStateTargetTemperatureFreezer(adapter, setup, path, currentDeviceState.targetTemperature.hasOwnProperty('zone')? currentDeviceState.targetTemperature.zone[1].value : {}, actions.targetTemperature[0].min, actions.targetTemperature[0].max);
await mieleTools.createStateTargetTemperatureFreezer(adapter, setup, path, currentDeviceState.targetTemperature[0].value_localized, actions.targetTemperature[0].min, actions.targetTemperature[0].max, currentDeviceState.targetTemperature[0].unit);
// Actions
await mieleTools.addSuperFreezingSwitch(adapter, setup, path, actions);
break;
Expand All @@ -580,8 +580,8 @@ async function addMieleDeviceState(path, currentDevice, currentDeviceState, setu
await mieleTools.createStateSmartGrid(adapter, setup, path, currentDeviceState.remoteEnable.smartGrid);
await mieleTools.createStateMobileStart(adapter, setup, path, currentDeviceState.remoteEnable.mobileStart);
await mieleTools.createStateTemperature(adapter, setup, path, currentDeviceState.temperature);
await mieleTools.createStateTargetTemperatureFridge(adapter, setup, path, currentDeviceState.targetTemperature.hasOwnProperty('zone')? currentDeviceState.targetTemperature.zone[1].value : {}, actions.targetTemperature[0].min, actions.targetTemperature[0].max);
await mieleTools.createStateTargetTemperatureFreezer(adapter, setup, path, currentDeviceState.targetTemperature.hasOwnProperty('zone')? currentDeviceState.targetTemperature.zone[2].value : {}, actions.targetTemperature[1].min, actions.targetTemperature[1].max);
await mieleTools.createStateTargetTemperatureFridge(adapter, setup, path, currentDeviceState.targetTemperature[0].value_localized, actions.targetTemperature[0].min, actions.targetTemperature[0].max, currentDeviceState.targetTemperature[0].unit);
await mieleTools.createStateTargetTemperatureFreezer(adapter, setup, path, currentDeviceState.targetTemperature[1].value_localized, actions.targetTemperature[1].min, actions.targetTemperature[1].max, currentDeviceState.targetTemperature[1].unit);
// Actions
await mieleTools.addSuperCoolingSwitch(adapter, setup, path, actions);
await mieleTools.addSuperFreezingSwitch(adapter, setup, path, actions);
Expand All @@ -595,7 +595,7 @@ async function addMieleDeviceState(path, currentDevice, currentDeviceState, setu
await mieleTools.createStateSmartGrid(adapter, setup, path, currentDeviceState.remoteEnable.smartGrid);
await mieleTools.createStateMobileStart(adapter, setup, path, currentDeviceState.remoteEnable.mobileStart);
await mieleTools.createStateTemperature(adapter, setup, path, currentDeviceState.temperature);
await mieleTools.createStateTargetTemperatureFridge(adapter, setup, path, currentDeviceState.targetTemperature.hasOwnProperty('zone')? currentDeviceState.targetTemperature.zone[1].value : {}, actions.targetTemperature[0].min, actions.targetTemperature[0].max);
await mieleTools.createStateTargetTemperatureFridge(adapter, setup, path, currentDeviceState.targetTemperature[0].value_localized, actions.targetTemperature[0].min, actions.targetTemperature[0].max, currentDeviceState.targetTemperature[0].unit);
// Actions
await mieleTools.addLightSwitch(adapter, path, actions);
break;
Expand All @@ -617,8 +617,8 @@ async function addMieleDeviceState(path, currentDevice, currentDeviceState, setu
await mieleTools.createStateSmartGrid(adapter, setup, path, currentDeviceState.remoteEnable.smartGrid);
await mieleTools.createStateMobileStart(adapter, setup, path, currentDeviceState.remoteEnable.mobileStart);
await mieleTools.createStateTemperature(adapter, setup, path, currentDeviceState.temperature);
await mieleTools.createStateTargetTemperatureFridge(adapter, setup, path, currentDeviceState.targetTemperature.hasOwnProperty('zone')? currentDeviceState.targetTemperature.zone[1].value : {}, actions.targetTemperature[0].min, actions.targetTemperature[0].max);
await mieleTools.createStateTargetTemperatureFreezer(adapter, setup, path, currentDeviceState.targetTemperature.hasOwnProperty('zone')? currentDeviceState.targetTemperature.zone[2].value : {}, actions.targetTemperature[1].min, actions.targetTemperature[1].max);
await mieleTools.createStateTargetTemperatureFridge(adapter, setup, path, currentDeviceState.targetTemperature[0].value_localized, actions.targetTemperature[0].min, actions.targetTemperature[0].max, currentDeviceState.targetTemperature[0].unit);
await mieleTools.createStateTargetTemperatureFreezer(adapter, setup, path, currentDeviceState.targetTemperature[1].value_localized, actions.targetTemperature[1].min, actions.targetTemperature[1].max, currentDeviceState.targetTemperature[1].unit);
// Actions
await mieleTools.addSuperFreezingSwitch(adapter, setup, path, actions);
await mieleTools.addLightSwitch(adapter, path, actions);
Expand Down
38 changes: 27 additions & 11 deletions miele-Tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ module.exports.createNumber = function(adapter, setup, path, description, value
adapter.log.debug('[createNumber]: Path['+ path +'] Value[' + value + '] Unit[' + unit + ']');
// get back to calling function if there is no valid value given.
return new Promise((resolve) => {
if ( !value || value === -32768 ) {
if ( !value || value === -32768) {
adapter.log.debug('[createNumber]: invalid value detected. Skipping...');
}
if (setup){
Expand Down Expand Up @@ -1358,13 +1358,20 @@ module.exports.createStateTargetTemperature = function(adapter, setup, path, val
* @param adapter {object} link to the adapter instance
* @param setup {boolean} indicator whether the devices need to setup or only states are to be updated
* @param path {string} path where the data point is going to be created
* @param value {object} array value to set to the data point
* @param value {number} value to set to the data point
* @param min {number} minimum temp of the freezer
* @param max {number} maximum temp of the freezer
* @param unit {string} temperature unit
*/
module.exports.createStateTargetTemperatureFridge = function(adapter, setup, path, value, min, max){
adapter.log.debug(`createStateTargetTemperatureFridge: Path[${path}], setup: [${setup}], min: [${min}], max: [${max}], value: [${JSON.stringify(value)}]`);
module.exports.createStateTargetTemperatureFridge = function(adapter, setup, path, value, min, max, unit){
adapter.log.debug(`createStateTargetTemperatureFridge: Path[${path}], setup: [${setup}], min: [${min}], max: [${max}], value: [${value}]`);
if (setup) {
switch (unit){
case 'Celsius' : unit = '°C';
break;
case 'Fahrenheit' : unit = '°F';
break;
}
mieleTools.createExtendObject(adapter,
path + '.ACTIONS.targetTemperatureFridge',
{
Expand All @@ -1376,15 +1383,16 @@ module.exports.createStateTargetTemperatureFridge = function(adapter, setup, pat
type: 'number',
min: min,
max: max,
unit : unit,
role: 'value.temperature'
},
native: {}
}, () => {
adapter.setState(path + '.ACTIONS.targetTemperatureFridge', value.value, true);
adapter.setState(path + '.ACTIONS.targetTemperatureFridge', value, true);
adapter.subscribeStates(path + '.ACTIONS.targetTemperatureFridge');
});
} else {
adapter.setState(path + '.ACTIONS.targetTemperatureFridge', value.value, true);
adapter.setState(path + '.ACTIONS.targetTemperatureFridge', value, true);
}
}

Expand All @@ -1398,13 +1406,20 @@ module.exports.createStateTargetTemperatureFridge = function(adapter, setup, pat
* @param adapter {object} link to the adapter instance
* @param setup {boolean} indicator whether the devices need to setup or only states are to be updated
* @param path {string} path where the data point is going to be created
* @param value {object} array - value to set to the data point
* @param value {number} value to set to the data point
* @param min {number} minimum temp of the freezer
* @param max {number} maximum temp of the freezer
* @param unit {string} temperature unit
*/
module.exports.createStateTargetTemperatureFreezer = function(adapter, setup, path, value, min, max){
adapter.log.debug(`createStateTargetTemperatureFreezer: Path[${path}], setup: [${setup}], min: [${min}], max: [${max}], value: [${ JSON.stringify(value)}]`);
module.exports.createStateTargetTemperatureFreezer = function(adapter, setup, path, value, min, max, unit){
adapter.log.debug(`createStateTargetTemperatureFreezer: Path[${path}], setup: [${setup}], min: [${min}], max: [${max}], value: [${value}]`);
if (setup) {
switch (unit){
case 'Celsius' : unit = '°C';
break;
case 'Fahrenheit' : unit = '°F';
break;
}
mieleTools.createExtendObject(adapter,
path + '.ACTIONS.targetTemperatureFreezer',
{
Expand All @@ -1416,15 +1431,16 @@ module.exports.createStateTargetTemperatureFreezer = function(adapter, setup, pa
type: 'number',
min: min,
max: max,
unit: unit,
role: 'value.temperature'
},
native: {}
}, () => {
adapter.setState(path + '.ACTIONS.targetTemperatureFreezer', value.value, true);
adapter.setState(path + '.ACTIONS.targetTemperatureFreezer', value, true);
adapter.subscribeStates(path + '.ACTIONS.targetTemperatureFreezer');
});
} else {
adapter.setState(path + '.ACTIONS.targetTemperatureFreezer', value.value, true);
adapter.setState(path + '.ACTIONS.targetTemperatureFreezer', value, true);
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iobroker.mielecloudservice",
"version": "4.0.14",
"version": "4.0.15",
"description": "Integrates your MieleCloudService (aka Miele@Home) Devices to ioBroker",
"author": {
"name": "grizzelbee",
Expand Down

0 comments on commit eccd5d0

Please sign in to comment.