|
|
@ -27,17 +27,17 @@ |
|
|
|
<select name="iv" id="InvID"> |
|
|
|
</select> |
|
|
|
<br/> |
|
|
|
<input type="button" value="power limit 100%" class="btn" id="pwrlim2"/> |
|
|
|
<input type="button" value="power limit 10%" class="btn" id="pwrlim"/> |
|
|
|
<input type="button" value="Restart" class="btn" id="restart"/> |
|
|
|
<input type="button" value="Turn Off" class="btn" id="turnoff"/> |
|
|
|
<input type="button" value="Turn On" class="btn" id="turnon"/> |
|
|
|
<div id='power'> |
|
|
|
<input type="button" value="Restart" class="btn" id="restart"/> |
|
|
|
<input type="button" value="Turn Off" class="btn" id="power_off"/> |
|
|
|
<input type="button" value="Turn On" class="btn" id="power_on"/> |
|
|
|
</div> |
|
|
|
<br/> |
|
|
|
<label>Send Power Limit:</label> |
|
|
|
<input type="text" class="text" name="pwrlimval" maxlength="4" size="20%"/> |
|
|
|
<input type="number" class="text" name="pwrlimval" maxlength="4" size="20%"/> |
|
|
|
<label></label> |
|
|
|
<select name="pwrlimcntrl" id="pwrlimcntrl"> |
|
|
|
<option value="65535">select the unit and persistence</option> |
|
|
|
<option value="65535" selected disabled hidden>select the unit and persistence</option> |
|
|
|
<option value="0">absolute in Watt non persistent</option> |
|
|
|
<option value="1">relativ in percent non persistent</option> |
|
|
|
<option value="256">absolute in Watt persistent</option> |
|
|
@ -132,48 +132,39 @@ |
|
|
|
function get_selected_iv() |
|
|
|
{ |
|
|
|
var e = document.getElementById("InvID"); |
|
|
|
return e.value; |
|
|
|
return parseInt(e.value); |
|
|
|
} |
|
|
|
|
|
|
|
document.getElementById("turnon").addEventListener("click", function() { |
|
|
|
var obj = new Object(); |
|
|
|
obj.inverter = get_selected_iv(); |
|
|
|
obj.cmd = 0; |
|
|
|
obj.tx_request = 81; |
|
|
|
getAjax("/api/ctrl", ctrlCb, "POST", JSON.stringify(obj)); |
|
|
|
}); |
|
|
|
const wrapper = document.getElementById('power'); |
|
|
|
|
|
|
|
document.getElementById("turnoff").addEventListener("click", function() { |
|
|
|
wrapper.addEventListener('click', (event) => { |
|
|
|
var power = event.target.value; |
|
|
|
var obj = new Object(); |
|
|
|
obj.inverter = get_selected_iv(); |
|
|
|
obj.cmd = 1; |
|
|
|
obj.tx_request = 81; |
|
|
|
getAjax("/api/ctrl", ctrlCb, "POST", JSON.stringify(obj)); |
|
|
|
}); |
|
|
|
|
|
|
|
document.getElementById("restart").addEventListener("click", function() { |
|
|
|
var obj = new Object(); |
|
|
|
obj.inverter = get_selected_iv(); |
|
|
|
obj.cmd = 2; |
|
|
|
obj.tx_request = 81; |
|
|
|
getAjax("/api/ctrl", ctrlCb, "POST", JSON.stringify(obj)); |
|
|
|
}); |
|
|
|
if(power === "Restart") { |
|
|
|
obj.cmd = 0; |
|
|
|
} else if(power === "Turn Off") { |
|
|
|
obj.cmd = 1; |
|
|
|
} else { |
|
|
|
obj.cmd = 2; |
|
|
|
} |
|
|
|
|
|
|
|
document.getElementById("pwrlim").addEventListener("click", function() { |
|
|
|
var obj = new Object(); |
|
|
|
obj.inverter = get_selected_iv(); |
|
|
|
obj.cmd = 11; |
|
|
|
obj.tx_request = 81; |
|
|
|
obj.payload = [10, 1]; |
|
|
|
getAjax("/api/ctrl", ctrlCb, "POST", JSON.stringify(obj)); |
|
|
|
}); |
|
|
|
|
|
|
|
document.getElementById("pwrlim2").addEventListener("click", function() { |
|
|
|
document.getElementById("sendpwrlim").addEventListener("click", function() { |
|
|
|
var power = parseInt(document.getElementsByName('pwrlimval')[0].value); |
|
|
|
var type = parseInt(document.getElementsByName('pwrlimcntrl')[0].value); |
|
|
|
|
|
|
|
if((type == 1 || type == 257) && power < 2) power = 2; |
|
|
|
|
|
|
|
var obj = new Object(); |
|
|
|
obj.inverter = get_selected_iv(); |
|
|
|
obj.cmd = 11; |
|
|
|
obj.tx_request = 81; |
|
|
|
obj.payload = [100, 1]; |
|
|
|
obj.payload = [power, type]; |
|
|
|
getAjax("/api/ctrl", ctrlCb, "POST", JSON.stringify(obj)); |
|
|
|
}); |
|
|
|
|
|
|
|