diff --git a/PV_Visu/module.html b/PV_Visu/module.html
index 0f1b3b6..7e32f63 100644
--- a/PV_Visu/module.html
+++ b/PV_Visu/module.html
@@ -35,8 +35,18 @@
document.getElementById('barPV').style.width = data.consPV + '%';
document.getElementById('barGrid').style.width = data.consGrid + '%';
}
- function handleMessage(msg) { Apply(msg); }
- // Kein requestAction-Aufruf hier nötig
+ function handleMessage(msg) {
+ try {
+ var data = (typeof msg === 'string') ? JSON.parse(msg) : msg;
+ Apply(data);
+ } catch(e) {
+ console.error('PV_Visu handleMessage error:', e, msg);
+ }
+ }
+ // Bind to HTML-SDK
+ if (typeof registerMessageHandler === 'function') {
+ registerMessageHandler(handleMessage);
+ }