CCU Trend Diagramme (PNG) automatisch auf FTP Server sichern
Moderator: Co-Administratoren
CCU Trend Diagramme (PNG) automatisch auf FTP Server sichern
Hallo
ich möchte die Trend Diagramme alle 24 Stunden auf einen FTP Server sichern.
Wie kann ich das automatisieren ?
grüße saxbav
Ps. Proftp und CCU ist auf einen Raspberry Pi installiert.
ich möchte die Trend Diagramme alle 24 Stunden auf einen FTP Server sichern.
Wie kann ich das automatisieren ?
grüße saxbav
Ps. Proftp und CCU ist auf einen Raspberry Pi installiert.
Homematic System Stand[03.12.2019]
RaspberryMatic PI 3 , ioBroker PI 3 , ca 40 HM Geräte
2x Wemos d1 mini , 2 x Raspberry Octoprint , Shelly ...
-------------------------------
1x HM-CCU-1 schwarz ... in Rente
RaspberryMatic PI 3 , ioBroker PI 3 , ca 40 HM Geräte
2x Wemos d1 mini , 2 x Raspberry Octoprint , Shelly ...
-------------------------------
1x HM-CCU-1 schwarz ... in Rente
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
Ich habe hier (https://leinich.net/pages/391) mal ein Sktipt erstellt, dass periodisch aufgerufen werden kann und Graphen in einem Verzeichnis zwischenspeichert.
Das müsste man nur den Befehl verschieben (mv) durch einen FTP Upload zu ersetzen.
Das müsste man nur den Befehl verschieben (mv) durch einen FTP Upload zu ersetzen.
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
Danke das werde ich ich mir in einer ruhigen Stunde zu Gemüte führen.Ich habe hier (https://leinich.net/pages/391) mal ein Sktipt erstellt, dass periodisch aufgerufen werden kann und Graphen in einem Verzeichnis zwischenspeichert.
Das müsste man nur den Befehl verschieben (mv) durch einen FTP Upload zu ersetzen.
Was ich dort noch alles abändern muss.
Grüße saxbav
Homematic System Stand[03.12.2019]
RaspberryMatic PI 3 , ioBroker PI 3 , ca 40 HM Geräte
2x Wemos d1 mini , 2 x Raspberry Octoprint , Shelly ...
-------------------------------
1x HM-CCU-1 schwarz ... in Rente
RaspberryMatic PI 3 , ioBroker PI 3 , ca 40 HM Geräte
2x Wemos d1 mini , 2 x Raspberry Octoprint , Shelly ...
-------------------------------
1x HM-CCU-1 schwarz ... in Rente
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
Also irgendwie komm ich ihr nicht weiter.Ich habe hier (https://leinich.net/pages/391) mal ein Sktipt erstellt, dass periodisch aufgerufen werden kann und Graphen in einem Verzeichnis zwischenspeichert.
Das müsste man nur den Befehl verschieben (mv) durch einen FTP Upload zu ersetzen.
Den Skript habe ich folgend abgeändert
Code: Alles auswählen
#!/bin/sh
performcache(){
local url=$2
local name=$1
local now="$(date --rfc-3339=ns)"
echo $now - $name Starting
local start_time=`date +%s`
sudo wget -q -O "/opt/ccu-historian/webapp/cache/temp.png" "$url"
sudo mv /opt/ccu-historian/webapp/cache/temp.png /opt/ccu-historian/webapp/cache/${name}.png
local end_time=`date +%s` now=$(date --rfc-3339=ns)
echo $now - $name End with `expr $end_time - $start_time` sec
echo "\"${now}\";\"${name}\";\"`expr $end_time - $start_time`\"" >> /opt/ccu-historian/webapp/cache/protokol.csv
}
echo Start caching CCU-historian images
performcache temp_all_last_day "http://***:81/query/trend.gy?i=16&i=22&i=28&i=73&i=34&i=24&i=84&w=1600&h=700"
exit
Brauchen die auch noch irgend welche Rechte ?
Die Zeit Automatisierung(crontab -e) habe ich eingestellt.
Nur irgendwie passiert gar nicht.
Kann ich das irgend wo nach voll ziehen wo es hängt ?
grüße saxbav
Homematic System Stand[03.12.2019]
RaspberryMatic PI 3 , ioBroker PI 3 , ca 40 HM Geräte
2x Wemos d1 mini , 2 x Raspberry Octoprint , Shelly ...
-------------------------------
1x HM-CCU-1 schwarz ... in Rente
RaspberryMatic PI 3 , ioBroker PI 3 , ca 40 HM Geräte
2x Wemos d1 mini , 2 x Raspberry Octoprint , Shelly ...
-------------------------------
1x HM-CCU-1 schwarz ... in Rente
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
Ok, soweit so gut:
Jetzt musst du nur noch folgende Zeile anpassen:
Ein Upload kannst du z.B. mit folgendem Befehl machen
Jetzt musst du nur noch folgende Zeile anpassen:
Code: Alles auswählen
sudo mv /opt/ccu-historian/webapp/cache/temp.png /opt/ccu-historian/webapp/cache/${name}.png
Code: Alles auswählen
curl -T temp.png ftp://ftp.example.com --user user:passwort
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
So jetzt wird endlich die Grafik aller 15min automatisch erstellt.
Die csv Datei wird noch nicht erstellt. Weiß bis jetzt noch nicht warum
Möchte jetzt die Daten nicht mehr auf Server hoch laden.
Was muss ich in Skript schreiben damit die neu erstellte Datei temp_all_last_day.png
in einen Pfad kopiert wird zb /nas und die Aktuelle Datum/Zeit im Datei Namen angefügt wird. (zb. temp_all_last_day.20130706_1200.png)
grüße saxbav
Die csv Datei wird noch nicht erstellt. Weiß bis jetzt noch nicht warum
Möchte jetzt die Daten nicht mehr auf Server hoch laden.
Was muss ich in Skript schreiben damit die neu erstellte Datei temp_all_last_day.png
in einen Pfad kopiert wird zb /nas und die Aktuelle Datum/Zeit im Datei Namen angefügt wird. (zb. temp_all_last_day.20130706_1200.png)
grüße saxbav
Homematic System Stand[03.12.2019]
RaspberryMatic PI 3 , ioBroker PI 3 , ca 40 HM Geräte
2x Wemos d1 mini , 2 x Raspberry Octoprint , Shelly ...
-------------------------------
1x HM-CCU-1 schwarz ... in Rente
RaspberryMatic PI 3 , ioBroker PI 3 , ca 40 HM Geräte
2x Wemos d1 mini , 2 x Raspberry Octoprint , Shelly ...
-------------------------------
1x HM-CCU-1 schwarz ... in Rente
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
Hallo,
habe jetzt raus gefunden das ich noch irgendwo einen Fehler im Script habe .
Er bringt folgende Fehler.
root@raspberrypi:/opt/ccu-historian# sh ccu-historian
Start caching CCU-historian images
2013-08-03 06:51:33.971829550+02:00 - temp_all_last_day Starting
ccu-historian: 10: local: 06:56:49.043171159+02:00: bad variable name
grüße saxbav
habe jetzt raus gefunden das ich noch irgendwo einen Fehler im Script habe .
Er bringt folgende Fehler.
root@raspberrypi:/opt/ccu-historian# sh ccu-historian
Start caching CCU-historian images
2013-08-03 06:51:33.971829550+02:00 - temp_all_last_day Starting
ccu-historian: 10: local: 06:56:49.043171159+02:00: bad variable name
Code: Alles auswählen
#!/bin/sh
performcache(){
local url=$2
local name=$1
local now="$(date --rfc-3339=ns)"
echo $now - $name Starting
local start_time=`date +%s`
sudo wget -q -O "/opt/ccu-historian/webapp/cache/temp.png" "$url"
sudo mv /opt/ccu-historian/webapp/cache/temp.png /opt/ccu-historian/webapp/1/${name}.png
local end_time=`date +%s` now=$(date --rfc-3339=ns)
echo $now - $name End with `expr $end_time - $start_time` sec
echo "\"${now}\";\"${name}\";\"`expr $end_time - $start_time`\"" >> /opt/ccu-historian/webapp/cache/protokol.csv
}
echo Start caching CCU-historian images
performcache temp_all_last_day "http://***/query/trend.gy?i=16&i=22&i=28&i=73&i=34&i=24&i=84&w=1600&h=700"
exit
Homematic System Stand[03.12.2019]
RaspberryMatic PI 3 , ioBroker PI 3 , ca 40 HM Geräte
2x Wemos d1 mini , 2 x Raspberry Octoprint , Shelly ...
-------------------------------
1x HM-CCU-1 schwarz ... in Rente
RaspberryMatic PI 3 , ioBroker PI 3 , ca 40 HM Geräte
2x Wemos d1 mini , 2 x Raspberry Octoprint , Shelly ...
-------------------------------
1x HM-CCU-1 schwarz ... in Rente
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
Den Fehler habe ich jetzt gefunden.2013-08-03 06:51:33.971829550+02:00 - temp_all_last_day Starting
ccu-historian: 10: local: 06:56:49.043171159+02:00: bad variable name
In der Zeile haben die " " gefehlt
now="$(date --rfc-3339=ns)"
Aber wie muss ich den Skript schreiben damit die neu erstellte Datei temp_all_last_day.png
in einen Pfad kopiert wird zb /nas und das Aktuelle Datum/Zeit im Datei Namen angefügt wird. (zb. temp_all_last_day.20130706_1200.png)
grüße saxbav
Homematic System Stand[03.12.2019]
RaspberryMatic PI 3 , ioBroker PI 3 , ca 40 HM Geräte
2x Wemos d1 mini , 2 x Raspberry Octoprint , Shelly ...
-------------------------------
1x HM-CCU-1 schwarz ... in Rente
RaspberryMatic PI 3 , ioBroker PI 3 , ca 40 HM Geräte
2x Wemos d1 mini , 2 x Raspberry Octoprint , Shelly ...
-------------------------------
1x HM-CCU-1 schwarz ... in Rente
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
in etwa so
Code: Alles auswählen
...
jetzt=$(date '+%Y%m%d%H%M%S')
echo $jetzt
sudo mv /opt/ccu-historian/webapp/cache/temp.png /opt/ccu-historian/webapp/1/${name}.${jetzt}.png
...
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
Danke
habe mir es auch noch etwas angepasst.
Damit ich die Originale Datei ohne Probleme in die Homepage einbinden kann.
habe mir es auch noch etwas angepasst.
Damit ich die Originale Datei ohne Probleme in die Homepage einbinden kann.
Code: Alles auswählen
jetzt=$(date '+%Y%m%d%H%M%S')
echo $jetzt
sudo cp /opt/ccu-historian/webapp/cache/temp.png /var/www/ccu.grafiken/${name}.${jetzt}.png
sudo mv /opt/ccu-historian/webapp/cache/temp.png /var/www/ccu.grafiken/${name}.png
Homematic System Stand[03.12.2019]
RaspberryMatic PI 3 , ioBroker PI 3 , ca 40 HM Geräte
2x Wemos d1 mini , 2 x Raspberry Octoprint , Shelly ...
-------------------------------
1x HM-CCU-1 schwarz ... in Rente
RaspberryMatic PI 3 , ioBroker PI 3 , ca 40 HM Geräte
2x Wemos d1 mini , 2 x Raspberry Octoprint , Shelly ...
-------------------------------
1x HM-CCU-1 schwarz ... in Rente