Ich lasse meine PC Verfügbarkeitsabfrage in eine LOG Datei schreiben.
Die PC Verfügbarkeit wird durch Anwesend bzw. Abwesend dokumentiert.
Beispiel:
2013-02-16_14:44:39 PC.1 Anwesend
2013-02-16_14:45:38 PC.1 Anwesend
2013-02-16_14:46:39 PC.1 Anwesend
2013-02-16_14:47:44 PC.1 Abwesend
2013-02-16_14:48:39 PC.1 Abwesend
Wie nutze ich welche gplot Datei um die Anwesenheit bzw. Abwesenheit grafisch darzustellen.
Danke für Eure Hilfe
Gruß Klaus
mein log file hat das format:2013-01-09_00:10:51 iPhoneAndreI Anwesend
2013-01-09_00:15:51 xxxx Anwesend
2013-01-09_00:20:52 xxxx Abwesend
2013-01-09_00:25:52 xxxx Abwesend
2013-01-09_00:30:52 xxxx Abwesend
2013-01-09_00:35:52 xxxx Abwesend
und ich plotte es damit:############################
# Display the Anwesend and Abwesend values
# Corresponding FileLog definition:
# define anwesendlog FileLog /var/log/fhem/fs20dev-%Y-%U.log device
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 '<L1>'
set ytics ("Weg" 0, "Da" 1)
set y2tics ("Weg" 0, "Da" 1)
set yrange [-0.1:1.1]
set y2range [-0.1:1.1]
set ylabel "Status"
set y2label "Status"
#FileLog 3::0:$fld[2]=~"Anwesend"?1:0
plot "< awk '{print $1, $3~/Anwesend/? 1 : 0; }' <IN>"\
using 1:2 notitle with steps
gruss
andre
Danke, es funktioniert.
Gruß Klaus
Hallo Andre,
wenn im Log File folgender Eintrag stehen würde:
2013-02-16_14:44:39 PC.1 <span style=\"color:yellow\">Anwesend</span>
statt
2013-02-16_14:44:39 PC.1 Anwesend
Was müsste man in der gplot Datei ändern damit das gleiche Ergebnis heraus kommt?
Hinweis: Mit der farblichen Darstellung hat man eine bessere Übersicht der angemeldeten Geräte.
Gruß Klaus
versuch mal jeweils ein .* vor und nach dem Anwesend.
aber warum schreibst du die farben mit ins log file? das bläst es nur unnötig auf.
wenn es um die farben im web frontend geht nimm stateFormat zum einfärben. also etwa so:<span style="color:yellow">state</span>
für eine statische farbe, ansonsten bastle dir was mit {} das ausgewertet wird. z.b. so:{my $state=ReadingsVal("xxxx","state",""); my $color = 'red';if($state eq "Anwesend"){ $color='green';} sprintf('<span style="color:%s">%s</span>',$color,$state)}
ansonsten hab ich icons stat dem text. das ist noch besser als farbiger text finde ich. also etwas in der art:attr devStateIcon Anwesend:HOME_Status.1 Abwesend:HOME_Status.3
gruss
andre
Hallo Andre,
danke für die ausfühlichen Beispiele.
Habe das mit den Icons eingesetzt :-)
Gruß Klaus