Hallo zusammen,
ich möchte für die PV Anlage darstellen, wie gut Forecast und tatsächlicher Ertrag zusammenpassen.
Die Forecast Werte erhalte ich je Stunde in verschiedenen Readings.
Leider habe ich keine Ahnung, wie ich diese auf einer X-Achse darstellen kann, da diese meist die ReadingTime darstellt.
Im Beigefügten Screenshot sieht man Forecast Werte für die Uhrzeiten von 06:00 - 21:00
Diese möchte ich als einzelne Bars in einem Chart für den jeweiligen Tag darstellen.
Die Readings werden im Log gespeichert.
Ich bekomme stündliche Aktualisierungen (hier könnte entweder ein fixer Zeitpunkt gewählt werden, oder ein Mittelwert).
Später soll dann der tatsächliche Ertrag meiner Anlage gemalt werden.
Ich hoffe ich konnte mein Anliegen einigermaßen verständlich rüberbringen und ihr könnt mir helfen.
List des Device:
Internals:
API_LAST_MSG 200
API_LAST_RES 1659963600.15435
CFGFN
DEF https://api.forecast.solar/estimate/xxx/xxx/37/0/9.2
FUUID 62eff794-f33f-4184-8eb2-c90a82c036c29f24
NAME solarfcast
NEXT 2022-08-08 16:00:00
NR 545
SOURCE https://api.forecast.solar/estimate/xxxx/xxx/37/0/9.2 (200)
STATE 200
SVN 24783 2021-07-21 22:37:12 UTC
TYPE JsonMod
eventCount 133
CONFIG:
IN_REQUEST 0
SOURCE https://api.forecast.solar/estimate/xxx/xxx/37/0/9.2
SECRET:
OLDREADINGS:
READINGS:
2022-08-08 15:00:00 message.latitude xxxx
2022-08-08 15:00:00 message.limit 12
2022-08-08 15:00:00 message.longitude xxxx
2022-08-08 15:00:00 message.period 3600
2022-08-08 15:00:00 message.place xxxx
2022-08-08 15:00:00 message.remaining 10
2022-08-08 15:00:00 message.timezone Europe/Berlin
2022-08-08 15:00:00 message.type success
2022-08-08 15:00:00 today 2022-08-08
2022-08-08 15:00:00 tomorrow 2022-08-09
2022-08-08 15:00:00 watt_hours.today 64624
2022-08-08 15:00:00 watt_hours_tomorrow 65602
2022-08-08 15:00:00 watts.today.0600 413
2022-08-08 15:00:00 watts.today.0700 1303
2022-08-08 15:00:00 watts.today.0800 2753
2022-08-08 15:00:00 watts.today.0900 4310
2022-08-08 15:00:00 watts.today.1000 6092
2022-08-08 15:00:00 watts.today.1100 7313
2022-08-08 15:00:00 watts.today.1200 7751
2022-08-08 15:00:00 watts.today.1300 7417
2022-08-08 15:00:00 watts.today.1400 7310
2022-08-08 15:00:00 watts.today.1500 6762
2022-08-08 15:00:00 watts.today.1600 5590
2022-08-08 15:00:00 watts.today.1700 3992
2022-08-08 15:00:00 watts.today.1800 2335
2022-08-08 15:00:00 watts.today.1900 1018
2022-08-08 15:00:00 watts.today.2000 415
2022-08-08 15:00:00 watts.today.2100 0
2022-08-08 15:00:00 watts.tomorrow.0600 432
2022-08-08 15:00:00 watts.tomorrow.0700 1357
2022-08-08 15:00:00 watts.tomorrow.0800 2883
2022-08-08 15:00:00 watts.tomorrow.0900 4507
2022-08-08 15:00:00 watts.tomorrow.1000 5917
2022-08-08 15:00:00 watts.tomorrow.1100 7108
2022-08-08 15:00:00 watts.tomorrow.1200 7804
2022-08-08 15:00:00 watts.tomorrow.1300 8002
2022-08-08 15:00:00 watts.tomorrow.1400 7654
2022-08-08 15:00:00 watts.tomorrow.1500 6833
2022-08-08 15:00:00 watts.tomorrow.1600 5549
2022-08-08 15:00:00 watts.tomorrow.1700 3988
2022-08-08 15:00:00 watts.tomorrow.1800 2310
2022-08-08 15:00:00 watts.tomorrow.1900 1030
2022-08-08 15:00:00 watts.tomorrow.2000 441
2022-08-08 15:00:00 watts.tomorrow.2100 N/A
Attributes:
group Photovoltaik
readingList single(jsonPath('$.message.type'), 'message.type', 'N/A');
single(jsonPath('$.message[*].latitude'), 'message.latitude', 'N/A');
single(jsonPath('$.message[*].longitude'), 'message.longitude', 'N/A');
single(jsonPath('$.message[*].place'), 'message.place', 'N/A');
single(jsonPath('$.message[*].timezone'), 'message.timezone', 'N/A');
single(jsonPath('$.message[*].period'), 'message.period', 'N/A');
single(jsonPath('$.message[*].limit'), 'message.limit', 'N/A');
single(jsonPath('$.message[*].remaining'), 'message.remaining', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 06:00:00'), 'watts.today.0600', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 07:00:00'), 'watts.today.0700', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 08:00:00'), 'watts.today.0800', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 09:00:00'), 'watts.today.0900', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 10:00:00'), 'watts.today.1000', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 11:00:00'), 'watts.today.1100', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 12:00:00'), 'watts.today.1200', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 13:00:00'), 'watts.today.1300', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 14:00:00'), 'watts.today.1400', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 15:00:00'), 'watts.today.1500', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 16:00:00'), 'watts.today.1600', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 17:00:00'), 'watts.today.1700', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 18:00:00'), 'watts.today.1800', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 19:00:00'), 'watts.today.1900', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 20:00:00'), 'watts.today.2000', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time)).' 21:00:00'), 'watts.today.2100', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 06:00:00'), 'watts.tomorrow.0600', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 07:00:00'), 'watts.tomorrow.0700', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 08:00:00'), 'watts.tomorrow.0800', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 09:00:00'), 'watts.tomorrow.0900', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 10:00:00'), 'watts.tomorrow.1000', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 11:00:00'), 'watts.tomorrow.1100', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 12:00:00'), 'watts.tomorrow.1200', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 13:00:00'), 'watts.tomorrow.1300', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 14:00:00'), 'watts.tomorrow.1400', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 15:00:00'), 'watts.tomorrow.1500', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 16:00:00'), 'watts.tomorrow.1600', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 17:00:00'), 'watts.tomorrow.1700', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 18:00:00'), 'watts.tomorrow.1800', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 19:00:00'), 'watts.tomorrow.1900', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 20:00:00'), 'watts.tomorrow.2000', 'N/A');
single(jsonPath('$.result.watts.'.strftime("%F",localtime(time+24*60*60)).' 21:00:00'), 'watts.tomorrow.2100', 'N/A');
single(jsonPath('$.result.watt_hours_day.'.strftime("%F",localtime(time))), 'watt_hours.today', 'N/A');
single(jsonPath('$.result.watt_hours_day.'.strftime("%F",localtime(time+24*60*60))), 'watt_hours_tomorrow', 'N/A');
room PV-Anlage,Wetter
stateFormat {InternalVal($name,"API_LAST_MSG","N/A")}
update-on-start 1
userReadings today {
strftime("%F",localtime(time));
},
tomorrow {
strftime("%F",localtime(time+24*60*60));
}
verbose 5
Vielen Dank bereits
Hallo flipse,
bitte lesen:
https://wiki.fhem.de/wiki/SVG (https://wiki.fhem.de/wiki/SVG)
Im logfile-Device gibt es "Create SVG plot". Damit wird ein Diagramm der gespeicherten Readings dieses Logs erzeugt.
Wenn du erst ein SVG plot erstellst hast, dann kannst du andere logfiles sehr einfach zufügen. Bitte schau dir den Plot und alles, was dazu gehört an; es ist eigentlich ohne weitere Erklärung verständlich, was dann die nächsten Schritte sind.
Viele Grüße Gisbert
D.h. man braucht einen FileLog fuer diese Readings, z.Bsp. so:
define solarfcastLog FileLog log/solarfcast.%Y NONE readonly
Als Naechstes muss man diese Datei fuellen, z.Bsp. mit dem folgenden notify:
define solarfcastNtfy notify solarfcast:watt_hours.today.* {\
my @l;;\
for(my $i=6;; $i<=21;; $i++) {\
push @l, sprintf("%04d-%02d-%02d_%02d:00:00 solarfcast watts.today ",\
$year,$month, $mday, $i).\
ReadingsVal("solarfcast", "watts.today.".sprintf("%02d", $i)."00", 0);;\
}\
FileWrite({FileName=>"log/solarfcast.$year", ForceType=>1 }, @l);;\
}
Dieses notify reagiert, wenn watt_hours.today geaendert wird, und setzt voraus, dass dann die anderen Daten auch gesetzt sind.
Jetzt kann man das FileLog in einem SVG verwenden, entweder alleine (siehe Anhang), oder zusammen mit anderen FileLog-/DbLog Daten.
vielen vielen dank. hat mega gut funktioniert
Eine Frage habe ich dennoch.
Gibt es eine Möglichkeit auch Readings in der Zukunft anzeigen zu lassen?
Ich habe eine Voraussicht/Prognose für den Photovoltaikertrag des Folgetages.
Die Readings liegen alle korrekt vor, leider zeigt der Plot den Tag nicht an.
Readings im Log:
2022-08-09_06:00:00 solarfcast watts.forecast 392
2022-08-09_07:00:00 solarfcast watts.forecast 1220
2022-08-09_08:00:00 solarfcast watts.forecast 2620
2022-08-09_09:00:00 solarfcast watts.forecast 4153
2022-08-09_10:00:00 solarfcast watts.forecast 5471
2022-08-09_11:00:00 solarfcast watts.forecast 6416
2022-08-09_12:00:00 solarfcast watts.forecast 6966
2022-08-09_13:00:00 solarfcast watts.forecast 7839
2022-08-09_14:00:00 solarfcast watts.forecast 7355
2022-08-09_15:00:00 solarfcast watts.forecast 5843
2022-08-09_16:00:00 solarfcast watts.forecast 5571
2022-08-09_17:00:00 solarfcast watts.forecast 3159
2022-08-09_18:00:00 solarfcast watts.forecast 1725
2022-08-09_19:00:00 solarfcast watts.forecast 664
2022-08-09_20:00:00 solarfcast watts.forecast 261
2022-08-09_21:00:00 solarfcast watts.forecast N/A
2022-08-10_06:00:00 solarfcast watts.forecast 434
2022-08-10_07:00:00 solarfcast watts.forecast 1364
2022-08-10_08:00:00 solarfcast watts.forecast 2967
2022-08-10_09:00:00 solarfcast watts.forecast 4719
2022-08-10_10:00:00 solarfcast watts.forecast 5985
2022-08-10_11:00:00 solarfcast watts.forecast 6721
2022-08-10_12:00:00 solarfcast watts.forecast 7436
2022-08-10_13:00:00 solarfcast watts.forecast 7669
2022-08-10_14:00:00 solarfcast watts.forecast 7491
2022-08-10_15:00:00 solarfcast watts.forecast 6826
2022-08-10_16:00:00 solarfcast watts.forecast 5526
2022-08-10_17:00:00 solarfcast watts.forecast 3858
2022-08-10_18:00:00 solarfcast watts.forecast 2196
2022-08-10_19:00:00 solarfcast watts.forecast 936
2022-08-10_20:00:00 solarfcast watts.forecast 396
2022-08-10_21:00:00 solarfcast watts.forecast N/A
Vielen Dank
ZitatGibt es eine Möglichkeit auch Readings in der Zukunft anzeigen zu lassen?
Meines Wissens nur durch URL-Manipulation (off=1 statt -1)