Comments (12)
can you show me an example?
I have no zero in front?
pi@rp4:~ $ mi600 ip admin pw webdata_now_p
472
pi@rp4:~ $ mi600 ip admin pw webdata_total_e
718.5
pi@rp4:~ $ mi600 ip admin pw webdata_today_e
2.10
from mi600.
soory my mistake also Space at end for wedata_now_p
but more simple because no floating point
root@DietPi:~# bash auslesen
!211 !
!211!
#request value
ACTUAL=$(/usr/local/bin/mi600 $host_pv $user $password webdata_now_p)
#remove Space at End
echo "!"$ACTUAL"!"
ACTUAL_NUM=$(($ACTUAL))
echo "!"$ACTUAL_NUM"!"
webdatal_total_e
also Space at end but more comlicate because of floating point
from mi600.
I also check if Webdata_total_e is 0.0 than Inverter not ready but ist maybe not for you
because i know my inverter has more than 0.0
but new inverter i think is over comlicate to check if 0.0 is really the first value or inverter is not ready
from mi600.
is my last commit ok now?
from mi600.
looks good but Space not solve
it also get worst
mi600 now webdata_now_p has a .0 part (floating point)
uninstall and rm-r
root@DietPi:~# git clone https://github.com/dr-ni/mi600.git
Klone nach 'mi600' ...
remote: Enumerating objects: 163, done.
remote: Counting objects: 100% (163/163), done.
remote: Compressing objects: 100% (119/119), done.
remote: Total 163 (delta 84), reused 61 (delta 24), pack-reused 0
Empfange Objekte: 100% (163/163), 28.61 KiB | 1.43 MiB/s, fertig.
Lรถse Unterschiede auf: 100% (84/84), fertig.
root@DietPi:~# cd mi600
root@DietPi:~/mi600# make install
install -d /usr/local/man/man1
install -m 0755 mi600 /usr/local/bin
install -m 0644 README.md /usr/share/doc/mi600
install -m 0644 LICENSE /usr/share/doc/mi600
install -m 0644 man/man1/mi600.1 /usr/local/man/man1
root@DietPi:~/mi600# cd ..
root@DietPi:~# bash auslesen
!0 !
!0!
space still there
root@DietPi:~# bash auslesen
!18.0 !
!18.0!
from mi600.
should be ok now, can you check it again?
from mi600.
sorry but still space at the end but floating point is now gone for wedata_now_p
root@DietPi:~# bash auslesen
!213 !
!213!
#request value
ACTUAL=$(/usr/local/bin/mi600 $host_pv $user $password webdata_now_p)
echo "!"$ACTUAL"!"
#remove space at end
#ACTUAL_NUM=$(($ACTUAL))
ACTUAL_NUM=$(echo
echo "!"$ACTUAL_NUM"!"
from mi600.
I do not have any spaces?
can you please check this directly without your script and post the response:
#!/bin/bash
#
# mi600
# MIT License Copyright (c) 2022 dr-ni
# https://github.com/dr-ni/mi600
#
# A simple bash command-line tool for direct solar data requests
# to the inverter Bosswerk mi600.
# It can read the actual solar power and the cumulative daily earned energy.
#
# Requirements: curl must be installed.
#
#
host=$1
auth=$2:$3
dat=webdata_now_p
val=''
# option check
if [ $# -lt 3 ]
then
echo "Usage: $0 <host> <username> <password> [<type>] [-u]"
echo "Valid types can be found in man page: 'man mi600'"
echo "Option '-u': show unit"
exit 1
fi
if [ $# -gt 3 ]
then
if [ "$4" == "-u" ]
then
dat=webdata_now_p
val=W
else
dat=$4
val=''
if [ "$5" == "-u" ]
then
[ "$dat" = "webdata_today_e" ] && val=kWh
[ "$dat" = "webdata_total_e" ] && val=kWh
[ "$dat" = "webdata_now_p" ] && val=W
fi
fi
fi
for i in 1 2 3
do
o=$(curl -s -u "$auth" "$host"/status.html | grep "$dat = " | awk -F '"' '{print $2}')
if [ "$o" != "" ]
then
if [[ "$dat" == "webdata_total_e" || "$dat" == "webdata_today_e" ]]
then
p=$(echo "scale=1; $o/1.0" | bc | tr -d ' ')
elif [ "$dat" == "webdata_now_p" ]
then
p=$(echo "$o" | tr -d ' ')
else
p=$(echo "$o")
fi
echo "+$p+ $val"
exit 0
fi
sleep 3
done
ping -c3 $host > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "mi600: could not read value"
else
echo "Error: connection to $host failed"
fi
exit 1
from mi600.
root@DietPi:~# mi600 192.168.xx admin xx webdata_now_p
196
correct no space
ACTUAL=$(/usr/local/bin/mi600 $host_pv $user $password webdata_now_p)
but thats simple parse/request why end space ?
from mi600.
the response should be +196+
please use the code above
./mi600 192.168.xx admin xx webdata_now_p
from mi600.
thanks
it is not your fault you could reverse the change because its some with parsing
from mi600.
maybe this helps
https://stackoverflow.com/questions/2003536/bash-why-is-echo-adding-extra-space
if all is ok now - please close this issue
from mi600.
Related Issues (5)
- Import to IOBROKER HOT 4
- Reduce number of curl HOT 7
- More comments and explanations HOT 2
- value without Unit HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mi600.