Page 1 of 1

Ver 4.4 new functionality plugin

Posted: Mon Sep 14, 2020 9:43 pm
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?

Re: Ver 4.4 new functionality plugin

Posted: Tue Sep 15, 2020 10:25 am
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

Re: Ver 4.4 new functionality plugin

Posted: Tue Sep 15, 2020 3:01 pm
by Tman
Thnx, will study.

Re: Ver 4.4 new functionality plugin

Posted: Tue Sep 15, 2020 5:49 pm
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 ;-)

Re: Ver 4.4 new functionality plugin

Posted: Tue Sep 15, 2020 7:11 pm
by Tman
Acknowledged

Re: Ver 4.4 new functionality plugin

Posted: Wed Sep 16, 2020 7:06 am
by Tman
Thanks for pointing to right direction. Got it up and running :D

Re: Ver 4.4 new functionality plugin

Posted: Wed Sep 16, 2020 10:48 pm
by admin
Would you like to share your plugin code? Might be helpful for other users...

Re: Ver 4.4 new functionality plugin

Posted: Thu Sep 17, 2020 6:43 am
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

Re: Ver 4.4 new functionality plugin

Posted: Sat Sep 19, 2020 6:11 pm
by admin
Thanks for sharing!