Skip to content

Commit

Permalink
(simatec) Release v1.7.2
Browse files Browse the repository at this point in the history
  • Loading branch information
simatec committed Jun 20, 2024
1 parent a344817 commit a49e2fb
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 27 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ When the adapter crashes or an other Code error happens, this error message that

## Changelog
<!-- ### __WORK IN PROGRESS__ -->
### __WORK IN PROGRESS__
* (simatec) Fix Shutterstate enabled

### 1.7.1 (2024-06-19)
* (simatec) Dependencies updated
* (simatec) Docu updated
Expand Down
2 changes: 1 addition & 1 deletion lib/buttonAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async function buttonAction(adapter, buttonState, shutterSettings) {
break;
}

const result = resLiving.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resLiving.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result) {
for (const s in shutterSettings) {
Expand Down
2 changes: 1 addition & 1 deletion lib/elevationDown.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function elevationDown(adapter, elevation, azimuth, shutterSettings) {
if (shutterSettings) {
const driveDelayUpAstro = adapter.config.driveDelayUpAstro != 0 ? adapter.config.driveDelayUpAstro * 1000 : 20;
const resLiving = shutterSettings.filter((/** @type {{ typeDown: string; }} */ d) => d.typeDown == 'elevation');
const result = resLiving.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true);
const result = resLiving.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true');

for (const i in result) {
for (const s in shutterSettings) {
Expand Down
2 changes: 1 addition & 1 deletion lib/shutterAlarm.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async function shutterAlarm(adapter, alarmType, shutterSettings) {

}

const result = resAlarm.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resAlarm.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result) {
for (const s in shutterSettings) {
Expand Down
4 changes: 2 additions & 2 deletions lib/shutterBrightnessSensor.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async function shutterBrightnessSensor(adapter, brightnessValue, shutterSettings
if (currentTime > shutterDownBrightnessTime && brightnessValue <= shutterDownBrightness && brightnessDown == false) {
if (shutterSettings) {
const resLiving = shutterSettings.filter((/** @type {{ typeDown: string; }} */ d) => d.typeDown == 'lightsensor'); // Filter Area Living
const result = resLiving.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resLiving.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result) {
for (const s in shutterSettings) {
Expand Down Expand Up @@ -180,7 +180,7 @@ async function shutterBrightnessSensor(adapter, brightnessValue, shutterSettings
} else if (currentTime > shutterUpBrightnessTime && currentTime < shutterDownBrightnessTime && brightnessValue > shutterUpBrightness) {
if (shutterSettings) {
const resLiving = shutterSettings.filter((/** @type {{ typeUp: string; }} */ d) => d.typeUp == 'lightsensor'); // Filter Area Living
const result = resLiving.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resLiving.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result) {
for (const s in shutterSettings) {
Expand Down
2 changes: 1 addition & 1 deletion lib/shutterDownChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function getDate(d) {
async function driveshutterDownChildren(adapter, downTimeChildren, autoChildrenStr, shutterSettings, childrenType, driveDelayUpChildren, timeoutChildrenAuto) {
if (shutterSettings) {
const resChildren = shutterSettings.filter((/** @type {{ typeDown: string; }} */ d) => d.typeDown == childrenType); // Filter Area children or children-auto
const result = resChildren.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resChildren.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled
let number = 0;

if (childrenType == 'children') {
Expand Down
2 changes: 1 addition & 1 deletion lib/shutterDownComplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function shutterDownComplete(adapter, delayDown, shutterSettings) {

if (shutterSettings) {
const resLiving = shutterSettings.filter((/** @type {{ betweenPosition: boolean; }} */ d) => d.betweenPosition == true); // Filter Area Living
const result = resLiving.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resLiving.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result) {
for (const s in shutterSettings) {
Expand Down
2 changes: 1 addition & 1 deletion lib/shutterDownLate.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async function shutterDownLate(adapter, shutterSettings) {

const downLate = schedule.scheduleJob('shutterDownLate', downTimeLate[1] + ' ' + downTimeLate[0] + ' * * *', async function () {
if (shutterSettings) {
const resEnabled = shutterSettings.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const resEnabled = shutterSettings.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled
const resLateDown = resEnabled.filter((/** @type {{ LateDown: boolean; }} */ d) => d.LateDown === true); // Filter late down

for (const i in resLateDown) {
Expand Down
2 changes: 1 addition & 1 deletion lib/shutterDownLiving.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function getDate(d) {
async function driveshutterDownLiving(adapter, downTimeLiving, autoLivingStr, shutterSettings, livingType, driveDelayUpLiving, timeoutLivingAuto) {
if (shutterSettings) {
const resLiving = shutterSettings.filter((/** @type {{ typeDown: string; }} */ d) => d.typeDown == livingType); // Filter Area Living or living-auto
const result = resLiving.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resLiving.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

let number = 0;

Expand Down
2 changes: 1 addition & 1 deletion lib/shutterDownSleep.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function getDate(d) {
async function driveshutterDownSleep(adapter, downTimeSleep, autoSleepStr, shutterSettings, sleepType, driveDelayUpSleep, timeoutSleepAuto) {
if (shutterSettings) {
const resSleep = shutterSettings.filter((/** @type {{ typeDown: any; }} */ d) => d.typeDown == sleepType); // Filter Area sleep
const result = resSleep.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resSleep.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

let number = 0;

Expand Down
4 changes: 2 additions & 2 deletions lib/shutterGoldenHour.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function shutterGoldenHour(adapter, goldenHourEnd, goldenHour, shutterSett
const upGoldenHour = schedule.scheduleJob('shutterUpGoldenHourEnd', upTime[1] + ' ' + upTime[0] + ' * * *', async function () {
if (shutterSettings) {
const resLiving = shutterSettings.filter((/** @type {{ typeUp: string; }} */ d) => d.typeUp == 'goldenhour End'); // Filter Area goldenhour end
const result = resLiving.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resLiving.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result) {
for (const s in shutterSettings) {
Expand Down Expand Up @@ -148,7 +148,7 @@ async function shutterGoldenHour(adapter, goldenHourEnd, goldenHour, shutterSett
const downGoldenHour = schedule.scheduleJob('shutterDownGoldenHour', upTime[1] + ' ' + upTime[0] + ' * * *', async function () {
if (shutterSettings) {
const resLiving = shutterSettings.filter((/** @type {{ typeDown: string; }} */ d) => d.typeDown == 'goldenhour'); // Filter Area Goldenhour
const result = resLiving.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resLiving.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result) {
for (const s in shutterSettings) {
Expand Down
4 changes: 2 additions & 2 deletions lib/shutterSunriseSunset.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async function shutterSunriseSunset(adapter, sunriseStr, sunsetStr, shutterSetti
const upSunrise = schedule.scheduleJob('shutterUpSunrise', upTime[1] + ' ' + upTime[0] + ' * * *', async function () {
if (shutterSettings) {
const resLiving = shutterSettings.filter((/** @type {{ typeUp: string; }} */ d) => d.typeUp == 'sunrise'); // Filter Area Sunrise
const result = resLiving.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resLiving.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result) {
for (const s in shutterSettings) {
Expand Down Expand Up @@ -151,7 +151,7 @@ async function shutterSunriseSunset(adapter, sunriseStr, sunsetStr, shutterSetti
const downSunset = schedule.scheduleJob('shutterDownSunset', upTime[1] + ' ' + upTime[0] + ' * * *', async function () {
if (shutterSettings) {
const resLiving = shutterSettings.filter((/** @type {{ typeDown: string; }} */ d) => d.typeDown == 'sunset'); // Filter Area Sunset
const result = resLiving.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resLiving.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result) {
for (const s in shutterSettings) {
Expand Down
2 changes: 1 addition & 1 deletion lib/shutterUpChildren.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function driveshutterUpChildren(adapter, upTimeChildren, autoChildrenStr,
adapter.log.debug(`Children-type: ${childrenType}`);

const resChildren = shutterSettings.filter((/** @type {{ typeUp: string; }} */ d) => d.typeUp == childrenType); // Filter Area Children
const result = resChildren.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resChildren.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

let number = 0;

Expand Down
2 changes: 1 addition & 1 deletion lib/shutterUpLiving.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function driveshutterUpLiving(adapter, upTimeLiving, autoLivingStr, shutte
adapter.log.debug(`Living-type: ${livingType}`);

const resLiving = shutterSettings.filter((/** @type {{ typeUp: string; }} */ d) => d.typeUp == livingType); // Filter Area Living
const result = resLiving.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resLiving.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

let number = 0;

Expand Down
2 changes: 1 addition & 1 deletion lib/shutterUpSleep.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function driveshutterUpSleep(adapter, upTimeSleep, autoSleepStr, shutterSe
adapter.log.debug(`Sleep-type: ${sleepType}`);

const resSleep = shutterSettings.filter((/** @type {{ typeUp: any; }} */ d) => d.typeUp == sleepType); // Filter Area sleep
const result = resSleep.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resSleep.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled
;
let number = 0;

Expand Down
4 changes: 2 additions & 2 deletions lib/sunProtect.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function sunProtect(adapter, elevation, azimuth, shutterSettings) {

await sleep(2000);
if (shutterSettings) {
const result = shutterSettings.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = shutterSettings.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

if (elevation > adapter.config.sunProtEndElevation) {
for (const i in result) {
Expand Down Expand Up @@ -1350,7 +1350,7 @@ async function sunProtect(adapter, elevation, azimuth, shutterSettings) {
// +++++++++++++++++ End of sunprotect with Elevationslimit +++++++++++++++

if (shutterSettings) {
const result = shutterSettings.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true);
const result = shutterSettings.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true');

const sunProtEndStart = parseInt(adapter.config.sunProtEndElevation);
const sunProtEndStop = (adapter.config.sunProtEndElevation - 1);
Expand Down
16 changes: 8 additions & 8 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1193,14 +1193,14 @@ function delayCalc() {
if (resultFull) {
if (upTimeLiving === upTimeSleep) {
const resLiving = resultFull.filter((/** @type {{ typeUp: string; }} */ d) => d.typeUp === 'living'); // Filter Area Living
const result = resLiving.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resLiving.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result) {
delayUp++;
}
if (autoLivingStr === true) {
const resLivingAuto = resultFull.filter((/** @type {{ typeUp: string; }} */ d) => d.typeUp === 'living-auto'); // Filter Area Living
const result2 = resLivingAuto.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result2 = resLivingAuto.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result2) {
delayUp++;
Expand All @@ -1212,14 +1212,14 @@ function delayCalc() {
delayUpChildren = delayUp;

const resLiving = resultFull.filter((/** @type {{ typeUp: string; }} */ d) => d.typeUp === 'sleep'); // Filter Area Sleep
const result = resLiving.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result = resLiving.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result) {
delayUpChildren++;
}
if (autoSleepStr === true) {
const resLivingAuto = resultFull.filter((/** @type {{ typeUp: string; }} */ d) => d.typeUp === 'sleep-auto'); // Filter Area Sleep
const result2 = resLivingAuto.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result2 = resLivingAuto.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result2) {
delayUpChildren++;
Expand All @@ -1228,14 +1228,14 @@ function delayCalc() {
}
if (downTimeLiving === downTimeSleep) {
const resLiving2 = resultFull.filter((/** @type {{ typeDown: string; }} */ d) => d.typeDown === 'living'); // Filter Area Living
const result3 = resLiving2.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result3 = resLiving2.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result3) {
delayDown++;
}
if (autoLivingStr === true) {
const resLivingAuto2 = resultFull.filter((/** @type {{ typeDown: string; }} */ d) => d.typeDown === 'living-auto'); // Filter Area Living
const result4 = resLivingAuto2.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result4 = resLivingAuto2.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result4) {
delayDown++;
Expand All @@ -1247,15 +1247,15 @@ function delayCalc() {
delayDownChildren = delayDown;

const resLiving2 = resultFull.filter((/** @type {{ typeDown: string; }} */ d) => d.typeDown === 'sleep'); // Filter Area Sleep
const result3 = resLiving2.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result3 = resLiving2.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result3) {
delayDownChildren++;
}

if (autoSleepStr === true) {
const resLivingAuto2 = resultFull.filter((/** @type {{ typeDown: string; }} */ d) => d.typeDown === 'sleep-auto'); // Filter Area Sleep
const result4 = resLivingAuto2.filter((/** @type {{ enabled: boolean; }} */ d) => d.enabled === true); // Filter enabled
const result4 = resLivingAuto2.filter((/** @type {{ enabled: boolean | string; }} */ d) => d.enabled === true || d.enabled === 'true'); // Filter enabled

for (const i in result4) {
delayDownChildren++;
Expand Down

0 comments on commit a49e2fb

Please sign in to comment.