# MainUI does not get updated after a few hours

**URL:** <https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799>\
**Category:** Beginners\
**Tags:** main-ui\
**Created:** [January 14, 2022, 3:26pm UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799 "2022-01-14T15:26:26Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![rash](https://community.openhab.org/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@rash](https://community.openhab.org/u/rash)\
**Post date:** [January 14, 2022, 3:26pm UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799/1 "2022-01-14T15:26:26Z")

</div>

Hi,

I want to display an OH3 MainUI overview page on a Raspberry Pi 3b with touchscreen. The Raspberry Pi is connected to my home network via wifi. OH3 (3.2.0) runs on an x86 Server inside a Docker container.

Everything runs fine for a few hours but then the displayed items on MainUI are not updated any more. I have to reload the page via the Help page to get it back to work.

Maybe this issue is related to the unreliable wifi connection. To proof that I disabled and re-enabled wifi on the Raspberry Pi. After doing so the Items also did not update any more.

A possible (but ugly) workaround is to reload the page every few hours or trigger reload on network reconnect.

Is there a better way to fix that problem?

Best regards,

Rash

---

<div class="post-metadata">

**Author:** ![rlkoshak](https://community.openhab.org/user_avatar/community.openhab.org/rlkoshak/32/75251_2.png) [@rlkoshak](https://community.openhab.org/u/rlkoshak)\
**Post date:** [January 14, 2022, 3:28pm UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799/2 "2022-01-14T15:28:51Z")

</div>

> [@rash](#):
>
> Is there a better way to fix that problem?

Not without more information about why it stops updating after a time. Try opening the console log of the browser running MainUI and see if anything jumps out when it stops updating. Maybe there are errors with the SSE feed or something like that.

---

<div class="post-metadata">

**Author:** ![hafniumzinc](https://community.openhab.org/letter_avatar_proxy/v4/letter/h/b9bd4f/32.png) [@hafniumzinc](https://community.openhab.org/u/hafniumzinc)\
**Post date:** [January 14, 2022, 3:30pm UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799/3 "2022-01-14T15:30:37Z")

</div>

Related:

> [@MainUI gets disconnected](https://community.openhab.org/t/mainui-gets-disconnected/130724):
>
> Hi Yannick (@ysc ), sorry for bothering you. I’d like to bring this problem to your attention: When launching MainUI as PWA after a while the client gets disconnected from the server. I have seen this problem rarely on older OH3 versions and have this problem with OH3.2 ~10 times a day. This problem has been confirmed [here](https://community.openhab.org/t/openjdk-and-zulu-in-openhabian/130644/19) and the disconnection problem does not appear when running MainUI from regular browser app and activating full screen mode manually. Colors, Icons and Labels do not repr…

---

<div class="post-metadata">

**Author:** ![Oliver2](https://community.openhab.org/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@Oliver2](https://community.openhab.org/u/Oliver2)\
**Post date:** [January 14, 2022, 6:05pm UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799/4 "2022-01-14T18:05:36Z")

</div>

> [@rash](#):
>
> A possible (but ugly) workaround is to reload the page every few hours or trigger reload on network reconnect.

I was thinking about [the same approach](https://community.openhab.org/t/re-connect-permanent-devices-after-oh-restart/131707)

How do you want to

> [@rash](#):
>
> trigger reload on network reconnect.

?

Basically what we need is to execute a javascript on the client.  
You can do that with javascript injection, but I guess you will run into other problem like browser blocking this script.

Maybe some experts have a good idea?

---

<div class="post-metadata">

**Author:** ![Oliver2](https://community.openhab.org/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@Oliver2](https://community.openhab.org/u/Oliver2)\
**Post date:** [January 14, 2022, 6:26pm UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799/5 "2022-01-14T18:26:49Z")

</div>

It helped for me to delete those widgets, which are complex, i.e. which have more than ~8 items.

---

<div class="post-metadata">

**Author:** ![rash](https://community.openhab.org/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@rash](https://community.openhab.org/u/rash)\
**Post date:** [January 15, 2022, 9:35am UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799/6 "2022-01-15T09:35:19Z")

</div>

I checked the Firefox console log and found an error:

ERROR: The connection to http://\<MY\_OH3\_SERVER\>/rest/events/states was interrupted while the page was loading.  
WARNING: SSE error  
INFO: =!= Event source connection broken…

---

<div class="post-metadata">

**Author:** ![Oliver2](https://community.openhab.org/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@Oliver2](https://community.openhab.org/u/Oliver2)\
**Post date:** [January 15, 2022, 9:49am UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799/7 "2022-01-15T09:49:30Z")

</div>

funny. While I was issueing a ticket [here](https://github.com/openhab/openhab-core/issues/2686#issue-1104658462), your post came right in time😀

---

<div class="post-metadata">

**Author:** ![rash](https://community.openhab.org/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@rash](https://community.openhab.org/u/rash)\
**Post date:** [January 15, 2022, 10:25am UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799/8 "2022-01-15T10:25:23Z")

</div>

Regarding the “ugly” way:  
I have also been thinking about either doing some javascript injection or in restarting the Raspi on network loss.

> It helped for me to delete those widgets, which are complex, i.e. which have more than ~8 items.

My page has 13 Controls, most of them are oh-label-cell with trend item and analyzer action, but one is quite complex showing weather information (a modified version of the weather card from [GitHub - rgrollfitz/oh3-widgets](https://github.com/rgrollfitz/oh3-widgets) ).

Maybe the issue is related to timeouts or concurrency problems, maybe especially on slower devices.

---

<div class="post-metadata">

**Author:** ![Oliver2](https://community.openhab.org/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@Oliver2](https://community.openhab.org/u/Oliver2)\
**Post date:** [January 15, 2022, 10:27am UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799/9 "2022-01-15T10:27:44Z")

</div>

could you do us a favour and remove that widget for a day and see if the problem persists?

---

<div class="post-metadata">

**Author:** ![rash](https://community.openhab.org/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@rash](https://community.openhab.org/u/rash)\
**Post date:** [January 15, 2022, 10:43am UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799/10 "2022-01-15T10:43:04Z")

</div>

No problem, I manage the OH configuration files in a git repository so I can easily modify the page and roll back after this test. I removed all widgets except the outdoor temperature.

---

<div class="post-metadata">

**Author:** ![rash](https://community.openhab.org/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@rash](https://community.openhab.org/u/rash)\
**Post date:** [January 27, 2022, 6:40pm UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799/11 "2022-01-27T18:40:28Z")

</div>

Sorry for the long delay. I did extensive testing with different widget configurations and different network conditions.

Test environment:  
The Raspberry Pi 3b is installed in the central corridor of our house. It is connected via wifi with mediocre signal strength. The device can connect to one of three access points in our house (same SSID, 2.4GHz, 802.11r handover).

For the first test I removed all widgets but one. The errors still occured.  
For the second test I connected the device via GBit ethernet. This way I had no problems regardless of the number or complexity of widgets.  
For the third test I moved the device near any of my wifi access points. This was as reliable as using ethernet cable.

Assuming the problem is related to the mediocre wifi connection I inspected all network related logs and found the problem in dhcpd:  
About six seconds before the SSE error is logged in the browser dhcpd announces “wlan0: carrier lost” and deletes address and route. In the same second the carrier is acquired again and the dhcpd restores address and route. This is finished at the same time when the Connection to /rest/event/states gets interrupted and the SSE error occurs.

So for me it looks like the event stream gets disconnected on any network glitch. It is easy to reproduce this with pulling a network cable for a second.

I think this issue really should be fixed to make 24/7 displays reliable. At least the Main UI should show that it is disconnected.

---

<div class="post-metadata">

**Author:** ![Oliver2](https://community.openhab.org/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@Oliver2](https://community.openhab.org/u/Oliver2)\
**Post date:** [January 27, 2022, 7:21pm UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799/12 "2022-01-27T19:21:29Z")

</div>

Good job! Unfortunately the ticket on Github does not get any attention. I assume it will not be fixed soon and maybe it will never be fixed.  
Anyway, thank you very much for pursuing this further and to provide us with new information so that we can derive workarounds from that

---

<div class="post-metadata">

**Author:** ![rash](https://community.openhab.org/letter_avatar_proxy/v4/letter/r/9de0a6/32.png) [@rash](https://community.openhab.org/u/rash)\
**Post date:** [January 30, 2022, 1:49pm UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799/13 "2022-01-30T13:49:06Z")

</div>

Update: I tried to use the chromium web browser on the Raspberry Pi and then this error does not occur. So the error seems to be specific to firefox.  
The bad news is that I already switched from chromium to firefox because with chromium loading the main page loads for a long time and results in a timeout (ChunkLoadError). I‘ve already seen forum discussion about this error. one suggested solution was switching to firefox…

---

<div class="post-metadata">

**Author:** ![Oliver2](https://community.openhab.org/letter_avatar_proxy/v4/letter/o/df705f/32.png) [@Oliver2](https://community.openhab.org/u/Oliver2)\
**Post date:** [January 30, 2022, 1:57pm UTC](https://community.openhab.org/t/mainui-does-not-get-updated-after-a-few-hours/131799/14 "2022-01-30T13:57:15Z")

</div>

and it is also device specific.  
On iOS I have this problem no matter if I use Chromium or Firefox
