[Gelöst] gplot Datei für mehrer Logs mit gleichem Aussehen erstellen

Begonnen von bendim, 22 September 2014, 22:08:56

Vorheriges Thema - Nächstes Thema

bendim

Hallo,
ich habe zwei LaCrosse Temperatur/Luftfeuchte Sensoren. Ich möchte gern eine gplot Datei als Template verwenden und zwei SVG ausgeben.
Wenn man das aussehen verändert muss man nur an einer Stelle die Änderung vornehmen und man hat nicht so viele gplot Dateien.

Den Titel habe ich schon mit <TL> an das title attribut gebunden um ihn variabel zu machen.
Welches Attribut muss ich setzen und wie verknüpfen <?> das ich die Datenquelle variabel machen kann?

fhem.cfg

define SVG_LaCr.Thermo01 SVG FileLog_LaCr.Thermo01:temp4hum6:CURRENT
attr SVG_LaCr.Thermo01 alias Thermo.Bad
attr SVG_LaCr.Thermo01 room Plots
attr SVG_LaCr.Thermo01 title "Bad: $data{currval1}°C [Min. $data{min1}°C, Max. $data{max1}°C] ØLuftfeuchte: $data{avg2}%"


temp4hum6.gplot

set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title '<TL>'
set ytics nomirror
set y2tics
set grid ytics
set ylabel "Temperatur (°C)"
set y2label "Luftfeuchte (%)"

#FileLog 4:LaCr.Thermo01.*:0:
#FileLog 6:LaCr.Thermo01.*:0:

plot "<IN>" using 1:2 axes x1y1 title 'Temp' ls l1 lw 1.5 with lines,\
     "<IN>" using 1:2 axes x1y2 title 'Luftfeuchte' ls l2 lw 1.5 with lines


justme1968

schau dir das plotfunction attribut an. das ist dafür gedacht.

gruß
  andre
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

bendim

Danke für die Antwort.
Leider komm ich nicht weiter. Ich habe das attr gesetzt.

attr SVG_LaCr.Thermo01 plotfunction 4:LaCr.Thermo01.*:0:

Leider finde ich nicht was ich für #FileLog 4:LaCr.Thermo01.*:0: ersetzen muss damit der den Inhalt von plotfunction nimmt. Könntest du mir da bitte noch einen Tipp geben?

justme1968

<SPEC1>

oder zum beispiel plotfunction auf   LaCr.Thermo01 und im  FileLog dann

#FileLog 4:<SPEC1>:0:

schau in der commandref unter SVG.

gruss
  andre
hue, tradfri, alexa-fhem, homebridge-fhem, LightScene, readingsGroup, ...

https://github.com/sponsors/justme-1968

bendim

Danke habs hin bekommen.

Hier die Lösung für die das gleiche vorhaben.

fhem.cfg

define LaCr.Thermo01 LaCrosse 3D
attr LaCr.Thermo01 IODev JeeLinkLaCrosse
attr LaCr.Thermo01 alias Thermo.Bad
attr LaCr.Thermo01 doDewpoint 1
attr LaCr.Thermo01 event-min-interval humidity:180,state:180,temperature:180
attr LaCr.Thermo01 event-on-change-reading battery
attr LaCr.Thermo01 event-on-update-reading humidity,state,temperature
attr LaCr.Thermo01 group Temperaturen
attr LaCr.Thermo01 icon scene_bath
attr LaCr.Thermo01 room Plots

define FileLog_LaCr.Thermo01 FileLog ./log/LaCr.Thermo01-%Y.log LaCr.Thermo01:T:.*
attr FileLog_LaCr.Thermo01 logtype temp4hum6:Temp/Hum,text
attr FileLog_LaCr.Thermo01 room Plots

define SVG_LaCr.Thermo01 SVG FileLog_LaCr.Thermo01:temp4hum6:CURRENT
attr SVG_LaCr.Thermo01 alias Thermo.Bad
attr SVG_LaCr.Thermo01 plotfunction 4:LaCr.Thermo01.*:0: 6:LaCr.Thermo01.*:0:
attr SVG_LaCr.Thermo01 room Plots
attr SVG_LaCr.Thermo01 title "Bad: $data{currval1}°C [Min. $data{min1}°C, Max. $data{max1}°C] ØLuftfeuchte: $data{avg2}%"


temp4hum6.gplot

# Created by FHEM/98_SVG.pm, 2014-09-22 18:14:44
set terminal png transparent size <SIZE> crop
set output '<OUT>.png'
set xdata time
set timefmt "%Y-%m-%d_%H:%M:%S"
set xlabel " "
set title '<TL>'
set ytics nomirror
set y2tics
set grid ytics
set ylabel "Temperatur (°C)"
set y2label "Luftfeuchte (%)"

#FileLog <SPEC1>
#FileLog <SPEC2>

plot "<IN>" using 1:2 axes x1y1 title 'Temperatur °C' ls l1 lw 1.5 with lines,\
     "<IN>" using 1:2 axes x1y2 title 'Luftfeuchte %' ls l2 lw 1.5 with lines