Ver 4.4 new functionality plugin

This section covers the Meteobridge PRO, PRO2, NANO SD, Raspberry Pi and VM platforms exclusively

Moderator: Mattk

Post Reply
Tman
Junior Boarder
Junior Boarder
Posts: 23
Joined: Sun Aug 11, 2019 5:43 pm

Ver 4.4 new functionality plugin

Post by Tman »

I wonder what commands are supported by MB Pro firmware/bash.

I'm trying to download (with curl) json data and read it (with jq). Script works well with Linux. Any tutorial or alike available?
User avatar
Gyvate
Platinum Boarder
Platinum Boarder
Posts: 453
Joined: Thu May 14, 2020 4:36 pm
Location: Saarbrücken, Germany

Re: Ver 4.4 new functionality plugin

Post by Gyvate »

It's not bash here, it's ash :), sort of a "diet bash" :lol:
For commands, look (e.g.) https://www.lifewire.com/ash-linux-command-4095519
WH4000SE 1.6.6/1 x DP1500/4 x GW1000 1.7.7/GW1100 2.3.0/HP1000SE Pro 1.9.3//2 x WH2650 1.7.7/GW2000 3.1.0
2xMeteobridge Pro [B+R] 15161, 2xRPi4B-2GB/16/32 3139,VM128 1704
Weather Landing page: https://meshka.eu
Ecowitt WiKi: https://meshka.eu/Ecowitt/dokuwiki
Tman
Junior Boarder
Junior Boarder
Posts: 23
Joined: Sun Aug 11, 2019 5:43 pm

Re: Ver 4.4 new functionality plugin

Post by Tman »

Thnx, will study.
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: Ver 4.4 new functionality plugin

Post by admin »

ash is rather close to bash. So when you are familiar with bash you should find a way.
curl and jp are not there. You can work with wget and awk for grabbing data from the stream.

Please don't have the idea to install additional packages. This will fill your flash storage and operation will stop.
Just a warning as some user thought they can install stuff as on their regular PC and had a hard stop after that ;-)
Tman
Junior Boarder
Junior Boarder
Posts: 23
Joined: Sun Aug 11, 2019 5:43 pm

Re: Ver 4.4 new functionality plugin

Post by Tman »

Acknowledged
Tman
Junior Boarder
Junior Boarder
Posts: 23
Joined: Sun Aug 11, 2019 5:43 pm

Re: Ver 4.4 new functionality plugin

Post by Tman »

Thanks for pointing to right direction. Got it up and running :D
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: Ver 4.4 new functionality plugin

Post by admin »

Would you like to share your plugin code? Might be helpful for other users...
Tman
Junior Boarder
Junior Boarder
Posts: 23
Joined: Sun Aug 11, 2019 5:43 pm

Re: Ver 4.4 new functionality plugin

Post by Tman »

short and simple after some trial and error

Code: Select all

#!/bin/sh
#
#read solar and uv data from url file at json format
#download file from url
i=0
while true;
do
wget -q http://veikkola-saa.com/pws2/solardata.txt -O /tmp/mnt/data/scripts/solardata.txt
solar=$(awk -F, '{print $2}' /tmp/mnt/data/scripts/solardata.txt | cut -d':' -f 2)
uv=$(awk -F, '{print $3}' /tmp/mnt/data/scripts/solardata.txt | cut -d':' -f 2)
#awk -F tells to split with comma (,) take second/third dataset and then cut tells to take second part of string after :
#
  echo "uv0 $uv"
  sleep 2
  echo "sol0 $solar"
  sleep 180
done
User avatar
admin
Platinum Boarder
Platinum Boarder
Posts: 7854
Joined: Mon Oct 01, 2007 10:51 pm

Re: Ver 4.4 new functionality plugin

Post by admin »

Thanks for sharing!
Post Reply