diff --git a/README.md b/README.md index 340988a..407c012 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,9 @@ When the adapter crashes or an other Code error happens, this error message that ## Changelog +### __WORK IN PROGRESS__ +* (simatec) Fix Sunprotect End-Delay + ### 1.7.2 (2024-06-20) * (simatec) Fix Shutterstate enabled diff --git a/lib/sunProtect.js b/lib/sunProtect.js index 5b567ed..9315bbf 100644 --- a/lib/sunProtect.js +++ b/lib/sunProtect.js @@ -243,9 +243,8 @@ async function sunProtect(adapter, elevation, azimuth, shutterSettings) { adapter.log.debug('#1 Started sunprotect end delay for ' + shutterSettings[s].shutterName); shutterSettings[s].sunProtectEndtimerid = setTimeout(async function () { shutterSettings[s].sunProtectEndtimerid = '0'; - }, shutterSettings[s].sunProtectEndDely * 60000, i); + }, shutterSettings[s].sunProtectEndDely * 60000, s); } - if (insideTemp < parseFloat(hysteresisInside) || (parseFloat(hysteresisOutside) > outsideTemp || shutterSettings[s].lightSensor != '' && parseFloat(hysteresisLight) > sunLight && shutterSettings[s].sunProtectEndtimerid === '0') || (parseFloat(hysteresisOutside) > outsideTemp && shutterSettings[s].lightSensor == '')) { if (pendingAlarm == false) { @@ -295,9 +294,8 @@ async function sunProtect(adapter, elevation, azimuth, shutterSettings) { adapter.log.debug('#2 Started sunprotect end delay for ' + shutterSettings[s].shutterName); shutterSettings[s].sunProtectEndtimerid = setTimeout(async function () { shutterSettings[s].sunProtectEndtimerid = '0'; - }, shutterSettings[s].sunProtectEndDely * 60000, i); + }, shutterSettings[s].sunProtectEndDely * 60000, s); } - if (insideTemp < parseFloat(hysteresisInside) || (parseFloat(hysteresisOutside) > outsideTemp || shutterSettings[s].lightSensor != '' && parseFloat(hysteresisLight) > sunLight && shutterSettings[s].sunProtectEndtimerid === '0') || (parseFloat(hysteresisOutside) > outsideTemp && shutterSettings[s].lightSensor == '')) { if (pendingAlarm == false) { @@ -473,10 +471,9 @@ async function sunProtect(adapter, elevation, azimuth, shutterSettings) { adapter.log.debug('#3 Started sunprotect end delay for ' + shutterSettings[s].shutterName); shutterSettings[s].sunProtectEndtimerid = setTimeout(async function () { shutterSettings[s].sunProtectEndtimerid = '0'; - }, shutterSettings[s].sunProtectEndDely * 60000, i); + }, shutterSettings[s].sunProtectEndDely * 60000, s); } - if (insideTemp < parseFloat(hysteresisInside) || (resultDirectionRangePlus) < azimuth || (parseFloat(hysteresisOutside) > outsideTemp || shutterSettings[s].lightSensor != '' && parseFloat(hysteresisLight) > sunLight && shutterSettings[s].sunProtectEndtimerid === '0') || (parseFloat(hysteresisOutside) > outsideTemp && shutterSettings[s].lightSensor == '')) { if (pendingAlarm == false) { @@ -527,9 +524,8 @@ async function sunProtect(adapter, elevation, azimuth, shutterSettings) { adapter.log.debug('#4 Started sunprotect end delay for ' + shutterSettings[s].shutterName); shutterSettings[s].sunProtectEndtimerid = setTimeout(async function () { shutterSettings[s].sunProtectEndtimerid = '0'; - }, shutterSettings[s].sunProtectEndDely * 60000, i); + }, shutterSettings[s].sunProtectEndDely * 60000, s); } - if (insideTemp < parseFloat(hysteresisInside) || (resultDirectionRangePlus) < azimuth || (parseFloat(hysteresisOutside) > outsideTemp || shutterSettings[s].lightSensor != '' && parseFloat(hysteresisLight) > sunLight && shutterSettings[s].sunProtectEndtimerid === '0') || (parseFloat(hysteresisOutside) > outsideTemp && shutterSettings[s].lightSensor == '')) { if (pendingAlarm == false) { @@ -703,7 +699,7 @@ async function sunProtect(adapter, elevation, azimuth, shutterSettings) { adapter.log.debug('#5 Started sunprotect end delay for ' + shutterSettings[s].shutterName); shutterSettings[s].sunProtectEndtimerid = setTimeout(async function () { shutterSettings[s].sunProtectEndtimerid = '0'; - }, shutterSettings[s].sunProtectEndDely * 60000, i); + }, shutterSettings[s].sunProtectEndDely * 60000, s); } if ((resultDirectionRangePlus) < azimuth || (parseFloat(hysteresisOutside) > outsideTemp || shutterSettings[s].lightSensor != '' && parseFloat(hysteresisLight) > sunLight && shutterSettings[s].sunProtectEndtimerid === '0') || (parseFloat(hysteresisOutside) > outsideTemp && shutterSettings[s].lightSensor == '')) { @@ -753,9 +749,8 @@ async function sunProtect(adapter, elevation, azimuth, shutterSettings) { adapter.log.debug('#6 Started sunprotect end delay for ' + shutterSettings[s].shutterName); shutterSettings[s].sunProtectEndtimerid = setTimeout(async function () { shutterSettings[s].sunProtectEndtimerid = '0'; - }, shutterSettings[s].sunProtectEndDely * 60000, i); + }, shutterSettings[s].sunProtectEndDely * 60000, s); } - if ((resultDirectionRangePlus) < azimuth || (parseFloat(hysteresisOutside) > outsideTemp || shutterSettings[s].lightSensor != '' && parseFloat(hysteresisLight) > sunLight && shutterSettings[s].sunProtectEndtimerid === '0') || (parseFloat(hysteresisOutside) > outsideTemp && shutterSettings[s].lightSensor == '')) { if (pendingAlarm == false) { const _shutterState = await adapter.getForeignStateAsync(shutterSettings[s].name).catch((e) => adapter.log.warn(e)); @@ -1081,9 +1076,8 @@ async function sunProtect(adapter, elevation, azimuth, shutterSettings) { adapter.log.debug('#7 Started sunprotect end delay for ' + shutterSettings[s].shutterName); shutterSettings[s].sunProtectEndtimerid = setTimeout(async function () { shutterSettings[s].sunProtectEndtimerid = '0'; - }, shutterSettings[s].sunProtectEndDely * 60000, i); + }, shutterSettings[s].sunProtectEndDely * 60000, s); } - if ((shutterSettings[s].lightSensor != '' && parseFloat(hysteresisLight) > sunLight && shutterSettings[s].sunProtectEndtimerid === '0') || (parseFloat(hysteresisOutside) > outsideTemp)) { if (pendingAlarm == false) { const _shutterState = await adapter.getForeignStateAsync(shutterSettings[s].name).catch((e) => adapter.log.warn(e)); @@ -1132,9 +1126,8 @@ async function sunProtect(adapter, elevation, azimuth, shutterSettings) { adapter.log.debug('#8 Started sunprotect end delay for ' + shutterSettings[s].shutterName); shutterSettings[s].sunProtectEndtimerid = setTimeout(async function () { shutterSettings[s].sunProtectEndtimerid = '0'; - }, shutterSettings[s].sunProtectEndDely * 60000, i); + }, shutterSettings[s].sunProtectEndDely * 60000, s); } - if ((shutterSettings[s].lightSensor != '' && parseFloat(hysteresisLight) > sunLight && shutterSettings[s].sunProtectEndtimerid === '0') || (parseFloat(hysteresisOutside) > outsideTemp)) { if (pendingAlarm == false) { const _shutterState = await adapter.getForeignStateAsync(shutterSettings[s].name).catch((e) => adapter.log.warn(e));