Please read the posts in the Announcements section about the current status of Cumulus development now that I have retired

Please read this post before posting

Latest Cumulus release v1.9.4 (build 1099) - Nov 28 2014
Latest Cumulus MX release - v3.0.0 build 3043 Jan 20 2017. See this post for download

RaspberryPi script to display weatherstation values via ssh - Version 1.7

Discussion of version 3 of Cumulus, which runs on Windows, Linux, and OS X. All Cumulus MX queries in here, please.
jank
Posts: 293
Joined: Sat Jun 13, 2015 5:57 pm
Weather Station: weatherstation
Operating System: Debian Wheezy
Location: Germany

RaspberryPi script to display weatherstation values via ssh - Version 1.7

Postby jank » Mon Jul 20, 2015 11:52 am

Hi all

New Version available 16.03.2017 - Added CumulusMX runtime into output
(This was an enhancement request by one user)

I did some further linux scripting and based on my CumulusMX Start-Stop-Restart Script, I have another one for you.
This Script will read some of the /data/ logfiles and display the current values on a SSH Command line.
The Script will read the most current values like: temperature,humidity, pressure..... and display these values in the SSH Session.
The Values are being updated in a 5 minute loop and the most current values will be compared with the values 15 minutes ago to find out, if values are increasing or decreasing.
Depending on this result, the colors of the values should change. Also todays min/max values will be displayed.
Should automatically detect your locale units (Fahrenheit or Celsius)

The script can be stopped by pressing CTRL+C

Instruction:

- Download the ZIP File from this post and transfer (Copy) it into the CumulusMX folder (FTP or WINSCP).
- Login to your Raspberry Pi as user pi using SSH and insert the commands in blue
- This script can also be downloaded directly when starting the CumulusMX Start|Stop Script with option -n

1. If not already unzipped: unzip cumulusnow_1.6.zip
2. Make the script executable: sudo chmod +x cumulusnow.sh
3. Start the script sudo ./cumulusnow.sh or /home/pi/CumulusMX/cumulusnow.sh
If you also have running the CumulusMX Start|Stop Script, you can download and start cumulusnow.sh with sudo /home/pi/CumulusMX/cumulusmx.sh -n
cumulusnow.jpg


Important: This script is not a replacement for Steve's great CumulusMX program. It will not work without a well configured ComulusMX and it will not show any current value, if CumulusMX is not running.
If you have any problems, please let me know.

cumulusnow_1.7.zip


V1.4: In Version prior 1.4 I mixed up UV Index and Radiation. This is fixed in V1.4
You do not have the required permissions to view the files attached to this post.
Last edited by jank on Thu Mar 16, 2017 9:27 am, edited 16 times in total.
Want to see your Station values on SSH? Cumulusnow http://sandaysoft.com/forum/viewtopic.php?f=27&t=14062
Want a Start|Stop|Restart Script for CumulusMX on RaspberryPi? cumulusmx.sh http://sandaysoft.com/forum/viewtopic.php?f=27&t=13767

jank
Posts: 293
Joined: Sat Jun 13, 2015 5:57 pm
Weather Station: weatherstation
Operating System: Debian Wheezy
Location: Germany

Re: RaspberryPi script to display weatherstation values via

Postby jank » Mon Jul 20, 2015 11:54 am

Hello Steve

I hope it is okay, if I am placing CumulusMX related Scripts here into your Forum ?
Jan
Want to see your Station values on SSH? Cumulusnow http://sandaysoft.com/forum/viewtopic.php?f=27&t=14062
Want a Start|Stop|Restart Script for CumulusMX on RaspberryPi? cumulusmx.sh http://sandaysoft.com/forum/viewtopic.php?f=27&t=13767

User avatar
steve
Cumulus Author
Posts: 26314
Joined: Mon Jun 02, 2008 6:49 pm
Weather Station: None
Operating System: None
Location: On tour in Portugal
Contact:

