Added sensor inputs from wind/sun sensors.

This commit is contained in:
Robert Strouse 2023-06-01 19:31:11 -07:00
parent cd173525b1
commit f850cc0a1e
6 changed files with 97 additions and 47 deletions

View file

@ -863,3 +863,56 @@ div.button-sunflag {
font-size: 32px;
color: orange;
}
i.icss-warning {
width: 1em;
height: .1em;
border-radius: 0.05em;
margin: .82em 0 .06em 0;
transform-origin: 50% -.33em;
}
div.indicator {
position: absolute;
top:34px;
font-size:20px;
}
div.indicator-wind {
color: orangered;
clip-path: polygon(48% 18%, 0% 95%, 110% 92%);
background:yellow;
top:30%;
left:13px;
}
div.indicator-sun {
color: darkorange;
left: -13px;
top:3px;
}
.somfyShadeCtl[data-sunny="false"] .indicator-sun {
display:none;
}
.somfyShadeCtl[data-windy="false"] .indicator-wind {
display: none;
}
i.icss-warning:before {
width: 1.23em;
height: 1.23em;
border: 0.2em solid currentColor;
border-color: currentColor currentColor transparent transparent;
border-radius: .1em .13em;
transform: translateX(-50%) scaleX(0.6) rotate(-45deg);
top: -.55em;
left: 50%;
}
i.icss-warning:after {
width: .125em;
border: .0em solid transparent;
border-top: .25em solid currentColor;
border-bottom: .07em solid transparent;
box-shadow: 0 .1em 0 -.012em;
top: -.44em;
left: 50%;
transform: translateX(-50%);
}

View file

@ -1056,8 +1056,9 @@ class Somfy {
divCfg += '</div>';
divCtl += `<div class="somfyShadeCtl" data-shadeId="${shade.shadeId}" data-direction="${shade.direction}" data-remoteaddress="${shade.remoteAddress}" data-position="${shade.position}" data-target="${shade.target}" data-mypos="${shade.myPos}" data-mytiltpos="${shade.myTiltPos} data-shadetype="${shade.shadeType}" data-tilt="${shade.tiltType}"`;
divCtl += ` data-windy="${(shade.flags & 0x10) === 0x10 ? 'true' : false}" data-sunny=${(shade.flags & 0x20) === 0x20 ? 'true' : 'false'}`;
if (shade.tiltType !== 0) {
divCtl += ` data-tiltposition="${shade.tiltPosition}" data-tiltdirection="${shade.tiltDirection}" data-tilttarget="${shade.tiltTarget}"`
divCtl += ` data-tiltposition="${shade.tiltPosition}" data-tiltdirection="${shade.tiltDirection}" data-tilttarget="${shade.tiltTarget}"`;
}
divCtl += `><div class="shade-icon" data-shadeid="${shade.shadeId}" onclick="event.stopPropagation(); console.log(event); somfy.openSetPosition(${shade.shadeId});">`;
divCtl += `<i class="somfy-shade-icon`;
@ -1074,7 +1075,9 @@ class Somfy {
}
divCtl += `" data-shadeid="${shade.shadeId}" style="--shade-position:${shade.position}%;vertical-align: top;"></i>`;
divCtl += shade.tiltType !== 0 ? `<i class="icss-window-tilt" data-shadeid="${shade.shadeId}" data-tiltposition="${shade.tiltPosition}"></i></div>` : '</div>';
divCtl += `<div class="indicator indicator-wind"><i class="icss-warning"></i></div><div class="indicator indicator-sun"><i class="icss-sun"></i></div>`;
divCtl += `<div class="shade-name">`;
divCtl += `<span class="shadectl-name">${shade.name}</span>`;
divCtl += `<span class="shadectl-mypos"><label>My: </label><span id="spanMyPos">${shade.myPos > 0 ? shade.myPos + '%' : '---'}</span>`
if (shade.myTiltPos > 0) divCtl += `<label> Tilt: </label><span id="spanMyTiltPos">${shade.myTiltPos > 0 ? shade.myTiltPos + '%' : '---'}</span>`
@ -1321,6 +1324,8 @@ class Somfy {
divs[i].setAttribute('data-position', state.position);
divs[i].setAttribute('data-target', state.target);
divs[i].setAttribute('data-mypos', state.mypos);
divs[i].setAttribute('data-windy', (state.flags & 0x10) === 0x10 ? 'true' : 'false');
divs[i].setAttribute('data-sunny', (state.flags & 0x20) === 0x20 ? 'true' : 'false');
if (typeof state.myTiltPos !== 'undefined') divs[i].setAttribute('data-mytiltpos', state.myTiltPos);
else divs[i].setAttribute('data-mytiltpos', -1);
if (state.tiltType !== 0) {