25.10.2016, 13:27
(This post was last modified: 25.10.2016, 13:28 by Erwin van der Zwart.)
Hi Thomas,
Use this as framework, the rest is up to you (;
You have 4 object listeners now in this framework that respond on KNX values.
If you look in custom javascript section you can find a newer version of the object listener (something like grp.listen), but this one i had copy-paste ready (;
BR,
Erwin
Use this as framework, the rest is up to you (;
You have 4 object listeners now in this framework that respond on KNX values.
Code:
<!DOCTYPE html">
<head>
<title>homeLYnk by Schneider Electric</title>
<style type="text/css">
body {
background-color: transparent;
}
</style>
</head>
<body>
<script type="text/javascript">
// ***** Make link to parent from iframe *****
var p = window.parent, root, addr;
if (p && p.objectStore){
// Add event listeners on KNX addresses
addr1 = p.Scada.encodeGroupAddress('1/1/1');
p.objectStore.addListener(addr1, function(obj, type) {
// to avoid (re)trigger on opening page */
if (type == 'init') {
return;
// Or do your JavaScript actions on received value on page load
} else {
// Do your JavaScript actions on new received value
}
});
addr2 = p.Scada.encodeGroupAddress('1/1/2');
p.objectStore.addListener(addr2, function(obj, type) {
// to avoid (re)trigger on opening page */
if (type == 'init') {
return;
// Or do your JavaScript actions on received value on page load
} else {
// Do your JavaScript actions on new received value
}
});
addr3 = p.Scada.encodeGroupAddress('1/1/3');
p.objectStore.addListener(addr3, function(obj, type) {
// to avoid (re)trigger on opening page */
if (type == 'init') {
return;
// Or do your JavaScript actions on received value on page load
} else {
// Do your JavaScript actions on new received value
}
});
addr4 = p.Scada.encodeGroupAddress('1/1/4');
p.objectStore.addListener(addr4, function(obj, type) {
// to avoid (re)trigger on opening page */
if (type == 'init') {
return;
// Or do your JavaScript actions on received value on page load
} else {
// Do your JavaScript actions on new received value
}
});
}
</script>
</body>
</html>
If you look in custom javascript section you can find a newer version of the object listener (something like grp.listen), but this one i had copy-paste ready (;
BR,
Erwin