Re: RaspberryPi script to display weatherstation values via

Postby steve » Mon Jul 20, 2015 11:55 am

Yes, that's fine - thanks.
Steve
-----
Hosting available for Cumulus web sites. See http://sandaysoft.com/forum/viewtopic.php?f=2&t=11876

Please read the posts in the Announcements section about the current status of Cumulus development since I have retired from my day job

User avatar
pete_c
Posts: 228
Joined: Wed Oct 12, 2011 11:22 pm
Weather Station: Davis Vue-Pro2 - Fine Offset
Operating System: W2003-XPSP3-Linux
Location: Time Traveler

Re: RaspberryPi script to display weatherstation values via

Postby pete_c » Thu Jul 23, 2015 3:59 pm

Very nice Jank!!!

Testing your script here now. Here my CumulusMX is located in the root drive of the RPi2.

Here doing automation software on another RPi2.

I can today run CumulusMX and the automation software on the same RPi2.

IE: /CumulusMX

Changed these lines to show:

Code: Select all

#!/bin/bash
export LANG=en_US.UTF-8
#Version 1.0 - 20.07.2015
# playing updated - 23.07.2015 - modded lines 1-13

LOOP=5 #Reload time in Minutes
echo ".....please be patient. Collecting some initial information....."

if [ ! -f "/CumulusMX/CumulusMX.exe" ];then
      INSTPATH=$(sudo find / -path "/mnt/*" -prune -o -type d -name "CumulusMX" -print |head -n1) > /dev/null
    else
      INSTPATH="/CumulusMX/"
fi


Not working yet and wondering if there are some more static lines that I need to change?

This is what I see right now without or with the modifications using Putty from a Wintel machne.

