Vielen Dank, funktioniert ganz wunderbar!blueberry63 hat geschrieben: ↑Here we go:Ich würde mich sehr über das Script freuen, damit ich das für meine Bedürfnisse anpassen kann
Vielen Dank, funktioniert ganz wunderbar!blueberry63 hat geschrieben: ↑Here we go:Ich würde mich sehr über das Script freuen, damit ich das für meine Bedürfnisse anpassen kann
Sorry, ich hatte den Beitrag übersehen: JA, es funktioniert mit der PH2 Zoe.
Code: Alles auswählen
#!/bin/sh
OUTP=/home/pi/pyze/output_zoe #gewünschter Pfad der temporären Datei
mqtt_host=192.168.178.1 #ip-adresse vom mqtt broker
mqtt_port=1883 # Port vom Broker 1883 ist standard
#mqtt_main_topic=RenaultZoe (derzeit noch statisch, vielleicht modifiziert das ja jemand)
mqtt_user='username'
mqtt_pass='password'
/usr/local/bin/pyze status --km > $OUTP
#FHEM-Lösung von blueberry63
#Telnet aktivieren im global device
#perl /opt/fhem/fhem.pl 7072 "setreading myzoe BattLevel `awk ' { if ($1 == "Battery" && $2 == "level") print substr($0,23,3) ; }' $OUTP` "
#perl /opt/fhem/fhem.pl 7072 "setreading myzoe state `awk ' { if ($1 == "Battery" && $2 == "level") print substr($0,23,3) ; }' $OUTP` "
#perl /opt/fhem/fhem.pl 7072 "setreading myzoe Energy `awk ' { if ($1 == "Available" && $2 == "energy") print substr($0,23,5) ; }' $OUTP` "
#perl /opt/fhem/fhem.pl 7072 "setreading myzoe RangeEstKM `awk ' { if ($1 == "Range" && $2 == "estimate") print substr($0,23,5) ; }' $OUTP` "
#perl /opt/fhem/fhem.pl 7072 "setreading myzoe BattTemp `awk ' { if ($1 == "Battery" && $2 == "temperature") print substr($0,23,2) ; }' $OUTP` "
#perl /opt/fhem/fhem.pl 7072 "setreading myzoe TotalKM `awk ' { if ($1 == "Total" && $2 == "mileage") print substr($0,23,7) ; }' $OUTP` "
#perl /opt/fhem/fhem.pl 7072 "setreading myzoe LastUpdate `awk ' { if ($1 == "Updated" && $2 == "at") print substr($0,23,20) ; }' $OUTP` "
#MQTT-Lösung von electricschorsch
#vorher mosquitto_pub installieren mit apt-get install mosquitto-clients
mosquitto_pub -h $mqtt_host -p $mqtt_port -t Zoe/LastUpdate -u $mqtt_user -P $mqtt_pass -m "`awk '{if($1 == "Updated" && $2 =="at") print substr($0,23,20)}' $OUTP`"
mosquitto_pub -h $mqtt_host -p $mqtt_port -t Zoe/BattLevel -u $mqtt_user -P $mqtt_pass -m "`awk '{if($1 == "Battery" && $2 =="level") print substr($0,23,3)}' $OUTP`"
mosquitto_pub -h $mqtt_host -p $mqtt_port -t Zoe/state -u $mqtt_user -P $mqtt_pass -m "`awk '{if($1 == "Battery" && $2 =="level") print substr($0,23,3)}' $OUTP`"
mosquitto_pub -h $mqtt_host -p $mqtt_port -t Zoe/Energy -u $mqtt_user -P $mqtt_pass -m "`awk '{if($1 == "Available" && $2 =="energy") print substr($0,23,5)}' $OUTP`"
mosquitto_pub -h $mqtt_host -p $mqtt_port -t Zoe/RangeEstKM -u $mqtt_user -P $mqtt_pass -m "`awk '{if($1 == "Range" && $2 =="estimate") print substr($0,23,5)}' $OUTP`"
mosquitto_pub -h $mqtt_host -p $mqtt_port -t Zoe/BattTemp -u $mqtt_user -P $mqtt_pass -m "`awk '{if($1 == "Battery" && $2 =="temperature") print substr($0,23,2)}' $OUTP`"
mosquitto_pub -h $mqtt_host -p $mqtt_port -t Zoe/TotalKM -u $mqtt_user -P $mqtt_pass -m "`awk '{if($1 == "Total" && $2 =="mileage") print substr($0,23,7)}' $OUTP`"
rm $OUTP
Code: Alles auswählen
Error communicating with Renault API!
{"type":"FUNCTIONAL","messages":[{"code":"err.func.wired.not-found","message":"The specified url does not exist"}],"errors":[{"errorCode":"err.func.wired.not-found","errorMessage":"The specified url does not exist"}],"error_reference":"FUNCTIONAL"}
Code: Alles auswählen
"wiredProd": {
"target": "https://api-wired-prod-1-euw1.wrd-aws.com",
"apikey": "oF09WnKqvBDcrQzcW1rJNpjIuy7KdGaB"
},
"gigyaProd": {
"target": "https://accounts.eu1.gigya.com",
"apikey": "3_7PLksOyBRkHv126x5WhHb-5pqC1qFR8pQjxSeLB6nhAnPERTUlwnYoznHSxwX668"
}