Your description is a bit confusing. On one side you "read data from the datalayer", on the other side you say that you "read the data via OpcUA".
Since you can only read the datalayer from WebIQ via the REST API, I interpret this as follows: Data is read in the PLC program - via FB's from the datalayer - then transferred to WebIQ via OpcUA.
So the problem can be either: - reading the data in the PLC - in the communication via Opc UA.
Apart from that, using a boolean variable to check connection between PLC and HMI is quite inconvenient. You should use the WebIQ widget Heartbeat instead. This works as follows:
You define an INT variable in the PLC program, which you increment in each cycle (e.g. iPlcHeartBeat). You enter it in the Hearbeat widget in the "Item" field of the "Connection Monitoring PLC -> HMI" section. With the same functionality you can monitor the communication in the PLC program. Section "Connection Monitoring HMI -> PC
... View more