./cumulusnow.sh: line 72: [: 23/07/1510:40,838,48,62.0,1.8,5.0,190,0.00,0.00,29.985,13.04,70.3,52,2.0,83.8,84.5,0.0,0,0.000,0.000,86.8,808,0.0,204,0.00,0.00: integer expression expected
You do not have the required permissions to view the files attached to this post.
- Pete

http://longboatkey.golffan.us/ - Fine Offset

http://BrokenArrow.golffan.us/ - Davis Vantage Vue / Pro2 - Cumulus MX

jank
Posts: 293
Joined: Sat Jun 13, 2015 5:57 pm
Weather Station: weatherstation
Operating System: Debian Wheezy
Location: Germany

Re: RaspberryPi script to display weatherstation values via

Postby jank » Fri Jul 24, 2015 1:52 pm

Hello Pete

thank you for trying out my small Script........
...and, why is my language/locales so different from yours ? :bash:

.....but, there is always something I can improve......so here are the facts.
The script is start failing in the very beginning.
When I was trying to find out, what is the most current CumulusMX Logfile I am using this Command

ls -t /CumulusMX/data/*log.txt | head -1 |xargs tail -n1 |cut -d ";" -f1

This Command will list all Logfiles in the data folder, Sort is by Data and the
.log file on top of the list is the most current Logfile. --> ls -t /CumulusMX/data/*log.txt
Than I am going down to the last line in this log --> xargs tail -n1
...and the Date Info is the first value in this line. and the values are seperated by Semicolon ---> cut -d ";" -f1
But, only my german locale seem to use the semicolon seperator

24.07.15;15:35;27,4;50;16,1;11;29;106;0,0;0,0;1009,1;1244,7;25,5;52;29;27,4;27,8;0,0;0;0,00;0,00;27,4;1003;0,0;112;0,0;0,0

But yours, I think english locale is using comma as a seperator. (Based on your Screenshot)

Anyway, I am able to find out which locale is being used, so I need to modify the script by finding out, what seperators are being used by people to automatically use the seperator for each locale.

Pete, I am sorry, currently this scirpt is only being usable by Germans.......I will modify it as soon as possible.

By the way, are you able to send me your July Logfile (/data/Jul15log.txt) that I am able to test on it?
I am sure, if you zip it, it should be small enough.

Thanks for your testing
Jan
Want to see your Station values on SSH? Cumulusnow http://sandaysoft.com/forum/viewtopic.php?f=27&t=14062
Want a Start|Stop|Restart Script for CumulusMX on RaspberryPi? cumulusmx.sh http://sandaysoft.com/forum/viewtopic.php?f=27&t=13767

jank
Posts: 293
Joined: Sat Jun 13, 2015 5:57 pm
Weather Station: weatherstation
Operating System: Debian Wheezy
Location: Germany

Re: RaspberryPi script to display weatherstation values via

Postby jank » Sat Jul 25, 2015 10:50 am

Pete

as I mentioned in my last post, it was my fault that the script is not working in any other language than mine :-)
I looked into my german logfiles and I have ";" as a delimiter, but most of the other countries are having "," as a delimiter.
In the first post, there is a fixed verion which now should work for you and all other languages.

I fixed the problem now by looking into the most current CumulusMX/data/Jul15log.txt logfile and searching for the 9th character in the first line which is the delimiter which is seperating the date from the time.
This is how I try to find out, what's your delimiters.

Regarding the first 13 lines you changed.....I think you don't need to modify anything here, because ...... ( I will explain how I get the install path of CumulusMX)

if [ ! -f "/home/pi/CumulusMX/CumulusMX.exe" ];then (If CumulusMX.exe can not be found in the location most users are using (/home/pi/CumulusMX) then)
INSTPATH=$(sudo find / -path "/mnt/*" -prune -o -type d -name "CumulusMX" -print |head -n1) > /dev/null (I am searching on the complete RaspberryPi for a folder called CumulusMX)
else
INSTPATH="/home/pi/CumulusMX/"
fi

So normally, It should find the CumulusMX folder also, if you have installed it directly in the root (I did the same on my RaspberryPi)
So nothing to change by your side....the script should run without modifying anything.
The only Parameter which might be changed (if you like) is the Loop interval which is currently 5 Minutes until the script will read new values.

Please test the script again and let me know if it is working for you.
thanks Jan
Want to see your Station values on SSH? Cumulusnow http://sandaysoft.com/forum/viewtopic.php?f=27&t=14062
Want a Start|Stop|Restart Script for CumulusMX on RaspberryPi? cumulusmx.sh http://sandaysoft.com/forum/viewtopic.php?f=27&t=13767

User avatar
pete_c
Posts: 228
Joined: Wed Oct 12, 2011 11:22 pm
Weather Station: Davis Vue-Pro2 - Fine Offset
Operating System: W2003-XPSP3-Linux
Location: Time Traveler

Re: RaspberryPi script to display weatherstation values via

Postby pete_c » Sun Jul 26, 2015 9:17 pm

Hello Jan.

Thank-you for providing the SSH script to the Cumulus community.

I am using the RPi2 close to Chicago here.

Yup; here installed CumulusMx in the root directory. (well recently on another RPi2 testing automation software which I installed to the root directory).

I think I did this to mostly just save typing time.

I see the first post has been updated with most current version of the script so will download it and give it a try.

Please test the script again and let me know if it is working for you.


I will test the script again and let you know if it is working for me.
- Pete

http://longboatkey.golffan.us/ - Fine Offset

http://BrokenArrow.golffan.us/ - Davis Vantage Vue / Pro2 - Cumulus MX

User avatar
pete_c
Posts: 228
Joined: Wed Oct 12, 2011 11:22 pm
Weather Station: Davis Vue-Pro2 - Fine Offset
Operating System: W2003-XPSP3-Linux
Location: Time Traveler

Re: RaspberryPi script to display weatherstation values via

Postby pete_c » Mon Jul 27, 2015 3:01 am

Hello Jan,

Script looks good. Thank you.

I did not change anything in lines #1 to #13.

Just see a couple of things which you will see in the attached JPG.

- date in US is presented as 07/26/15 versus 26/07/15

- Refressh ==> Refresh

- Min/Max Pressure is in % versus in - unless this is the way you want to present it.

- CPU Temperature is 33.6'C instead of 33.6 °C

Very nice.

cumulusnow.jpg
You do not have the required permissions to view the files attached to this post.
- Pete

http://longboatkey.golffan.us/ - Fine Offset

http://BrokenArrow.golffan.us/ - Davis Vantage Vue / Pro2 - Cumulus MX

jank
Posts: 293
Joined: Sat Jun 13, 2015 5:57 pm
Weather Station: weatherstation
Operating System: Debian Wheezy
Location: Germany

Re: RaspberryPi script to display weatherstation values via

Postby jank » Mon Jul 27, 2015 1:46 pm

Hello Pete, thank you very much for helping me, finding some of the bugs.

pete_c wrote:Just see a couple of things which you will see in the attached JPG.

- date in US is presented as 07/26/15 versus 26/07/15

This is the way, Steve logs the date into the Logfiles
use this command to check it: ls -t /CumulusMX/data/*log.txt | head -1 |xargs tail -n1
pete_c wrote: - Refressh ==> Refresh
Fixed

pete_c wrote: - Min/Max Pressure is in % versus in - unless this is the way you want to present it.
----> Percentage makes no sense :-) Fixed

pete_c wrote:- CPU Temperature is 33.6'C instead of 33.6 °C
This is just how Raspbian write it into a system file I am reading.
The Command is:

vcgencmd measure_temp
I am only removing the text in front of the temperature with: vcgencmd measure_temp | cut -d= -f2

but now I changed it to: vcgencmd measure_temp | cut -d= -f2 |cut -c -4 and added °C into my text.
Unfrtunately, this temperature will only be logged in Celsius and not in Fahrenheit. And, wihthout an additional program it's not easy to convert Celsius into Fahrenheit (bc command seem to be needed.

Pete, I say thank you very much again......a fixed Version is again in the first post.
Want to see your Station values on SSH? Cumulusnow http://sandaysoft.com/forum/viewtopic.php?f=27&t=14062
Want a Start|Stop|Restart Script for CumulusMX on RaspberryPi? cumulusmx.sh http://sandaysoft.com/forum/viewtopic.php?f=27&t=13767

User avatar
pete_c
Posts: 228
Joined: Wed Oct 12, 2011 11:22 pm
Weather Station: Davis Vue-Pro2 - Fine Offset
Operating System: W2003-XPSP3-Linux
Location: Time Traveler

Re: RaspberryPi script to display weatherstation values via

Postby pete_c » Mon Jul 27, 2015 6:31 pm

Hello Jan,

Thank you!

Yup; here typically monitor CPU temps in C only.

BTW noticed you have installed CumulusMX on a quad core arm based little computer.

Here while still playing with the RPi's have started to play with a tiny Intel Baytrail computer called the PiPoX7.

It runs Ubuntu 64 bit pretty fast and comes stock with 2Gb of Ram and motherboard includes WLAN, NIC and Bluetooth plus it comes with 32Gb MMC and I have added another 32Gb of OS disk space.
- Pete

http://longboatkey.golffan.us/ - Fine Offset

http://BrokenArrow.golffan.us/ - Davis Vantage Vue / Pro2 - Cumulus MX

jank
Posts: 293
Joined: Sat Jun 13, 2015 5:57 pm
Weather Station: weatherstation
Operating System: Debian Wheezy
Location: Germany

Re: RaspberryPi script to display weatherstation values via

Postby jank » Mon Jul 27, 2015 7:04 pm

Hi Pete

Pipo X7 - Super energy efficient...indeed, I am looking for such a kind of computer to move my Windows 2003 Server which is currently hosting a MailServer to a more efficient device.
This looks promising......but I think, this is too much for a simple Weatherstation Software......a Raspberry Pi / BananaPi is a very good choice for Cumulus MX

Btw: here is a photo of my Bananapi.
Bananapi.jpg


...which is currently my most important Server in my Home Network.....I know, I am crazy to trust such a device and I am not sure, what happens to me, when this device crashes.
It is my: Squid Proxy, Apache Webserver with MYSQL, Owncloud Server, OpenVPN Server, Pyload, Sabnzbd, DNS Server .....and CumulusMX Test Server.......
Maybe, migrating to a device like Pipo X7 is more secure :-)

Jan
You do not have the required permissions to view the files attached to this post.
Want to see your Station values on SSH? Cumulusnow http://sandaysoft.com/forum/viewtopic.php?f=27&t=14062
Want a Start|Stop|Restart Script for CumulusMX on RaspberryPi? cumulusmx.sh http://sandaysoft.com/forum/viewtopic.php?f=27&t=13767

User avatar
pete_c
Posts: 228
Joined: Wed Oct 12, 2011 11:22 pm
Weather Station: Davis Vue-Pro2 - Fine Offset
Operating System: W2003-XPSP3-Linux
Location: Time Traveler

Re: RaspberryPi script to display weatherstation values via

Postby pete_c » Mon Jul 27, 2015 7:24 pm

Very nice!

Here many boxes used to run Wintel Server. Switching mostly to Linux / BSD.

Currently testing the PiPoX7 as a console for automation with connectivity to a multitouch monitor and a Kinect for non touch input. Application running on device connects to the automation mothership running on Ubuntu 14.04.

Well that and now playing with the Amazon Echo stuff.
- Pete

http://longboatkey.golffan.us/ - Fine Offset

http://BrokenArrow.golffan.us/ - Davis Vantage Vue / Pro2 - Cumulus MX

User avatar
pete_c
Posts: 228
Joined: Wed Oct 12, 2011 11:22 pm
Weather Station: Davis Vue-Pro2 - Fine Offset
Operating System: W2003-XPSP3-Linux
Location: Time Traveler

Re: RaspberryPi script to display weatherstation values via

Postby pete_c » Tue Jul 28, 2015 9:11 pm

Hello Jan,

Wow....you have me looking at the Banana Pi - like that SATA port on it....

Ok tested the script. See you did the calculations on the top to convert termperature..

Here is what I saw the first time I ran the script.

Code: Select all

Linux ICS-Cumulus 3.18.11-v7+ #781 SMP PREEMPT Tue Apr 21 18:07:59 BST 2015 armv                                                                              7l
Last login: Tue Jul 28 15:43:38 2015 from 192.168.244.236
Uptime: 5 days 25 minutes
CPU Speed: 900 Mhz - Load Average: 1min 0% 5min 1% 15min 1% - Cores: 4
Free Memory: 881 Mb
Free Disk Space rootfs: 10G
SD Card: Written 5957M Read 0G
Network Traffic eth0: Sent 959.3 MiB Received 195.3 MiB
root@ICS-Cumulus:~# cd /CumulusMX
root@ICS-Cumulus:/CumulusMX# ./cumulusnow.sh
-bash: ./cumulusnow.sh: /bin/bash^M: bad interpreter: No such file or directory


Ok so I edited the top of the script (well I know I should not have) and saw this. (temperature conversion)

Code: Select all

#Version 1.2 - 27.07.2015

# tm=`/opt/vc/bin/vcgencmd measure_temp`
# tc=`echo $tm| cut -d '=' -f2 | sed 's/..$//'`
# tf=$(echo "scale=2;((9/5) * $tc) + 32" |bc)
# echo temp = $tc\°C \($tf\°F\)
# exit

LOOP=5 #Reload time in Minutes
echo ".....please be patient. Collecting some initial information....."

if [ ! -f "/CumulusMX/CumulusMX.exe" ];then
      INSTPATH=$(sudo find / -path "/mnt/*" -prune -o -type d -name "CumulusMX" -print |head -n1) > /dev/null
    else
      INSTPATH="/CumulusMX/"
fi



Code: Select all

root@ICS-Cumulus:/CumulusMX# ./cumulusnow.sh
temp = 34.7°C (94.46°F)


I then edited out the temperature conversion and got the following. (BTW see the percent sign for the Max PRESS.)
You do not have the required permissions to view the files attached to this post.
- Pete

http://longboatkey.golffan.us/ - Fine Offset

http://BrokenArrow.golffan.us/ - Davis Vantage Vue / Pro2 - Cumulus MX

jank
Posts: 293
Joined: Sat Jun 13, 2015 5:57 pm
Weather Station: weatherstation
Operating System: Debian Wheezy
Location: Germany

Re: RaspberryPi script to display weatherstation values via

Postby jank » Wed Jul 29, 2015 1:16 pm

pete_c wrote:Hello Jan,
Wow....you have me looking at the Banana Pi - like that SATA port on it....

Yes, thats the reason why I like the old BananaPi more than the new one. On the new BananaPi, they don't have the SATA Port anymore
pete_c wrote:Ok tested the script. See you did the calculations on the top to convert termperature..
Here is what I saw the first time I ran the script.

Code: Select all

root@ICS-Cumulus:/CumulusMX# ./cumulusnow.sh
-bash: ./cumulusnow.sh: /bin/bash^M: bad interpreter: No such file or directory


Ok so I edited the top of the script (well I know I should not have) and saw this. (temperature conversion)

Code: Select all

 tm=`/opt/vc/bin/vcgencmd measure_temp`
 tc=`echo $tm| cut -d '=' -f2 | sed 's/..$//'`
 tf=$(echo "scale=2;((9/5) * $tc) + 32" |bc)
 echo temp = $tc\°C \($tf\°F\)
 exit

Yes, this was my try to convert Celsius to Fahrenheit because the CPU temperature output only available in Celsius on th Raspberry Pi.
But I gave up because an additional command is needed to to a little bit math (bc) and I think the effort is too high, to let the script first install bc before it can be used.
I did something similar on my other Script (CumulusMX start Stop Script) but I think this is okay, because this one is doing a lot of more stuff than this small script.
I forgot to remove the "Temperature Conversion part" from the top of the script. Thanks for testing and letting me know.
pete_c wrote:I then edited out the temperature conversion and got the following. (BTW see the percent sign for the Max PRESS.)

Yes....it was a simple typo in a variable is wrote: %PRESS instead of $PRESS.
Please download the Version 1.3 in the first post one more time and test again.
It should be fixed now :-) and once again, sorry to all downloaders that I need 10 fixes before everyhting is okay :-)
Want to see your Station values on SSH? Cumulusnow http://sandaysoft.com/forum/viewtopic.php?f=27&t=14062
Want a Start|Stop|Restart Script for CumulusMX on RaspberryPi? cumulusmx.sh http://sandaysoft.com/forum/viewtopic.php?f=27&t=13767

User avatar
pete_c
Posts: 228
Joined: Wed Oct 12, 2011 11:22 pm
Weather Station: Davis Vue-Pro2 - Fine Offset
Operating System: W2003-XPSP3-Linux
Location: Time Traveler

Re: RaspberryPi script to display weatherstation values via

Postby pete_c » Tue Aug 04, 2015 8:49 am

Hello Jan,

All is working well now. Thank-you.

cumulusnow.jpg
You do not have the required permissions to view the files attached to this post.
- Pete

http://longboatkey.golffan.us/ - Fine Offset

http://BrokenArrow.golffan.us/ - Davis Vantage Vue / Pro2 - Cumulus MX


Return to “Cumulus MX”

Who is online

Users browsing this forum: No registered users and 9 guests