How to not have to manually refresh a dashboard ui on startup

Hello,

I am very new to node red and the linux operating system (3 weeks).I am using a raspberry pi 3 and I have been trying to make a temperature gauge with node red which hooks up to a small 5 inch tft screen. The idea is that when the pi boots up it automatically displays the dashboard i have made which shows temperature. However, i have to manually refresh the page when it starts to see the dashboard, which isnt ideal.

I was wondering if there was away that the dashboard loads up without me having to hit refresh on a tiny screen.

I am aware I might have missed out some details but hopefully you get the gist.

Hello @Zoomer, welcome to the forum.

So, can we assume that you already configured your Raspberry Pi in kiosk or full-screen mode ?

I have set it up in full screen mode. From what I understand Kiosk mode stops you from going out of the window which I don't want as I'm still in the early stages of making my flow.

Good. In such case you probably added a line like below in the autostart file, right ?

@chromium-browser --start-fullscreen http://127.0.0.1:1880/ui

That would start the dashboard (without need to refresh).

Yes, exactly that. However, I reboot the pi and I get the message in the chromium browser.

"This site can't be reached"
(Ip address) refused to connect
try:
-checking connection
-proxy and firewall
ERR_connection_refused

Then I press the reload, and it displays the dashboard.

I should add that I have not connected this up to the internet as I want it to run locally. Does this affect anything?

Your Node-RED instance is installed in the very same Raspberry Pi where you are trying to run the dashboard ? Perhaps Node-RED is installed in another machine ?

I can not imagine why your are getting those warnings.
There are a couple of similar posts in the forum, like this one. Perhaps you can get some clue by reading those posts.

Everything I am doing is on the raspberry pi as i do not know how to operate the pi from an external pc.

I guess what is happening is that the browser is starting up before node-red gets going (the browser is running on the same pi I assume) so it can't connect and shows the errors. Then node-red gets going, but it is too late as the browser has already given up.

If that is the case there isn't much that node red can do about it as the browser isn't connected to node-red. You could try putting a delay in the browser auto start so that it waits for node-red to get going before starting up.

3 Likes

I guess the root cause well spotted by @Colin could be (hopefully) fixed with below solution. I did not try it though.

Can I delay chromium in kiosk mode?

I have just booted it up this morning. I noticed I had to reload the page multiple times before it would run. I knew that before I had to wait a long time for the flow to actually work upon booting up the pi but the browser was ready before then. I'll take a look at what @Andrei has linked me. Thank you both for helping!

The solution that the user said worked for him was as follows.......

///
Not sure if this would work but you could replace the chromium entry with a Bash script.

Code: Select all

#!/bin/bash
echo "Starting chromium in 5 seconds..."
sleep 5
chromium --noerrdialogs --kiosk http://127.0.0.1:3000/demo.html &

Save the above to /home/pi/start-chromium.sh (note the addition of & at the end of chromium line to start chromium as a background process, thus allowing the script to end immediately instead of waiting for chromium to close)

"Run chmod u+x start-chromium.sh" to give execute permission.

Replace chromium line in X startup script with "@/home/pi/start-chromium.sh"
///

I'm really not that familiar with the terminal, I literally just copy what different threads say work and hope it doesnt mess things up. Is someone able to walk me through this? I was originally doing all the start-up stuff in this directory.

/home/pi/.config/lxsession/LXDE-pi/autostart

When doing the sudo nano stuff again to the directory which was said in the entry it says this is writing a new file. Is this correct to go forward?

also the last two lines in the entry I'm not sure what they mean.

Thanks
Zoomer

Can try. It will be safer if you share the content of your autostart file here so we can be specific to your use case.

The contents of the autostart file is as follows:
//
@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
#@screensaver -no-splash
@xset s off
@xset -dpms
@xset s noblank
@chromiuim-browser --start-fullscreen http://127.0.0.1:1880/ui
@point-rpi
//
Im not sure if anything can be placed in here to stop the browser loading before node red has set up the local webpage.

Before we start off please double check your file. There is a typo in the following line. Maybe you want to correct it and test again before doing any other changes.

@chromiuim-browser --start-fullscreen http://127.0.0.1:1880/ui

Sorry it is:
@chromium-browser --start-fullscreen http://127.0.0.1:1880/ui/

I'm having to type this out manually.

First step, riskless.

1- Go to your home directory, presumably /home/pi and create the bash file with nano editor (or whatever text editor you use)

cd /home/pi
nano start-chromium.sh

2- Copy and paste below lines to the new file

#!/bin/bash
echo "Starting chromium in 15 seconds..."
sleep 15
chromium-browser --start-fullscreen http://127.0.0.1:1880/ui &

3- Save the file and then run below command

chmod u+x start-chromium.sh

4- You can test it by entering below statement in the command line (from your home directory). This should launch your browser.

./start-chromium.sh

We have not modified (yet) the autostart, which is the next step after you confirm you are good to go.

--disable-quic --enable-tcp-fast-open --ppapi-flash-path=/usr/lib/chromium-browser/libpepflashplayer.so --ppapi-flash-args=enable_stagevideo_auto=0 --ppapi-flash-version=
[3746:3746:0630/212154.833772:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180.

I am getting this error. I had to use sudo command as well to get this to work. (well not work)

Check who is the owner and what are the permission of the new file named start-chromium.sh with the ls -l command

Normally the user should be pi not root (which may be troubled if you used sudo to create the file).

I right clicked on the file on the interface and on properties it says that root is the owner.
Shall I create a new file?
and do i need to delete the old one? if so how.

Thanks

As a general rule don´t use sudo unless strictly required. It should be easy to change the owner of the bash file. Try:

sudo chown pi start-chromium.sh

and then check the result with the command ls -l

1 Like