mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-13 02:52:11 +01:00
This commit is contained in:
parent
a6c7601458
commit
a823d2349a
11 changed files with 273 additions and 18 deletions
|
|
@ -1 +1 @@
|
|||
2.1.7
|
||||
2.1.8
|
||||
|
|
@ -3,11 +3,11 @@
|
|||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="main.css?v=2.1.7" type="text/css" />
|
||||
<link rel="stylesheet" href="widgets.css?v=2.1.7" type="text/css" />
|
||||
<link rel="stylesheet" href="icons.css?v=2.1.7" type="text/css" />
|
||||
<link rel="stylesheet" href="main.css?v=2.1.8" type="text/css" />
|
||||
<link rel="stylesheet" href="widgets.css?v=2.1.8" type="text/css" />
|
||||
<link rel="stylesheet" href="icons.css?v=2.1.8" type="text/css" />
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
<script type="text/javascript" src="index.js?v=2.1.7"></script>
|
||||
<script type="text/javascript" src="index.js?v=2.1.8"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="divContainer" class="container main" data-auth="false">
|
||||
|
|
@ -611,6 +611,24 @@
|
|||
<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>
|
||||
</div>
|
||||
<div class="vr-button">
|
||||
<span>
|
||||
<span>Sensor</span>
|
||||
<span style="display:inline-block;vertical-align:middle;margin-left:14px;">
|
||||
<span style="display:block">
|
||||
<input id="cbSunny" type="checkbox" data-bind="sunny" style="display:inline-block;" />
|
||||
<label for="cbSunny" style="display:inline-block;cursor:pointer;">Sunny</label>
|
||||
</span>
|
||||
<span style="display:block">
|
||||
<input id="cbWindy" type="checkbox" data-bind="windy" style="display:inline-block;" />
|
||||
<label for="cbWindy" style="display:inline-block;cursor:pointer;">Windy</label>
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<div>
|
||||
<div class="button-outline" style="width:127px;text-align:center;border-radius:33%;font-size:2em;padding:10px;" data-cmd="Sensor" onmousedown="somfy.sendVRCommand(this);" ontouchstart="somfy.sendVRCommand(this);"><div class="button-sunflag" data-on="false" style="margin:0px;"></div><span>send</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="divRadioSettings" style="display:none;">
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ Number.prototype.fmt = function (format, empty) {
|
|||
if (rd.length === 0 && rw.length === 0) return '';
|
||||
return pfx + rw + rd + sfx;
|
||||
};
|
||||
var baseUrl = window.location.protocol === 'file:' ? 'http://ESPSomfyRTS.local' : '';
|
||||
var baseUrl = window.location.protocol === 'file:' ? 'http://ESPSomfyRTS' : '';
|
||||
//var baseUrl = '';
|
||||
function makeBool(val) {
|
||||
if (typeof val === 'boolean') return val;
|
||||
|
|
@ -519,6 +519,7 @@ async function initSockets() {
|
|||
}
|
||||
else {
|
||||
(async () => {
|
||||
ui.clearErrors();
|
||||
await general.loadGeneral();
|
||||
await wifi.loadNetwork();
|
||||
await somfy.loadSomfy();
|
||||
|
|
@ -1200,7 +1201,7 @@ var security = new Security();
|
|||
|
||||
class General {
|
||||
initialized = false;
|
||||
appVersion = 'v2.1.7';
|
||||
appVersion = 'v2.1.8';
|
||||
reloadApp = false;
|
||||
init() {
|
||||
if (this.initialized) return;
|
||||
|
|
@ -3415,6 +3416,8 @@ class Somfy {
|
|||
address: opt.getAttribute('data-address'),
|
||||
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);
|
||||
|
|
@ -3432,17 +3435,28 @@ class Somfy {
|
|||
}
|
||||
if (err) return;
|
||||
if (mouseDown) {
|
||||
if (o.type === 'group')
|
||||
if (o.cmd === 'Sensor')
|
||||
somfy.sendSetSensor(o);
|
||||
else if (o.type === 'group')
|
||||
somfy.sendGroupRepeat(o.groupId, o.cmd, null, fnRepeatCommand);
|
||||
else
|
||||
somfy.sendCommandRepeat(o.shadeId, o.cmd, null, fnRepeatCommand);
|
||||
}
|
||||
}
|
||||
if (o.type === 'group')
|
||||
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); });
|
||||
}
|
||||
sendSetSensor(obj, cb) {
|
||||
putJSON('/setSensor', obj, (err, device) => {
|
||||
if (typeof cb === 'function') cb(err, device);
|
||||
});
|
||||
}
|
||||
sendGroupCommand(groupId, command, repeat, cb) {
|
||||
console.log(`Sending Group command ${groupId}-${command}`);
|
||||
let obj = { groupId: groupId };
|
||||
|
|
@ -4026,7 +4040,6 @@ class Firmware {
|
|||
let prog = el.querySelector('div[id="progFileUpload"]');
|
||||
prog.style.display = '';
|
||||
btnSelectFile.style.visibility = 'hidden';
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
//xhr.open('POST', service, true);
|
||||
xhr.open('POST', baseUrl.length > 0 ? `${baseUrl}${service}` : service, true);
|
||||
|
|
@ -4057,6 +4070,11 @@ class Firmware {
|
|||
}
|
||||
};
|
||||
xhr.send(formData);
|
||||
btnCancel.addEventListener('click', (e) => {
|
||||
console.log('Cancel clicked');
|
||||
xhr.abort();
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
var firmware = new Firmware();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue