Fix: Check if valid data was received from websocket before assigning it

Otherwise it can lead to exceptions in inverterData method
This commit is contained in:
Thomas Basler 2023-09-02 01:43:20 +02:00
parent b34b22c658
commit 9dec05def8

View File

@ -485,7 +485,9 @@ export default defineComponent({
this.socket.onmessage = (event) => { this.socket.onmessage = (event) => {
console.log(event); console.log(event);
if (event.data != "{}") {
this.liveData = JSON.parse(event.data); this.liveData = JSON.parse(event.data);
}
this.dataLoading = false; this.dataLoading = false;
this.heartCheck(); // Reset heartbeat detection this.heartCheck(); // Reset heartbeat detection
}; };