Auto refresh dashboard when changing tabs

Hi,

I have created 2 "google home alarm clock" dashboard flows
one for me and one for my daughter. We view the dashboard on android mobil phones.

When I switch between the 2 TABs, the saved (to file) context data is only loaded into the dashboard when I refresh the page (swipe down)

How can I auto refresh when switching to the other TAB?

Use the ui_control node as trigger

and send to another ui_control the payload with an empty tab name to refresh the current page.

Hi, i have connected the nodes like this in both flows, but nothing happens when I change tabs.

When the dashboard is loaded from scratch in the (chrome) browser, the context data is loaded into the first tab, but when I switch tabs I need to refresh each time

You have to take care that you create no endless loops - because a refresh triggers the first node again. So it is useful to filter out the tab which should be refreshed and you need to delete the socket-id.

So i created a flow which refreshes a page "test" when someone switches a tab named test.

[
    {
        "id": "5ea0c06fa7709de5",
        "type": "ui_ui_control",
        "z": "54b226bc.0793e8",
        "name": "",
        "events": "all",
        "x": 180,
        "y": 3080,
        "wires": [
            [
                "7d9c29f0419c67fe"
            ]
        ]
    },
    {
        "id": "12d1e9659b28dc8c",
        "type": "ui_ui_control",
        "z": "54b226bc.0793e8",
        "name": "",
        "events": "all",
        "x": 860,
        "y": 3080,
        "wires": [
            []
        ]
    },
    {
        "id": "a7e09627253fb76a",
        "type": "change",
        "z": "54b226bc.0793e8",
        "name": "Refresh Browser",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{\"tab\":\"\"}",
                "tot": "json"
            },
            {
                "t": "delete",
                "p": "socketid",
                "pt": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 510,
        "y": 3080,
        "wires": [
            [
                "de960b742c49b829"
            ]
        ]
    },
    {
        "id": "7d9c29f0419c67fe",
        "type": "switch",
        "z": "54b226bc.0793e8",
        "name": "",
        "property": "name",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "test",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 330,
        "y": 3080,
        "wires": [
            [
                "a7e09627253fb76a"
            ]
        ]
    },
    {
        "id": "de960b742c49b829",
        "type": "trigger",
        "z": "54b226bc.0793e8",
        "name": "",
        "op1": "",
        "op2": "",
        "op1type": "pay",
        "op2type": "nul",
        "duration": "5",
        "extend": true,
        "overrideDelay": false,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "topic": "topic",
        "outputs": 1,
        "x": 700,
        "y": 3080,
        "wires": [
            [
                "12d1e9659b28dc8c"
            ]
        ]
    }
]

You have to think if you really just want to refresh a page/tab or if a flow should be triggered again to fill i.e. template nodes again.

So I fill my template nodes each time - my tab is selected again. The change tab event triggerst again the flow to fill the template nodes again - this is not a refresh tab - it is a refresh of the template nodes.

Thanx…this is working.
I guess I only have refresh the nodes of the second tab (which is my Google Home Alarm Clock), because the nodes of the first tab (my daughters Google Home Alarm Clock) are always refreshed when the chrome page is opened?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.