mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-13 02:52:11 +01:00
Added 80bit commands for Step, Stop, and Favorite #280
This commit is contained in:
parent
c4e1dbe44b
commit
e3e843387f
11 changed files with 280 additions and 188 deletions
|
|
@ -1494,4 +1494,49 @@ i.icss-bars {
|
|||
i.icss-bars:after {
|
||||
top: 0.36em;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
i.icss-hand {
|
||||
width: .6em;
|
||||
height: .5em;
|
||||
border-radius: .35em .3em .5em .5em;
|
||||
margin: .5em .1em 0 .21em;
|
||||
}
|
||||
|
||||
i.icss-hand:before {
|
||||
width: .1em;
|
||||
height: .55em;
|
||||
background: currentColor;
|
||||
left: .5em;
|
||||
bottom: .3em;
|
||||
border-radius: 80% / 20%;
|
||||
box-shadow: -.13em -.1em 0, -.265em -.15em 0, -.4em -.11em 0;
|
||||
}
|
||||
|
||||
i.icss-hand:after {
|
||||
width: .12em;
|
||||
height: .43em;
|
||||
background: currentColor;
|
||||
bottom: .25em;
|
||||
left: -.06em;
|
||||
border-radius: .04em;
|
||||
transform: rotate(-16deg);
|
||||
border-radius: .04em 70% .04em .04em / .04em 70% .04em .04em;
|
||||
}
|
||||
i.icss-bookmark {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
background-color: transparent;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
i.icss-bookmark:before {
|
||||
width: .5em;
|
||||
height: .8em;
|
||||
transform: translate(-50%, -50%);
|
||||
border: .25em solid currentColor;
|
||||
border-color: currentColor currentColor transparent currentColor;
|
||||
border-radius: .03em;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
}
|
||||
|
|
@ -8,9 +8,9 @@
|
|||
<meta name="apple-mobile-web-app-title" content="ESPSomfy RTS App">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="stylesheet" href="main.css?v=2.4.3b" type="text/css" />
|
||||
<link rel="stylesheet" href="widgets.css?v=2.4.3b" type="text/css" />
|
||||
<link rel="stylesheet" href="icons.css?v=2.4.3b" type="text/css" />
|
||||
<link rel="stylesheet" href="main.css?v=2.4.3c" type="text/css" />
|
||||
<link rel="stylesheet" href="widgets.css?v=2.4.3c" type="text/css" />
|
||||
<link rel="stylesheet" href="icons.css?v=2.4.3c" type="text/css" />
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
|
||||
<!-- iPad retina icon -->
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
rel="apple-touch-startup-image">
|
||||
|
||||
|
||||
<script type="text/javascript" src="index.js?v=2.4.2r"></script>
|
||||
<script type="text/javascript" src="index.js?v=2.4.3c"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="divContainer" class="container main" data-auth="false">
|
||||
|
|
@ -775,11 +775,11 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="divVirtualRemote" style="display:none;" class="subtab-content">
|
||||
<div id="divVirtualRemote" style="display:none;" class="subtab-content" data-bitlength="56">
|
||||
<div class="field-group" style="margin-top:-18px;display:inline-block;width:100%;">
|
||||
<select id="selVRMotor" style="width:100%;">
|
||||
<select id="selVRMotor" style="width:100%;" onchange="document.getElementById('divVirtualRemote').setAttribute('data-bitlength', this.options[this.selectedIndex].getAttribute('data-bitlength'));">
|
||||
</select>
|
||||
<label for="selVRMotor">Select a Motor</label>
|
||||
<label for="selVRMotor">Select a Motor or Group</label>
|
||||
</div>
|
||||
<div class="vr-button vr-updownmy">
|
||||
<span>Remote Buttons</span>
|
||||
|
|
@ -789,12 +789,38 @@
|
|||
<div class="button-outline" data-cmd="down" onmousedown="somfy.sendVRCommand(this);" ontouchstart="somfy.sendVRCommand(this);"><i class="icss-somfy-down" style="margin-top:-4px;"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vr-button vr-stop vr-80bit">
|
||||
<span>Stop</span>
|
||||
<div>
|
||||
<div class="button-outline toggle-button" style="width:127px;text-align:center;border-radius:33%;font-size:2em;padding:10px;" data-cmd="stop" onmousedown="somfy.sendVRCommand(this);" ontouchstart="somfy.sendVRCommand(this);"><i class="icss-hand" style=""></i></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vr-button vr-updownmy">
|
||||
<span>Toggle Button</span>
|
||||
<div>
|
||||
<div class="button-outline toggle-button" style="width:127px;text-align:center;border-radius:33%;font-size:2em;padding:10px;" data-cmd="toggle" onmousedown="somfy.sendVRCommand(this);" ontouchstart="somfy.sendVRCommand(this);"><i class="icss-somfy-toggle" style="margin-top:-4px;"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vr-button vr-updown vr-80bit">
|
||||
<span>Step</span>
|
||||
<div style="margin-right:7px;width:470px;font-size:.8em;">
|
||||
<input id="vrslidStepSize" name="stepSize" type="range" min="1" max="127" step="1" style="width:100%;" data-bind="stepSize" value="1" oninput="document.getElementById('vrspanStepSize').innerText = this.value;" />
|
||||
<div>
|
||||
<label style="color:#00bcd4;">Step Size:</label><span id="vrspanStepSize">1</span>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="button-outline" style="width:59px;text-align:center;border-radius:33%;font-size:2em;padding:10px;" data-cmd="StepUp" onmousedown="somfy.sendVRCommand(this);" ontouchstart="somfy.sendVRCommand(this);"><span></span><i class="icss-somfy-up" style="margin-top:4px;"></i></div>
|
||||
<div class="button-outline" style="width:59px;text-align:center;border-radius:33%;font-size:2em;padding:10px;" data-cmd="StepDown" onmousedown="somfy.sendVRCommand(this);" ontouchstart="somfy.sendVRCommand(this);"><span></span><i class="icss-somfy-down" style="margin-top:-4px;"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vr-button vr-favorite vr-80bit">
|
||||
<span>Favorite</span>
|
||||
<div>
|
||||
<div class="button-outline toggle-button" style="width:127px;text-align:center;border-radius:33%;font-size:2em;padding:10px;" data-cmd="favorite" onmousedown="somfy.sendVRCommand(this);" ontouchstart="somfy.sendVRCommand(this);"><i class="icss-bookmark" style=""></i></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="vr-button vr-updown">
|
||||
<span>Up + Down</span>
|
||||
<div>
|
||||
|
|
@ -819,18 +845,6 @@
|
|||
<div class="button-outline" style="width:127px;text-align:center;border-radius:33%;font-size:2em;padding:10px;" data-cmd="MyDown" onmousedown="somfy.sendVRCommand(this);" ontouchstart="somfy.sendVRCommand(this);"><span>my</span><span> + </span><i class="icss-somfy-down"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vr-button vr-updown">
|
||||
<span>Step Up</span>
|
||||
<div>
|
||||
<div class="button-outline" style="width:127px;text-align:center;border-radius:33%;font-size:2em;padding:10px;" data-cmd="StepUp" onmousedown="somfy.sendVRCommand(this);" ontouchstart="somfy.sendVRCommand(this);"><span>step </span><i class="icss-somfy-up"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vr-button vr-updown">
|
||||
<span>Step Down</span>
|
||||
<div>
|
||||
<div class="button-outline" style="width:127px;text-align:center;border-radius:33%;font-size:2em;padding:10px;" data-cmd="StepDown" onmousedown="somfy.sendVRCommand(this);" ontouchstart="somfy.sendVRCommand(this);"><span>step </span><i class="icss-somfy-down"></i></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vr-button vr-updown">
|
||||
<span>Prog</span>
|
||||
<div>
|
||||
|
|
@ -838,15 +852,10 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="vr-button vr-updown">
|
||||
<span>Sun Flag On</span>
|
||||
<span>Sun Flag</span>
|
||||
<div>
|
||||
<div class="button-outline" style="width:127px;text-align:center;border-radius:33%;font-size:2em;padding:10px;" data-cmd="SunFlag" onmousedown="somfy.sendVRCommand(this);" ontouchstart="somfy.sendVRCommand(this);"><div class="button-sunflag" data-on="true" style="margin:0px;"><i class="icss-sun-c" style="background:white;"></i><i class="icss-sun-o" style="left:0px;color:white;"></i></div><span>on</span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vr-button vr-updown">
|
||||
<span>Sun Flag Off</span>
|
||||
<div>
|
||||
<div class="button-outline" style="width:127px;text-align:center;border-radius:33%;font-size:2em;padding:10px;" data-cmd="Flag" onmousedown="somfy.sendVRCommand(this);" ontouchstart="somfy.sendVRCommand(this);"><div class="button-sunflag" data-on="false" style="margin:0px;"><i class="icss-sun-c" style="background:transparent;"></i><i class="icss-sun-o" style="left:0px;color:white;"></i></div><span>off</span></div>
|
||||
<div class="button-outline" style="width: 59px; text-align: center; border-radius: 33%; font-size: 2em; padding: 10px; height: 52px;" data-cmd="SunFlag" onmousedown="somfy.sendVRCommand(this);" ontouchstart="somfy.sendVRCommand(this);"><div class="button-sunflag" data-on="true" style="margin:0px;margin-left:4px;"><i class="icss-sun-c" style="background:white;"></i><i class="icss-sun-o" style="left:0px;color:white;"></i></div></div>
|
||||
<div class="button-outline" style="width: 59px; text-align: center; border-radius: 33%; font-size: 2em; padding: 10px; height: 52px;" data-cmd="Flag" onmousedown="somfy.sendVRCommand(this);" ontouchstart="somfy.sendVRCommand(this);"><div class="button-sunflag" data-on="false" style="margin:0px;margin-left:4px;"><i class="icss-sun-c" style="background:transparent;"></i><i class="icss-sun-o" style="left:0px;color:white;"></i></div></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="vr-button">
|
||||
|
|
|
|||
|
|
@ -2301,8 +2301,11 @@ class Somfy {
|
|||
opt.setAttribute('data-type', 'shade');
|
||||
opt.setAttribute('data-shadetype', shade.shadeType);
|
||||
opt.setAttribute('data-shadeid', shade.shadeId);
|
||||
opt.setAttribute('data-bitlength', shade.bitLength);
|
||||
optGroup.appendChild(opt);
|
||||
}
|
||||
let sopt = vrList.options[vrList.selectedIndex];
|
||||
document.getElementById('divVirtualRemote').setAttribute('data-bitlength', sopt ? sopt.getAttribute('data-bitlength') : 'none');
|
||||
document.getElementById('divShadeList').innerHTML = divCfg;
|
||||
let shadeControls = document.getElementById('divShadeControls');
|
||||
shadeControls.innerHTML = divCtl;
|
||||
|
|
@ -2611,9 +2614,13 @@ class Somfy {
|
|||
opt.setAttribute('data-address', group.remoteAddress);
|
||||
opt.setAttribute('data-type', 'group');
|
||||
opt.setAttribute('data-groupid', group.groupId);
|
||||
opt.setAttribute('data-bitlength', group.bitLength);
|
||||
optGroup.appendChild(opt);
|
||||
}
|
||||
}
|
||||
let sopt = vrList.options[vrList.selectedIndex];
|
||||
document.getElementById('divVirtualRemote').setAttribute('data-bitlength', sopt ? sopt.getAttribute('data-bitlength') : 'none');
|
||||
|
||||
document.getElementById('divGroupList').innerHTML = divCfg;
|
||||
let groupControls = document.getElementById('divGroupControls');
|
||||
groupControls.innerHTML = divCtl;
|
||||
|
|
@ -2891,7 +2898,7 @@ class Somfy {
|
|||
proto = '-V';
|
||||
break;
|
||||
}
|
||||
let html = `<span>${frame.encKey}</span><span>${frame.address}</span><span>${frame.command}</span><span>${frame.rcode}</span><span>${frame.rssi}dBm</span><span>${frame.bits}${proto}</span><span>${fnFmtTime(frame.time)}</span><div class="frame-pulses">`;
|
||||
let html = `<span>${frame.encKey}</span><span>${frame.address}</span><span>${frame.command}<sup>${frame.stepSize ? frame.stepSize : ''}</sup></span><span>${frame.rcode}</span><span>${frame.rssi}dBm</span><span>${frame.bits}${proto}</span><span>${fnFmtTime(frame.time)}</span><div class="frame-pulses">`;
|
||||
for (let i = 0; i < frame.pulses.length; i++) {
|
||||
if (i !== 0) html += ',';
|
||||
html += `${frame.pulses[i]}`;
|
||||
|
|
@ -3687,22 +3694,47 @@ class Somfy {
|
|||
return div;
|
||||
}
|
||||
sendCommand(shadeId, command, repeat, cb) {
|
||||
console.log(`Sending Shade command ${shadeId}-${command}`);
|
||||
let obj = { shadeId: shadeId };
|
||||
if (isNaN(parseInt(command, 10))) obj.command = command;
|
||||
else obj.target = parseInt(command, 10);
|
||||
if (typeof repeat === 'number') obj.repeat = parseInt(repeat);
|
||||
let obj = {};
|
||||
if (typeof shadeId.shadeId !== 'undefined') {
|
||||
obj = shadeId;
|
||||
cb = command;
|
||||
shadeId = obj.shadeId;
|
||||
repeat = obj.repeat;
|
||||
command = obj.command;
|
||||
}
|
||||
else {
|
||||
obj = { shadeId: shadeId };
|
||||
if (isNaN(parseInt(command, 10))) obj.command = command;
|
||||
else obj.target = parseInt(command, 10);
|
||||
if (typeof repeat === 'number') obj.repeat = parseInt(repeat);
|
||||
}
|
||||
putJSON('/shadeCommand', obj, (err, shade) => {
|
||||
if (typeof cb === 'function') cb(err, shade);
|
||||
});
|
||||
}
|
||||
sendCommandRepeat(shadeId, command, repeat, cb) {
|
||||
//console.log(`Sending Shade command ${shadeId}-${command}`);
|
||||
let obj = { shadeId: shadeId, command: command };
|
||||
if (typeof repeat === 'number') obj.repeat = parseInt(repeat);
|
||||
let obj = {};
|
||||
if (typeof shadeId.shadeId !== 'undefined') {
|
||||
obj = shadeId;
|
||||
cb = command;
|
||||
shadeId = obj.shadeId;
|
||||
repeat = obj.repeat;
|
||||
command = obj.command;
|
||||
}
|
||||
else {
|
||||
obj = { shadeId: shadeId, command: command };
|
||||
if (typeof repeat === 'number') obj.repeat = parseInt(repeat);
|
||||
}
|
||||
putJSON('/repeatCommand', obj, (err, shade) => {
|
||||
if (typeof cb === 'function') cb(err, shade);
|
||||
});
|
||||
|
||||
/*
|
||||
putJSON(`/repeatCommand?shadeId=${shadeId}&command=${command}`, null, (err, shade) => {
|
||||
if(typeof cb === 'function') cb(err, shade);
|
||||
});
|
||||
*/
|
||||
}
|
||||
sendGroupRepeat(groupId, command, repeat, cb) {
|
||||
let obj = { groupId: groupId, command: command };
|
||||
|
|
@ -3721,7 +3753,6 @@ class Somfy {
|
|||
cmd: el.getAttribute('data-cmd')
|
||||
};
|
||||
ui.fromElement(el.parentElement.parentElement, o);
|
||||
console.log(o);
|
||||
switch (o.type) {
|
||||
case 'shade':
|
||||
o.shadeId = parseInt(opt.getAttribute('data-shadeId'), 10);
|
||||
|
|
@ -3744,17 +3775,17 @@ class Somfy {
|
|||
else if (o.type === 'group')
|
||||
somfy.sendGroupRepeat(o.groupId, o.cmd, null, fnRepeatCommand);
|
||||
else
|
||||
somfy.sendCommandRepeat(o.shadeId, o.cmd, null, fnRepeatCommand);
|
||||
somfy.sendCommandRepeat(o, fnRepeatCommand);
|
||||
}
|
||||
}
|
||||
o.command = o.cmd;
|
||||
if (o.cmd === 'Sensor') {
|
||||
somfy.sendSetSensor(o);
|
||||
|
||||
}
|
||||
else if (o.type === 'group')
|
||||
somfy.sendGroupCommand(o.groupId, o.cmd, null, (err, group) => { fnRepeatCommand(err, group); });
|
||||
else
|
||||
somfy.sendCommand(o.shadeId, o.cmd, null, (err, shade) => { fnRepeatCommand(err, shade); });
|
||||
somfy.sendCommand(o, (err, shade) => { fnRepeatCommand(err, shade); });
|
||||
}
|
||||
sendSetSensor(obj, cb) {
|
||||
putJSON('/setSensor', obj, (err, device) => {
|
||||
|
|
|
|||
|
|
@ -702,6 +702,12 @@ div.wait-overlay > .lds-roller {
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
#divVirtualRemote[data-bitlength="56"] div.vr-button.vr-80bit {
|
||||
display:none;
|
||||
}
|
||||
#divVirtualRemote[data-bitlength="none"] div.vr-button {
|
||||
display:none;
|
||||
}
|
||||
.shade-positioner {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
|
|
@ -804,6 +810,7 @@ div.frame-header > span {
|
|||
}
|
||||
div.frame-row > span:nth-child(3),
|
||||
div.frame-header > span:nth-child(3) {
|
||||
white-space:nowrap;
|
||||
width: 80px;
|
||||
text-align:center;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue