Skip to content

Commit

Permalink
(simatec) Bugfix Brightness down
Browse files Browse the repository at this point in the history
  • Loading branch information
simatec committed Nov 7, 2024
1 parent bb4b111 commit 927214f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ When the adapter crashes or an other Code error happens, this error message that
### __WORK IN PROGRESS__
* (simatec) Issue Info added
* (simatec) Dependencies updated
* (simatec) Design Fix
* (simatec) Bugfix Brightness down

### 1.8.3 (2024-10-16)
* (simatec) Fix Alarm
Expand Down
13 changes: 12 additions & 1 deletion admin/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
#dialog-shutter-edit .page {
width: calc(100% - 10px) !important;
padding-left: 20;
height: calc(100% - 100px);
height: calc(100% - 115px);
}

/*
Expand Down Expand Up @@ -317,6 +317,17 @@
line-height: 32.4px !important;
}

/* Only for Firefox */
@supports (-moz-appearance: none) {
.adapter-body {
overflow: hidden;
}

.m .page {
height: calc(100vh - 180px);
}
}

/* Styling for small Screen (Responsive) */
@media screen and (max-width: 768px) {
.m .page {
Expand Down
16 changes: 15 additions & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,20 @@ function startAdapter(options) {
shutterBrightnessSensor(adapter, state.val, shutterSettings, brightnessDown);
adapter.log.debug(`Brightness sensor value: ${state.val}`);

if (state.val === 0 && brightnessDown === false) {
const shutterDownBrightnessTime = adapter.config.lightsensorDownTime;
const downTime = shutterDownBrightnessTime.split(':');

schedule.cancelJob('shutterDownBrightness');

const downBrightness = schedule.scheduleJob('shutterDownBrightness', downTime[1] + ' ' + downTime[0] + ' * * *', async function () {
shutterBrightnessSensor(adapter, state.val, shutterSettings, brightnessDown);
});
// @ts-ignore
} else if (state.val > 0) {
schedule.cancelJob('shutterDownBrightness');
}

await sleep(10000);
brightnessDown = brightnessState(adapter, state.val, brightnessDown);
adapter.log.debug(`Brightness State Down is: ${brightnessDown}`);
Expand Down Expand Up @@ -241,7 +255,7 @@ function startAdapter(options) {
const nameDevice = shutterSettings[s].shutterName.replace(/[.;, ]/g, '_');
const _shutterState = await adapter.getForeignStateAsync(shutterSettings[s].name).catch((e) => adapter.log.warn(e));

if (_shutterState?.val !== null && _shutterState?.val !== undefined &&
if (_shutterState?.val !== null && _shutterState?.val !== undefined &&
shutterSettings[s].oldHeight != Math.round(_shutterState.val / adapter.config.shutterStateRound) * adapter.config.shutterStateRound) {

adapter.log.debug(`Shutter state changed: ${shutterSettings[s].shutterName} old value = ${shutterSettings[s].oldHeight}% | new value = ${Math.round(_shutterState.val / adapter.config.shutterStateRound) * adapter.config.shutterStateRound}%`);
Expand Down

0 comments on commit 927214f

Please sign in to comment.