Prevent dashboard reload on re-deploy?


#1

I'm testing a full-screen kiosk app on one of my new Fire 7 tablets. The app is called "Fully Kiosk" and for EUR 5.70 it does motion detection to fade on and off the screen when someone walks past where it's mounted in the wall. It's really nice and although I've only been testing it for a day, I can already recommend this app to cover every use case required for a wall controller.

The app allows you to set a default web page to display. In our living room, I've set it to display the dashboard with ID=1.

Problem is, every time I re-deploy, the dashboard reloads into ID=0 (bedroom). The user then has to come out of the locked-down app, and relaunch the page. (There are no refresh buttons, as it's full screen...)

How can I avoid this?


#2

Use the Dashboard tab in the sidebar and move the group you want to show at startup as the first in the list.
dash1

So you end up with this:
dash2
It should now be there forst to show when you open the dashboard.


#3

@zenofmud Thanks, although I don't think I explained my question clearly enough.

I'm going to have the same problem with the bedroom controller, if I do that!

So is there a way for different instances of Dashboard to reset to different pages on re-deploy? Or for re-deploy to actually maintain the current page?

Right now I can't see how to make it usable in the use case of tablets in walls


#4

Have a look at what the ui_control node emits on connect. If you can determine which device is connecting then you can then auto switch it back to the correct page


#5

I've tried the following:

  • checking the output of ui_control node and pasting this into the input via a function node, like this:

    var msg = {"payload":"change","tab":1,"name":"Bedroom","socketid":"i4ND63DhnA7SEAGxAAAT","socketip":"10.0.0.184","_msgid":"baf75e01.b35e9"};
    return msg;
    

This doesn't appear to work. The ui_control node help suggests I input the tab number as the msg.payload. Although this works, it does it for all connected clients, not just one based on its IP address.

Is there a way to change the current tab for just one single http connection (i.e. from one device only)?


#6

I havn't tried the ui_control change trick, but I have a flow that saves every opened dashboard client's URL in each browser's localstorage and can later reload the urls on command (for ex: automatically after a full deploy). You just have to duplicate and wire the ui_template in between the link nodes for each tab you have. Note that the pass through option is disabled and should remain so as to not create an infinite loop.

[
    {
        "id": "d794432d.d34f9",
        "type": "ui_template",
        "z": "1f6b105a.a3f8d",
        "group": "",
        "name": "UI location TAB 0",
        "order": 2,
        "width": 0,
        "height": 0,
        "format": "<script>\n\n(function($scope) {\n$scope.$watch('msg', function() {\n    if ($scope.msg){\n        if ($scope.msg.payload == \"saveURL\"){\n            localStorage.setItem(\"url\", window.location.href);\n            console.log(\"saved url: \" + window.location.href)\n            $scope.send({\"payload\": \"saved\"});\n        }else if ($scope.msg.payload == \"loadURL\"){\n            console.log(\"loading url: \" + localStorage.getItem(\"url\"))\n            window.location.replace(localStorage.getItem(\"url\"));\n            $scope.send({\"payload\": \"reloaded\"});\n            location.reload();\n        }\n    }\n });\n    \n})(scope);\n</script>",
        "storeOutMessages": true,
        "fwdInMessages": false,
        "templateScope": "local",
        "x": 1070,
        "y": 640,
        "wires": [
            [
                "480a0e68.8886b"
            ]
        ]
    },
    {
        "id": "a1cf71b2.6eab1",
        "type": "ui_template",
        "z": "1f6b105a.a3f8d",
        "group": "",
        "name": "UI location TAB 1",
        "order": 2,
        "width": 0,
        "height": 0,
        "format": "<script>\n\n(function($scope) {\n$scope.$watch('msg', function() {\n    if ($scope.msg){\n        if ($scope.msg.payload == \"saveURL\"){\n            localStorage.setItem(\"url\", window.location.href);\n            console.log(\"saved url: \" + window.location.href)\n            $scope.send({\"payload\": \"saved\"});\n        }else if ($scope.msg.payload == \"loadURL\"){\n            console.log(\"loading url: \" + localStorage.getItem(\"url\"))\n            window.location.replace(localStorage.getItem(\"url\"));\n            $scope.send({\"payload\": \"reloaded\"});\n            location.reload();\n        }\n    }\n });\n    \n})(scope);\n</script>",
        "storeOutMessages": true,
        "fwdInMessages": false,
        "templateScope": "local",
        "x": 1070,
        "y": 680,
        "wires": [
            [
                "480a0e68.8886b"
            ]
        ]
    },
    {
        "id": "7b4b4d4a.b93b04",
        "type": "link in",
        "z": "1f6b105a.a3f8d",
        "name": "",
        "links": [
            "83ed580a.76f1a8",
            "480a0e68.8886b",
            "b9c016e3.20d6d8",
            "78d53945.cc8618"
        ],
        "x": 915,
        "y": 660,
        "wires": [
            [
                "d794432d.d34f9",
                "a1cf71b2.6eab1",
                "2580e102.4145be"
            ]
        ]
    },
    {
        "id": "480a0e68.8886b",
        "type": "link out",
        "z": "1f6b105a.a3f8d",
        "name": "",
        "links": [
            "7b4b4d4a.b93b04"
        ],
        "x": 1215,
        "y": 660,
        "wires": []
    },
    {
        "id": "8003c724.5f5358",
        "type": "inject",
        "z": "1f6b105a.a3f8d",
        "name": "",
        "topic": "",
        "payload": "saveURL",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 760,
        "y": 640,
        "wires": [
            [
                "78d53945.cc8618"
            ]
        ]
    },
    {
        "id": "48aefefd.d7044",
        "type": "inject",
        "z": "1f6b105a.a3f8d",
        "name": "",
        "topic": "",
        "payload": "loadURL",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 759,
        "y": 684,
        "wires": [
            [
                "78d53945.cc8618"
            ]
        ]
    },
    {
        "id": "78d53945.cc8618",
        "type": "link out",
        "z": "1f6b105a.a3f8d",
        "name": "",
        "links": [
            "7b4b4d4a.b93b04"
        ],
        "x": 875,
        "y": 660,
        "wires": []
    },
    {
        "id": "5ea4aaed.324674",
        "type": "comment",
        "z": "1f6b105a.a3f8d",
        "name": "Copy paste the template for each tab you want to control",
        "info": "",
        "x": 1030,
        "y": 600,
        "wires": []
    },
    {
        "id": "4d63bf8d.cd8ff",
        "type": "comment",
        "z": "1f6b105a.a3f8d",
        "name": "...",
        "info": "",
        "x": 1070,
        "y": 720,
        "wires": []
    },
    {
        "id": "2580e102.4145be",
        "type": "ui_template",
        "z": "1f6b105a.a3f8d",
        "group": "",
        "name": "UI location TAB x (last tab)",
        "order": 2,
        "width": 0,
        "height": 0,
        "format": "<script>\n\n(function($scope) {\n$scope.$watch('msg', function() {\n    if ($scope.msg){\n        if ($scope.msg.payload == \"saveURL\"){\n            localStorage.setItem(\"url\", window.location.href);\n            console.log(\"saved url: \" + window.location.href)\n            $scope.send({\"payload\": \"saved\"});\n        }else if ($scope.msg.payload == \"loadURL\"){\n            console.log(\"loading url: \" + localStorage.getItem(\"url\"))\n            window.location.replace(localStorage.getItem(\"url\"));\n            $scope.send({\"payload\": \"reloaded\"});\n            location.reload();\n        }\n    }\n });\n    \n})(scope);\n</script>",
        "storeOutMessages": true,
        "fwdInMessages": false,
        "templateScope": "local",
        "x": 1080,
        "y": 760,
        "wires": [
            [
                "480a0e68.8886b"
            ]
        ]
    }
]