herve
Junior Member
Posts: 54
|
Post by herve on Apr 6, 2021 6:17:10 GMT -8
Hello
My SkyWeather2 package arrived last week so I'm an absolute beginner. When installing I keep struggling with a problem. All tests work, but when I finally complete the rc.local file adding the lines as mentioned in the manual and do a reboot, I cannot connect to the dash app via port 8050. Am I missing something? I hope you can help me. Best regard Hervé Tavernier
This my rc.local-file:
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing.
# Print the IP address _IP=$(hostname -I) || true if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" fi
cd /home/pi/SDL_Pi_Skyweather2 nohup sudo python3 SkyWeather2.py & chmod 666 nohup.out
exit 0
|
|
|
Post by doxidad on Apr 6, 2021 6:59:11 GMT -8
You have not added the commands to start dash_app so it is not running. If you want to start dash_app from rc.local you would need to add the following to rc.local after the start of SkyWeather2. cd /home/pi/SDL_Pi_SkyWeather2/dash_app nohup sudo python3 index.py & chmod 666 nohup.out I would try to run dash on the command line first to make sure it runs OK without any errors before adding it to your rc.local try this - cd /home/pi/SDL_Pi_SkyWeather2/dash_app sudo python3 index.py SkyWeather2.JSON File does not exist ../SkyWeather2.JSON File exists ../SkyWeather2.JSON File exists ../SkyWeather2.JSON File exists ../SkyWeather2.JSON File exists ../SkyWeather2.JSON File exists Dash is running on * Serving Flask app "dash_app" (lazy loading) * Environment: production WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. * Debug mode: off * Running on (Press CTRL+C to quit)
|
|
herve
Junior Member
Posts: 54
|
Post by herve on Apr 6, 2021 7:49:25 GMT -8
Hello Thank you for the information, but some things are not clear to me. When I start dash from the command line with the instructions you gave me, everything is fine. But is it normal to always start the dashboard from the command line? I can of course add your instructions to my rc.local, but why is this not mentioned anywhere in the manual? And what is the refresh rate of the dashboard? I assumed one could see the observations permanently in the dashboard tables and charts. Or do I not understand the operation of SkyWeather2 properly. I hope you want to help me a little bit further.
Hervé
|
|
|
Post by SDL on Apr 6, 2021 8:00:20 GMT -8
Sounds like you are close and doxidad beat me to the answer.
Regarding the dash app, this should be in the manual. I'm adding it as a bug for the next release.
BP
|
|
herve
Junior Member
Posts: 54
|
Post by herve on Apr 6, 2021 8:33:42 GMT -8
Thank you. An additional question from a non-programmer: do I have to mention the instruction "chmod 666 nohup.out" twice in the rc.local file? And one more thing: the SkyWeather Configuration Tool asks for the SkyWeather Station Key under WeatherStem configuration. Where can I find that Key. In my package I only find the SkyWeather Serial Number, but I assume that this is not the requested key. Hervé p.s. Please apologize for my poor English. I am Dutch speaking...
|
|
|
Post by doxidad on Apr 6, 2021 10:41:33 GMT -8
Your English is very good!!!
The reason for 2 - if you start both programs with rc.local there are 2 files created in 2 separate directories - /home/pi/SDL_Pi_SkyWeather2 and also in /home/pi/SDL_Pi_SkyWeather2/dash_app. They are both called nohup.out.
When these files are created the protection on the files looks like this:
ls -l nohup.out -rw------- 1 pi pi 9632 Apr 6 10:50 nohup.out
This is an OCTAL bit mask with every position being a protection
This gives read & write permissions to the owner (root) but not anyone else.
Using the chmod command, the file protection are modified so that the files can be read & written by owner, group and world.
ls -l nohup.out -rw-rw-rw- 1 pi pi 9632 Apr 6 10:50 nohup.out
Look at the manual page for chown -> man chown this might clear things up abit.
I hope this explains why 2 are needed.
|
|
herve
Junior Member
Posts: 54
|
Post by herve on Apr 6, 2021 11:06:00 GMT -8
Thank you again I have now adjusted the rc.local as you suggested and did a reboot, but when I try to open the dashboard with 192.168.1.115: 8050 (my RPi4's IP address is 192.168.1.115) then I get: "This site is unavailable". Could anything else be wrong? When I start SkeyWeather2.py via the command line with "sudo python3 SkyWeather2.py" I see that data is indeed stored in the MySQL database. I don't really know what to do anymore... I hope you can give a hint
Hervé
|
|
|
Post by SDL on Apr 6, 2021 16:14:21 GMT -8
Let's check if it s running on bootbup.
Type the following and post the results:
sudo ps oaf | grep python
BP
|
|
|
Post by doxidad on Apr 6, 2021 16:15:30 GMT -8
I can think of a couple of things that you can check. If you are connected to a router via WIFI and you haven't set up a static IP on your PI, your address may have changed since the router hands out addresses via dhcp. You can check this just to be sure by using this command - ifconfig. Here's mine showing at 192.168.200.85
pi@WPI2:~ $ ifconfig wlan0wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.200.85 netmask 255.255.255.0 broadcast 192.168.200.255 inet6 fe80::76da:38ff:fe62:8bb3 prefixlen 64 scopeid 0x20<link> ether 74:da:38:62:8b:b3 txqueuelen 1000 (Ethernet) RX packets 1440195 bytes 227543069 (217.0 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1728360 bytes 391589382 (373.4 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
If you are connected via CAT5 connection use ifconfig eth0 to check the IP.
The second thing is maybe the dash_app isn't really running.
You can check this by using this command
ps ax | grep index.py | grep -v grep 2118 pts/2 S 0:00 sudo nohup python3 index.py 2119 pts/2 S 0:02 python3 index.py
You can see that index.py is running on my PI.
If it isn't running - check rc.local to make sure there an no misspellings
look at the file nohup.out in /home/pi/SDL_Pi_SkyWeather2/dash_app to see if there are any errors
|
|
herve
Junior Member
Posts: 54
|
Post by herve on Apr 7, 2021 8:24:46 GMT -8
Hello SDL Sorry for the late reply, but the time difference between your location and mine (Belgium) plays tricks on us ... sudo ps oaf | grep python did not work as you can see, but ps -aux | grep python did Result: pi@SwitchDoc:~ $ sudo ps oaf | grep python error: unknown user-defined format specifier "af" Usage: ps [options] Try 'ps --help <simple|list|output|threads|misc|all>' or 'ps --help <s|l|o|t|m|a>' for additional help text. For more details see ps(1). pi@SwitchDoc:~ $ ps -aux | grep python root 511 0.0 0.0 10352 3152 ? S 17:37 0:00 sudo python3 Sk yWeather2.py root 514 0.0 0.0 10352 3172 ? S 17:37 0:00 sudo python3 in dex.py root 539 5.2 1.8 149448 71648 ? S 17:37 0:11 python3 index.p y root 540 3.3 1.1 240376 45892 ? Sl 17:37 0:07 python3 SkyWeat her2.py pi 1946 0.0 0.0 7368 580 pts/0 S+ 17:40 0:00 grep --color=au to python Is this ok?Hervé Attachments:
|
|
|
Post by doxidad on Apr 7, 2021 8:39:12 GMT -8
That's what you should see with the command you used.
BTW the example I posted was ps ax | grep index.py | grep -v grep
meaning run ps with the switches ax - pipe to grep an look for index.py and then pipe to grep to discount the instance of the command you just executed.
What you did was similar - so no problem - both SkyWeather and index are running which is what we were looking for.
How about the IP address? is it correct?
If you are using the browser on the PI you could also use This address points to yourself so you don't need to know the IP
|
|
herve
Junior Member
Posts: 54
|
Post by herve on Apr 7, 2021 8:45:01 GMT -8
Hello doxidad
Sorry for my late respons due to the time difference between Belgium and your location (US?)
I have made the IP address of my RPi4 static.
ps ax | grep index.py | grep -v grep gave the following result:
pi@SwitchDoc:~ $ ps ax | grep index.py | grep -v grep
514 ? S 0:00 sudo python3 index.py
539 ? S 1:13 python3 index.py
I think this is ok?
In the meantime, everything works fine here. There were indeed typos in the rc.local file: the directory-name SDL_Pi_Skyweather2 must a lowercase w, while the python file SkyWeather2.py must have an uppercase! Kind of confusing. Those typos also happened in the manuals.
After correcting, the rc.local works.
Thank you for the good help. I learned a lot in my old days (I am 75 years young ...)
Best regards Hervé - Hoeselt - Belgium
|
|
|
Post by doxidad on Apr 7, 2021 8:50:03 GMT -8
GREAT! I'm not far behind you - I'm 72 - but have been doing computer stuff for 46 years.
|
|
herve
Junior Member
Posts: 54
|
Post by herve on Apr 7, 2021 9:29:03 GMT -8
Hello doxidad
So old glories together! I am a retired science teacher, secondary level physics and chemistry (17-18 year old students). I studied chemistry in Ghent, but since my retirement I have become an electronics hobbyist. I am definitely not a programmer. My programming knowledge is actually too limited. I am mainly concerned with Arduino, Rpi, Node-Red, InfluxDB, Grafana. My intention is to process the SkyWeather2 JSON data file via MQTT in Node-Red and then create graphs in Grafana via InfluxDB. I find the graphs in the Skyweather dashboard not very successful. Are you experienced in transferring Skyweather data via MQTT to Node-Red?
Best regards Hervé
|
|
|
Post by Jason on Apr 7, 2021 10:05:33 GMT -8
Hello doxidad So old glories together! I am a retired science teacher, secondary level physics and chemistry (17-18 year old students). I studied chemistry in Ghent, but since my retirement I have become an electronics hobbyist. I am definitely not a programmer. My programming knowledge is actually too limited. I am mainly concerned with Arduino, Rpi, Node-Red, InfluxDB, Grafana. My intention is to process the SkyWeather2 JSON data file via MQTT in Node-Red and then create graphs in Grafana via InfluxDB. I find the graphs in the Skyweather dashboard not very successful. Are you experienced in transferring Skyweather data via MQTT to Node-Red? Best regards Hervé Check out the SwitchDoc Labs blog. They posted a video I made that walks through how I converted my SkyWeather2 to MQTT. Jason
|
|