Siemens SIMATIC S7-1500 Function Manual page 190

Web server
Hide thumbs Also See for SIMATIC S7-1500:
Table of Contents

Advertisement

function turbSpeed() {
if (AUTH_TOKEN !== null) {
}
}
function getTurbineNumber() {
let label = document.getElementById("turbine-number")
fetch(TARGET_IP, {
})
}
Web server
Function Manual, 11/2019, A5E03484625-AG
let turbSp = document.getElementById("turb-speed-sp")
fetch(TARGET_IP, {
method: "POST",
headers: {
"Content-type": "application/json",
"X-Auth-Token": AUTH_TOKEN
},
body: JSON.stringify({
"id": messageId++,
"jsonrpc": "2.0",
"method": "PlcProgram.Write",
"params": {
"var": "\"turbine_speed_sp\"",
"value": parseFloat(turbSp.value)
}
})
})
.then(response => response.json())
.then((data) => {
if (data.result) {
console.log("Api responds with " + data.result)
}
else
{throw "Something happened while writing value"
}
})
.catch(e => console.error(e))
method: "POST",
headers: {
"Content-type": "application/json",
"X-Auth-Token": AUTH_TOKEN
},
body: JSON.stringify({
"id": messageId++,
"jsonrpc": "2.0",
"method": "PlcProgram.Read",
"params": {
"var": "\"turbineNumber\""
}
})
.then(response => response.json())
.then((data) => {
label.innerHTML = data.result
})
.catch(e => console.error(e))
3.20 API (Application Programming Interface)
Web pages
189

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic et 200proSimatic et 200sp

Table of Contents