SVG: Unterschied zwischen den Versionen

Aus FHEMWiki
(cat)
(Beispiel für plotReplace eingebaut)
Zeile 21: Zeile 21:


== Beispiele ==
== Beispiele ==
=== Temperatur- und Heizungsdaten eines Zimmers ===
Quelle: {{Link2Forum|Topic=104935|Message=1011527}}
(Datenquelle ist ein DBLog-Device namens LogDB):
[[Datei:PlotReplace Example DBLog.png|thumb|right|300px]]
<source># Created by FHEM/98_SVG.pm, 2020-01-06
# to replace variables, use plotReplace like
# attr SVG_Thermostat plotReplace SPEC1=Thermostat TL="My example thermostat" EXTERNALTEMPDEVICE=MYSENSOR_97 EXTERNALTEMPREADING=temperature2 \
# ROOMHUMIDITYDEVICE=HUEDevice3 EXTERNALHUMIDITYREADING=humidity ROOMTEMPDEVICE=HUEDevice4 ROOMTEMPREADING=temperature WINDOW1=Window1_MyRoom WINDOW2=Window2_MyRoom
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
set y2tics
set grid
set ylabel "Valve/Window"
set y2label "Temperature"
set yrange [-5:105]
set y2range [-15:35]
set isosample 20
#LogDB %SPEC1%:desired-temp::
#LogDB %SPEC1%:measured-temp:0:
#LogDB %EXTERNALTEMPDEVICE%:%EXTERNALTEMPREADING%::
#LogDB %SPEC1%:actuator:0:int
#LogDB %ROOMHUMIDITYDEVICE%:%EXTERNALHUMIDITYREADING%:0:
#LogDB %ROOMTEMPDEVICE%:%ROOMTEMPREADING%:0:
#LogDB %WINDOW1%:state:::$val=~s/(open|closed|tilted)(\d*).*/$1eq"open"?60:$1eq"tilted"?45:0/eg
#LogDB %WINDOW2%:state:::$val=~s/(open|closed|tilted)(\d*).*/$1eq"open"?60:$1eq"tilted"?45:0/eg
plot "<IN>" using 1:2 axes x1y2 title 'Desired' ls l0 lw 1 with lines,\
    "<IN>" using 2:2 axes x1y2 title 'Measured actuator' ls l7 lw 1 with lines,\
    "<IN>" using 1:2 axes x1y2 title 'Aussen' ls l1 lw 1 with lines,\
    "<IN>" using 1:2 axes x1y1 y2title 'Valve' ls l5 lw 1 with steps,\
    "<IN>" using 1:2 axes x1y1 title 'Humidity' ls l2 lw 1 with lines,\
    "<IN>" using 1:2 axes x1y2 title 'Measured roomsensor' ls l3 lw 1 with lines,\
    "<IN>" using 1:2 axes x1y1 y2title '%WINDOW1%' ls l4fill lw 0.5 with steps,\
    "<IN>" using 1:2 axes x1y1 y2title '%WINDOW2%' ls l5fill lw 0.5 with steps
</source>


== Links ==
== Links ==
* [[Plots erzeugen]]
* [[Plots erzeugen]]
* [[Creating Plots]]
* [[Creating Plots]]
 
<references /><syntaxhighlight lang="raw">
[[Kategorie:Logging]]
[[Kategorie:Logging]]

Version vom 20. Januar 2020, 12:52 Uhr

Todo: Diese Beschreibung ist noch zu ergänzen / erweitern.


SVG
Zweck / Funktion
Erstellung von Diagrammen aus Logdaten
Allgemein
Typ Hilfsmodul
Details
Dokumentation EN / DE
Support (Forum) Frontends
Modulname 98_SVG.pm
Ersteller rudolfkoenig (Forum / Wiki)
Wichtig: sofern vorhanden, gilt im Zweifel immer die (englische) Beschreibung in der commandref!


Das Modul SVG generiert Diagramme aus Logdateien oder -datenbanken.

Die Eigenschaften des zu erstellenden Diagrams werden in einer .gplot-Datei festgelegt.

Definition

Details in der commandref/SVGlinkdefine.

Attribute

Details in der commandref/SVGattr.

Funktionen

Details in der commandref/plotfunction.

Beispiele

Temperatur- und Heizungsdaten eines Zimmers

Quelle: Beitrag (Datenquelle ist ein DBLog-Device namens LogDB):

PlotReplace Example DBLog.png
# Created by FHEM/98_SVG.pm, 2020-01-06
# to replace variables, use plotReplace like
# attr SVG_Thermostat plotReplace SPEC1=Thermostat TL="My example thermostat" EXTERNALTEMPDEVICE=MYSENSOR_97 EXTERNALTEMPREADING=temperature2 \
# ROOMHUMIDITYDEVICE=HUEDevice3 EXTERNALHUMIDITYREADING=humidity ROOMTEMPDEVICE=HUEDevice4 ROOMTEMPREADING=temperature WINDOW1=Window1_MyRoom WINDOW2=Window2_MyRoom

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
set y2tics
set grid
set ylabel "Valve/Window"
set y2label "Temperature"
set yrange [-5:105]
set y2range [-15:35]
set isosample 20

#LogDB %SPEC1%:desired-temp::
#LogDB %SPEC1%:measured-temp:0:
#LogDB %EXTERNALTEMPDEVICE%:%EXTERNALTEMPREADING%::
#LogDB %SPEC1%:actuator:0:int
#LogDB %ROOMHUMIDITYDEVICE%:%EXTERNALHUMIDITYREADING%:0:
#LogDB %ROOMTEMPDEVICE%:%ROOMTEMPREADING%:0:
#LogDB %WINDOW1%:state:::$val=~s/(open|closed|tilted)(\d*).*/$1eq"open"?60:$1eq"tilted"?45:0/eg
#LogDB %WINDOW2%:state:::$val=~s/(open|closed|tilted)(\d*).*/$1eq"open"?60:$1eq"tilted"?45:0/eg


plot "<IN>" using 1:2 axes x1y2 title 'Desired' ls l0 lw 1 with lines,\
     "<IN>" using 2:2 axes x1y2 title 'Measured actuator' ls l7 lw 1 with lines,\
     "<IN>" using 1:2 axes x1y2 title 'Aussen' ls l1 lw 1 with lines,\
     "<IN>" using 1:2 axes x1y1 y2title 'Valve' ls l5 lw 1 with steps,\
     "<IN>" using 1:2 axes x1y1 title 'Humidity' ls l2 lw 1 with lines,\
     "<IN>" using 1:2 axes x1y2 title 'Measured roomsensor' ls l3 lw 1 with lines,\
     "<IN>" using 1:2 axes x1y1 y2title '%WINDOW1%' ls l4fill lw 0.5 with steps,\
     "<IN>" using 1:2 axes x1y1 y2title '%WINDOW2%' ls l5fill lw 0.5 with steps

Links

<syntaxhighlight lang="raw">