CCU Trend Diagramme (PNG) automatisch auf FTP Server sichern
Moderator: Co-Administratoren
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
ich versuche schon einige Zeit das den Code con https://leinich.net/pages/391 auf meinem Raspberry zum laufen zu bekommen.
Beim manuellem Start der Cache Datei kommt immer eine Fehlermeldung local:not in a function.
Es wird keine Datei angelegt.
Kann jemand einen Tipp geben woran das liegen könnte ?
Beim manuellem Start der Cache Datei kommt immer eine Fehlermeldung local:not in a function.
Es wird keine Datei angelegt.
Kann jemand einen Tipp geben woran das liegen könnte ?
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
Kann es sein dass du ein Debian Linux verwendest?jaysee hat geschrieben: Beim manuellem Start der Cache Datei kommt immer eine Fehlermeldung local:not in a function.
dash sollte local eigentlich können.
Folgende 2 Optionen fallen mir so spontan ein;
Option 1:
alle local einfach aus der sh Datei löschen
Option 2:
Die Zeilen entsprechend anpassen..
local variable=...
Wird zu
local variable; variable=...
Bin grad unterwegs und habe keinen Linux PC zum testen.
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
Vielen Dank für die HInweise! Ich bin zur Zeit noch am arbeiten und werde wohl erst heute Nacht dazu kommen das zu testen.
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
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"
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
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`\"" >> /var/www/ccu.grafiken/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"
performcache feuc_all_last_day "http://.../query/trend.gy?i=17&i=23&i=29&i=74&i=35&i=25&i=85&w=1600&h=700"
performcache temp_wohnzimmer_last_day "http://.../query/trend.gy?i=81&i=25&i=24&i=48&w=1600&h=700"
performcache temp_kueche_last_day "http://.../query/trend.gy?i=32&i=29&i=28&i=47&w=1600&h=700"
performcache temp_bad_last_day "http://.../query/trend.gy?i=18&i=17&i=16&i=50&w=1600&h=700"
performcache temp_schlafzimmer_last_day "http://.../query/trend.gy?i=8&i=35&i=34&i=49&w=1600&h=700"
exit
So läuft es bei mir auf Raspberry mit (Raspbian Debian Wheezy)
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,
kann mir jemand helfen dies auch auf einem Synology NAS und mit CCU Historian zum laufen zu bringen?
Freundlich Grüsst
flyword
kann mir jemand helfen dies auch auf einem Synology NAS und mit CCU Historian zum laufen zu bringen?
Freundlich Grüsst
flyword
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
Hier meine Code
Leider wird bei mir das Protokoll nicht gespeichert und nur die erste Zeile wird erfolgreich gespeichert, der Rest bzw. die weiteren Zeilen wird nicht gespeichert.
Manuelles ausführen:
FEHLER:
Jemand eine Idee?
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
sudo curl -T /opt/ccu-historian/webapp/cache/${name}.png ftp://ftp.DOMAIN.lu --user historian@DOMAIN.lu:PASSWORT
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 wetterstation_temp_day "http://localhost/query/trend.gy?i=20&d=1D"
performcache wetterstation_temp_week "http://localhost/query/trend.gy?i=20&d=1W"
performcache wetterstation_wind_day "http://localhost/query/trend.gy?i=24&d=1D"
performcache wetterstation_wind_week "http://localhost/query/trend.gy?i=24&d=1W"
performcache wetterstation_rain_day "http://localhost/query/trend.gy?i=22&d=1D"
performcache wetterstation_rain_week "http://localhost/query/trend.gy?i=22&d=1W" exit
Code: Alles auswählen
performcache wetterstation_temp_day "http://localhost/query/trend.gy?i=20&d=1D"
performcache wetterstation_temp_week "http://localhost/query/trend.gy?i=20&d=1W"
performcache wetterstation_wind_day "http://localhost/query/trend.gy?i=24&d=1D"
performcache wetterstation_wind_week "http://localhost/query/trend.gy?i=24&d=1W"
performcache wetterstation_rain_day "http://localhost/query/trend.gy?i=22&d=1D"
performcache wetterstation_rain_week "http://localhost/query/trend.gy?i=22&d=1W" exit
Code: Alles auswählen
performcache wetterstation_temp_week "http://localhost/query/trend.gy?i=20&d=1W"
performcache wetterstation_wind_day "http://localhost/query/trend.gy?i=24&d=1D"
performcache wetterstation_wind_week "http://localhost/query/trend.gy?i=24&d=1W"
performcache wetterstation_rain_day "http://localhost/query/trend.gy?i=22&d=1D"
performcache wetterstation_rain_week "http://localhost/query/trend.gy?i=22&d=1W" exit
Manuelles ausführen:
Code: Alles auswählen
pi@raspberrypi:/opt/ccu-historian $ sudo sh /opt/ccu-historian/ccu-cache
Start caching CCU-historian images
2018-02-01 18:30:36.938336201+01:00 - wetterstation_temp_day Starting
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 16540 0 0 100 16540 0 73633 --:--:-- --:--:-- --:--:-- 73839
/opt/ccu-historian/ccu-cache: 11: local: 18:30:38.698712537+01:00: bad variable name
Code: Alles auswählen
/opt/ccu-historian/ccu-cache: 11: local: 18:30:38.698712537+01:00: bad variable name
Zuletzt geändert von flyword am 02.02.2018, 07:41, insgesamt 1-mal geändert.
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
Ich habe den Fehler gefunden.
Bei der Zeile 11 fehlten " "
Von
zu
ändern.
Bei der Zeile 11 fehlten " "
Von
Code: Alles auswählen
local end_time=`date +%s` now=$(date --rfc-3339=ns)
Code: Alles auswählen
local end_time=`date +%s` now="$(date --rfc-3339=ns)"
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
sudo curl -T /opt/ccu-historian/webapp/cache/${name}.png ftp://ftp.DOMAIN.lu --user historian@DOMAIN.lu:PASSWORT
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 wetterstation_temp_day "http://localhost/query/trend.gy?i=20&d=1D"
performcache wetterstation_temp_week "http://localhost/query/trend.gy?i=20&d=1W"
performcache wetterstation_wind_day "http://localhost/query/trend.gy?i=24&d=1D"
performcache wetterstation_wind_week "http://localhost/query/trend.gy?i=24&d=1W"
performcache wetterstation_rain_day "http://localhost/query/trend.gy?i=22&d=1D"
performcache wetterstation_rain_week "http://localhost/query/trend.gy?i=22&d=1W" exit
Re: CCU Trend Diagramme (PNG) automatisch auf FTP Server sic
Coole Sache, DANKE
Ich reiche die Werte vom Pi an die CCU2 per XML weiter. CCU Historian habe ich sowieso im Einsatz, deshalb nun danke für den Tipp, wie ich das auf die Homepage bekomme!
Es sieht bei mir so aus.
http://webcam.traumgold.at/feinstaubwerte.html
LG, Andi
Ich reiche die Werte vom Pi an die CCU2 per XML weiter. CCU Historian habe ich sowieso im Einsatz, deshalb nun danke für den Tipp, wie ich das auf die Homepage bekomme!
Es sieht bei mir so aus.
http://webcam.traumgold.at/feinstaubwerte.html
LG, Andi