Get node red running before chrome on pi

Hi all,
im trying to make a control unit for interfacing devices.
When i try to set up the pi to run as a Kiosk device, i get the desktop appear , then chrome ,then node red service runs.
So the UI page opens but the node red UI isn't there till after a second or two.
I would like to know how i can change the node red service to operate before the chrome screen.
What im after is;
Boot up with Splash Screen ( this is done but not as good as id like )
then UI interface appears.
for now if i can get node red to run before chrome this will help, i can search for the other stuff out side this.

How are you starting node red and how are you starting Chrome?

Node red im using the
sudo systemctl enable nodered.service
for chrome im using /etc/xdg/lxsession/LXDE-pi/autostart

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@xset s off
@xset -dpms
@xset s no blank
@chromium-browser --kiosk --noerrdialogs --disable-infobars http://127.0.0.1:1880/ui/

You can't make node-red startup any quicker, so you will have to work out how to delay the chrome startup. That isn't a node-red issue. Googling suggests that the best route may be to create a shell script that starts chrome after a delay, and run that via autostart.

@Colin
ok thanks for that. ill look into it a bit more then.

Having said that then there could be a problem with yours which slows down the startup. How long does it take node-red to startup and what hardware are you running on?

just removed it all, ill set it back up and have a time. Its not slow by any means but ill check.

Couldn't you point the @chromium-browser entry to a URL that is essentially a "splash page" that (in its scripts) checks the availability of http://127.0.0.1:1880/ui/ (using fetch) then redirects once http://127.0.0.1:1880/ui/ is responding?

@Steve-Mcl ideally yes but, i have no idea how to do that at present. :grin:
currently trying different kiosk options for the pi, once i have found best solution i will try that

Its very simple TBH.

  • Create a new file called splash.html somewhere useful/accessible
  • Enter the below code...
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>Splash Screen</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
</head>
<body>
    <h1>Loading Dashboard...</h1>
    <script>
        setInterval(e => {
            fetch('http://localhost:1880/ui')
            .then(function(response) {
                window.location = 'http://localhost:1880/ui';
            })
            .catch(e => {});
        }, 2000)
    </script>
</body>
</html>
  • Test it
  • Make it prettier :slight_smile:
  • Set the @chromium-browser entry to load the splash.html (enter the full path)
  • Reboot

Works on windows box in chrome.

1 Like

@Steve-Mcl

probably is if you get html :), thanks ill read and digest then try!

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