Skip to content

Commit 8c83809

Browse files
committed
Merge branch 'master' of github.com:domoticz/domoticz
2 parents 6720c19 + 3212753 commit 8c83809

File tree

1 file changed

+25
-100
lines changed

1 file changed

+25
-100
lines changed

www/app/HardwareController.js

Lines changed: 25 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ define(['app'], function (app) {
296296
}
297297
else if (
298298
(text.indexOf("LAN") >= 0 && ((text.indexOf("YouLess") >= 0)||(text.indexOf("Denkovi") >= 0)) ) ||
299-
(text.indexOf("Satel Integra") >= 0) || (text.indexOf("Harmony") >= 0) || (text.indexOf("Xiaomi Gateway") >= 0)
299+
(text.indexOf("Satel Integra") >= 0) || (text.indexOf("Harmony") >= 0) || (text.indexOf("Xiaomi Gateway") >= 0) || (text.indexOf("MyHome OpenWebNet with LAN interface") >= 0)
300300
)
301301
{
302302
var address=$("#hardwarecontent #divremote #tcpaddress").val();
@@ -327,7 +327,15 @@ define(['app'], function (app) {
327327
}
328328
Mode1 = pollinterval;
329329
}
330-
var password=encodeURIComponent($("#hardwarecontent #divlogin #password").val());
330+
var password = encodeURIComponent($("#hardwarecontent #divlogin #password").val());
331+
if (text.indexOf("MyHome OpenWebNet with LAN interface") >= 0) {
332+
if (password != "") {
333+
if ((isNaN(password)) || (password.length < 5)) /* must be a number */ {
334+
ShowNotify($.t('Please enter a numeric password of at least 5 characters'), 2500, true);
335+
return;
336+
}
337+
}
338+
}
331339
$.ajax({
332340
url: "json.htm?type=command&param=updatehardware&htype=" + hardwaretype +
333341
"&address=" + address +
@@ -776,56 +784,6 @@ define(['app'], function (app) {
776784
ShowNotify($.t('Problem updating hardware!'), 2500, true);
777785
}
778786
});
779-
}
780-
else if (text.indexOf("MyHome OpenWebNet with LAN interface") >= 0)
781-
{
782-
var address=$("#hardwarecontent #divremote #tcpaddress").val();
783-
if (address=="")
784-
{
785-
ShowNotify($.t('Please enter an Address!'), 2500, true);
786-
return;
787-
}
788-
var port=$("#hardwarecontent #divremote #tcpport").val();
789-
if (port=="")
790-
{
791-
ShowNotify($.t('Please enter an Port!'), 2500, true);
792-
return;
793-
}
794-
var intRegex = /^\d+$/;
795-
if(!intRegex.test(port)) {
796-
ShowNotify($.t('Please enter an Valid Port!'), 2500, true);
797-
return;
798-
}
799-
800-
var password=encodeURIComponent($("#hardwarecontent #divlogin #password").val());
801-
if (password != "")
802-
{
803-
if ((isNaN(password)) || (password.length < 5)) /* must be a number */
804-
{
805-
ShowNotify($.t('Please enter a numeric password of at least 5 characters'), 2500, true);
806-
return;
807-
}
808-
}
809-
810-
$.ajax({
811-
url: "json.htm?type=command&param=updatehardware&htype=" + hardwaretype +
812-
"&address=" + address +
813-
"&port=" + port +
814-
"&password=" + encodeURIComponent(password) +
815-
"&name=" + encodeURIComponent(name) +
816-
"&enabled=" + bEnabled +
817-
"&idx=" + idx +
818-
"&datatimeout=" + datatimeout +
819-
"&Mode1=" + Mode1 + "&Mode2=" + Mode2 + "&Mode3=" + Mode3 + "&Mode4=" + Mode4 + "&Mode5=" + Mode5 + "&Mode6=" + Mode6,
820-
async: false,
821-
dataType: 'json',
822-
success: function(data) {
823-
RefreshHardwareTable();
824-
},
825-
error: function(){
826-
ShowNotify($.t('Problem updating hardware!'), 2500, true);
827-
}
828-
});
829787
}
830788
else if (text.indexOf("Goodwe solar inverter via Web") >= 0)
831789
{
@@ -971,7 +929,8 @@ define(['app'], function (app) {
971929
text.indexOf("KMTronic") == -1
972930
&& text.indexOf("MQTT") == -1 &&
973931
text.indexOf("Satel Integra") == -1 &&
974-
text.indexOf("Razberry") == -1
932+
text.indexOf("Razberry") == -1 &&
933+
text.indexOf("MyHome OpenWebNet with LAN interface") == -1
975934
)
976935
)
977936
{
@@ -1153,7 +1112,8 @@ define(['app'], function (app) {
11531112
}
11541113
else if (
11551114
(text.indexOf("LAN") >= 0 && ((text.indexOf("YouLess") >= 0) || (text.indexOf("Denkovi") >= 0) )) ||
1156-
(text.indexOf("Satel Integra") >= 0) || (text.indexOf("Harmony") >= 0) || (text.indexOf("Xiaomi Gateway") >= 0)
1115+
(text.indexOf("Satel Integra") >= 0) || (text.indexOf("Harmony") >= 0) || (text.indexOf("Xiaomi Gateway") >= 0) ||
1116+
(text.indexOf("MyHome OpenWebNet with LAN interface") >= 0)
11571117
)
11581118
{
11591119
var address=$("#hardwarecontent #divremote #tcpaddress").val();
@@ -1183,7 +1143,15 @@ define(['app'], function (app) {
11831143
}
11841144
Mode1 = pollinterval;
11851145
}
1186-
var password=encodeURIComponent($("#hardwarecontent #divlogin #password").val());
1146+
var password = encodeURIComponent($("#hardwarecontent #divlogin #password").val());
1147+
if (text.indexOf("MyHome OpenWebNet with LAN interface") >= 0) {
1148+
if (password != "") {
1149+
if ((isNaN(password)) || (password.length < 5)) /* must be a number */ {
1150+
ShowNotify($.t('Please enter a numeric password of at least 5 characters'), 2500, true);
1151+
return;
1152+
}
1153+
}
1154+
}
11871155
$.ajax({
11881156
url: "json.htm?type=command&param=addhardware&htype=" + hardwaretype + "&address=" + address + "&port=" + port + "&name=" + encodeURIComponent(name) + "&password=" + encodeURIComponent(password) + "&enabled=" + bEnabled + "&datatimeout=" + datatimeout + "&Mode1=" + Mode1,
11891157
async: false,
@@ -1500,49 +1468,6 @@ define(['app'], function (app) {
15001468
}
15011469
});
15021470
}
1503-
else if (text.indexOf("MyHome OpenWebNet with LAN interface") >= 0)
1504-
{
1505-
var address=$("#hardwarecontent #divremote #tcpaddress").val();
1506-
if (address=="")
1507-
{
1508-
ShowNotify($.t('Please enter an Address!'), 2500, true);
1509-
return;
1510-
}
1511-
var port=$("#hardwarecontent #divremote #tcpport").val();
1512-
if (port=="")
1513-
{
1514-
ShowNotify($.t('Please enter an Port!'), 2500, true);
1515-
return;
1516-
}
1517-
var intRegex = /^\d+$/;
1518-
if(!intRegex.test(port)) {
1519-
ShowNotify($.t('Please enter an Valid Port!'), 2500, true);
1520-
return;
1521-
}
1522-
var password=encodeURIComponent($("#hardwarecontent #divlogin #password").val());
1523-
if (password != "")
1524-
{
1525-
if ((isNaN(password)) || (password.length < 5)) /* must be a number */
1526-
{
1527-
ShowNotify($.t('Please enter a numeric password of at least 5 characters'), 2500, true);
1528-
return;
1529-
}
1530-
}
1531-
1532-
$.ajax({
1533-
url: "json.htm?type=command&param=addhardware&htype=" + hardwaretype + "&address=" + address + "&port=" + port +
1534-
"&password=" + encodeURIComponent(password) +
1535-
"&name=" + encodeURIComponent(name) + "&enabled=" + bEnabled + "&datatimeout=" + datatimeout,
1536-
async: false,
1537-
dataType: 'json',
1538-
success: function(data) {
1539-
RefreshHardwareTable();
1540-
},
1541-
error: function(){
1542-
ShowNotify($.t('Problem adding hardware!'), 2500, true);
1543-
}
1544-
});
1545-
}
15461471
else if (text.indexOf("Goodwe solar inverter via Web") >= 0)
15471472
{
15481473
var username=$("#hardwarecontent #divgoodweweb #username").val();
@@ -4919,15 +4844,15 @@ define(['app'], function (app) {
49194844
}
49204845
}
49214846
}
4922-
else if ((((data["Type"].indexOf("LAN") >= 0) || data["Type"].indexOf("MySensors Gateway with MQTT") >= 0) && (data["Type"].indexOf("YouLess") == -1) && (data["Type"].indexOf("Denkovi") == -1) && (data["Type"].indexOf("Satel Integra") == -1)) || (data["Type"].indexOf("Domoticz") >= 0) || (data["Type"].indexOf("Harmony") >= 0)) {
4847+
else if ((((data["Type"].indexOf("LAN") >= 0) || data["Type"].indexOf("MySensors Gateway with MQTT") >= 0) && (data["Type"].indexOf("YouLess") == -1) && (data["Type"].indexOf("Denkovi") == -1) && (data["Type"].indexOf("Satel Integra") == -1) && (data["Type"].indexOf("MyHome OpenWebNet with LAN interface") == -1)) || (data["Type"].indexOf("Domoticz") >= 0) || (data["Type"].indexOf("Harmony") >= 0)) {
49234848
$("#hardwarecontent #hardwareparamsremote #tcpaddress").val(data["Address"]);
49244849
$("#hardwarecontent #hardwareparamsremote #tcpport").val(data["Port"]);
49254850
if (data["Type"].indexOf("P1 Smart Meter") >= 0)
49264851
{
49274852
$("#hardwarecontent #divcrcp1 #disablecrcp1").prop("checked",data["Mode2"]==0);
49284853
}
49294854
}
4930-
else if ((((data["Type"].indexOf("LAN") >= 0) || data["Type"].indexOf("MySensors Gateway with MQTT") >= 0) && (data["Type"].indexOf("YouLess") >= 0)) || (data["Type"].indexOf("Domoticz") >= 0) || (data["Type"].indexOf("Denkovi") >= 0) || (data["Type"].indexOf("Satel Integra") >= 0) || (data["Type"].indexOf("Logitech Media Server") >= 0) || (data["Type"].indexOf("HEOS by DENON") >= 0) || (data["Type"].indexOf("Xiaomi Gateway") >= 0)) {
4855+
else if ((((data["Type"].indexOf("LAN") >= 0) || data["Type"].indexOf("MySensors Gateway with MQTT") >= 0) && (data["Type"].indexOf("YouLess") >= 0)) || (data["Type"].indexOf("Domoticz") >= 0) || (data["Type"].indexOf("Denkovi") >= 0) || (data["Type"].indexOf("Satel Integra") >= 0) || (data["Type"].indexOf("Logitech Media Server") >= 0) || (data["Type"].indexOf("HEOS by DENON") >= 0) || (data["Type"].indexOf("Xiaomi Gateway") >= 0) || (data["Type"].indexOf("MyHome OpenWebNet with LAN interface") >= 0)) {
49314856
$("#hardwarecontent #hardwareparamsremote #tcpaddress").val(data["Address"]);
49324857
$("#hardwarecontent #hardwareparamsremote #tcpport").val(data["Port"]);
49334858
$("#hardwarecontent #hardwareparamslogin #password").val(data["Password"]);

0 commit comments

Comments
 (0)