FHEM Forum

FHEM => Frontends => TabletUI => Thema gestartet von: Stelaku am 24 Januar 2021, 12:25:13

Titel: FTUI Widget Chart mit logProxy logProxy_xyFile2Plot
Beitrag von: Stelaku am 24 Januar 2021, 12:25:13
Hallo alle zusammen

Ich versuche jetzt schon seit einiger Zeit ein bestehenden SVG plot, in einem FTUI Widget Chart anzeigen zu lassen. Das SVG plot wird durch ein LogProxy generiert.
Ich habe eine aus x und y basierene Position meines Saugroboters und eine ebenfalls aus x y Koordinaten erzeugte linie wo der Sauger langefahren ist.
Dazu kommen noch manuell eingetragende Linien. Hier ein list des SVG GPLOTFILE

# Created by FHEM/98_SVG.pm, 2021-01-21 17:42:03
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 'Karte vom Haus'
set ytics
set y2tics
set grid
set ylabel "Humidity"
set y2label "Temperature"
set xrange [-11:10]
set yrange [-11:10]

#lp Func:logProxy_xyFile2Plot("/opt/fhem/log/position.log",2,"position")
#lp Func:logProxy_xyFile2Plot("/opt/fhem/log/Karte.log",4,"pos_x_y:")
#lp Func:logProxy_xy2Plot([[10,9],[-10,9],[-10,-9],[8,-9],[8,9]])
#lp Func:logProxy_xy2Plot([[-6.5,1],[-9,1],[-9,-4],[-5.5,-4],[-5.5,-7],[-0.5,-7],[-0.5,-1.2],[-1.5,-1.2],[1,-1.2]])
#lp Func:logProxy_xy2Plot([[-9,1],[-9,5],[-5,5],[-5,0.6],[-5,1],[-5.4,1]])
#lp Func:logProxy_xy2Plot([[-5,3.5],[-3,3.5],[-3,0.6],[-3,3.5],[6.7,3.5],[6.7,-6],[-0.5,-6]])
#lp Func:logProxy_xy2Plot([[-3,-1.2],[-5,-1.2],[-5,-0.2],[-3,-0.2],[-3,-1.27]])
#lp Func:logProxy_xy2Plot([[2,-6],[2,-1.2],[1.8,-1.2],[2.2,-1.2]])
#lp Func:logProxy_xy2Plot([[3.2,-1.2],[6.7,-1.2]])
#lp Func:logProxy_xy2Plot([[3.2,-0.3],[6.7,-0.3]])
#lp Func:logProxy_xy2Plot([[3.4,3.5],[3.3,0.6],[3.3,0.8],[2.6,0.8]])
#lp Func:logProxy_xy2Plot([[1.6,0.8],[-0.4,0.8],[-0.4,1.8],[-0.4,2.2],[-0.4,1.8],[-2.0,1.8],[1,1.8],[1,3.5]])
#lp Func:logProxy_xy2Plot([[-0.4,2.9],[-0.4,3.5]])

plot "<IN>" using 1:2 axes x1y2 title 'Martha' ls l0 lw 2 with points,\
     "<IN>" using 1:2 axes x1y2 title 'Map' ls l2 lw 1 with lines,\
     "<IN>" using 1:2 axes x1y2 title 'Rahmen' ls l1fill lw 1 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines

das SVG Device hat folgende list

Internals:
   DEF        Karte:SVG_Karte_1:CURRENT
   FUUID      5ffe8582-f33f-ddbb-387c-deccd0c6bfcec610
   GPLOTFILE  SVG_Karte_1
   LOGDEVICE  Karte
   LOGFILE    CURRENT
   NAME       SVG_Karte_1
   NR         49
   STATE      initialized
   TYPE       SVG
Attributes:
   plotmode   SVG
   plotsize   800,700
   room       Karte


die daten kommen aus zwei logfiles.
Ein logfile in der die xy Koordinaten fortlaufend eingetragen werden und sich daraus eine linie bildet.
Die aktuelle Position des Saugers wird durch eine zweite log datei erzeugt in der sich nur eine xy Koordinate befindet. Diese wird bei jeder neuen
Positionsmeldung durch die neue Position ersetzt.
Das funktioniert so auf der femweb Oberfläche sehr gut.
Mein Ziel ist es jetzt dieses funktionierende SVG plot über FTUI auf mein Handy aufzurufen, in der Hoffnung das sich die aktuelle Position des Saugers bei Änderung
auch gleich im Chart ohne manuelles refresh angezeigt bekomme.

Ich muss dazu sagen ich bin blutiger Anfänger was FTUI tablet angeht.
Ich bin schon froh darüber das ich es geschaft habe ein paar Schalter als widget angelegt zu habe, die in der Fhem Oberfläche auch was auslösen.
Meine bisherigen versuche beziehen sich auf das fhem wiki https://wiki.fhem.de/wiki/FTUI_Widget_Chart
Dort ist ein schönes Beispiel was ich leider nicht bei mir umgesetzt bekomme

<div data-type="chart"
data-device="AU.xx.WE.Proplanta"
data-logdevice='[
"myLogProxy",
"myLogProxy",
"myLogProxy",
"myLogProxy"
]'
data-columnspec='[
"Func:logProxy_proplanta2Plot(\\x22AU.xx.WE.Proplanta\\x22,\\x22temp_\\x22,$from,$to,12,\\x22day\\x22)",
"Func:logProxy_proplanta2Plot(\\x22AU.xx.WE.Proplanta\\x22,\\x22rain_\\x22,$from,$to,12,\\x22day\\x22)",
"Func:logProxy_proplanta2Plot(\\x22AU.xx.WE.Proplanta\\x22,\\x22chOfRain_\\x22,$from,$to,12,\\x22day\\x22)",
"Func:logProxy_proplanta2Plot(\\x22AU.xx.WE.Proplanta\\x22,\\x22cloud_\\x22,$from,$to,12,\\x22day\\x22)"
]'
...>
</div>


Auf meine Bedürfnisse umgeschrieben sieht das ganze dann so bei mir aus


<li data-row="1" data-col="1" data-sizex="15" data-sizey="10">
  <div  data-type="chart"
        data-device="Mi_Vacuum"
        data-logdevice='[
          "lp",
          "lp",
          "lp"
        ]'
data-columnspec='[
                    "Func:logProxy_xyFile2Plot("/opt/fhem/log/position.log",2,"position")"
                    "Func:logProxy_xyFile2Plot("/opt/fhem/log/Karte.log",4,"pos_x_y:")"
                    "Func:logProxy_xy2Plot([[10,9],[-10,9],[-10,-9],[8,-9],[8,9]])"
        ]'
...>
</div>

</li>


Ich habe jetzt erstmal nicht alle #lp Zeilen aus meinem GPLOTFILE übernommen wollte erst sehen ob es überhaupt funktioniert.
Leider bekomme ich nur ein leeres Diagram angezeigt.
siehe Bild
zum Vergleich ein Bild vom funktionierenden SVG plot
Ich würde mich sehr freuen wenn Ihr mir als Laie da etwas unter die Arme greifen würdet.

Viele Grüße

Stephan


Titel: Antw:FTUI Widget Chart mit logProxy logProxy_xyFile2Plot
Beitrag von: OdfFhem am 24 Januar 2021, 14:21:47
@Stelaku

Auf den ersten Blick fallen schon mal zwei "Schwierigkeiten" auf, die man auf jeden Fall beseitigen muss.


Titel: Antw:FTUI Widget Chart mit logProxy logProxy_xyFile2Plot
Beitrag von: Stelaku am 24 Januar 2021, 14:54:18
Vielen dank für die Anrwort.
Ich habe das gleich mal ausprobiert

leider waren meine Versuche alle ohne Erfolg

"Func:logProxy_xyFile2Plot("/opt/fhem/log/position.log",2,"position")"                                 1. Versuch mit doppelte "
"Func:logProxy_xyFile2Plot('/opt/fhem/log/position.log",2,"position')"                                   2. Versuch mit einfache '
"Func:logProxy_xyFile2Plot('/opt/fhem/log/position.log',2,'position')"                                    3. Versuch mit einfache '
"Func:logProxy_xyFile2Plot(\\x22/opt/fhem/log/position.log",2,"position\\x22)"                   4. Versuch mit \\x22
"Func:logProxy_xyFile2Plot(\\x22/opt/fhem/log/position.log\\x22,2,\\x22position\\x22)"      5.Versuch  mit \\x22 statt "

Das Array

"Func:logProxy_xy2Plot([[10,9],[-10,9],[-10,-9],[8,-9],[8,9]])"                                               1.Versuch
"Func:logProxy_xy2Plot(\\x22[[10,9],[-10,9],[-10,-9],[8,-9],[8,9]]\\x22)"                               2. Versuch  mit \\x22
"Func:logProxy_xy2Plot(\\x22[[10,9]\\x22[-10,9]\\x22[-10,-9]\\x22[8,-9]\\x22[8,9]]\\x22)"  3.Versuch  mit \\x22




Gruß

Stephan
Titel: Antw:FTUI Widget Chart mit logProxy logProxy_xyFile2Plot
Beitrag von: OdfFhem am 24 Januar 2021, 16:11:14
@Stelaku

So sollte der Attribut-Teil ungefähr aussehen ... wichtig sind die Kommata zur Trennung der Spalten und die Maskierung der inneren, doppelten Anführungszeichen ...


data-logdevice='[
  "lp",
  "lp",
  "lp"
]'

data-columnspec='[
  "Func:logProxy_xyFile2Plot(\\x22/opt/fhem/log/position.log\\x22,2,\\x22position\\x22)",
  "Func:logProxy_xyFile2Plot(\\x22/opt/fhem/log/Karte.log\\x22,4,\\x22pos_x_y:\\x22)",
  "Func:logProxy_xy2Plot([[10,9],[-10,9],[-10,-9],[8,-9],[8,9]])"
]'
Titel: Antw:FTUI Widget Chart mit logProxy logProxy_xyFile2Plot
Beitrag von: Stelaku am 24 Januar 2021, 16:40:24
Hallo OldFhem

Ich wusste es ist nur eine kleinigkeit. Das kleine Komma am ende der Spalte war der Fehler.
zusammen mit den auskommentieren der " mit \\x22 habe ich jetzt schon mal ein Bild.
sieht zwar noch nicht so aus wie das Original SVG aber da werde ich noch ein bisschen weiterprobieren.

Vielen dank für Deine Hilfe.

Gruß

Stephan
Titel: Antw:FTUI Widget Chart mit logProxy logProxy_xyFile2Plot
Beitrag von: eki am 24 Januar 2021, 17:13:55
Probier mal nicht zu viel. Ich bin gerade an dem Thema unter Nutzung des Map Widget dran siehe https://forum.fhem.de/index.php/topic,91781.msg1125432.html#msg1125432 (https://forum.fhem.de/index.php/topic,91781.msg1125432.html#msg1125432). Wenn das klappt, hätte es den Vorteil, dass man auch zoomen etc. könnte (so was geht bei der 2D Darstellung im Chart nicht).
Titel: Antw:FTUI Widget Chart mit logProxy logProxy_xyFile2Plot
Beitrag von: Stelaku am 24 Januar 2021, 18:02:58
Hallo eki

vielen dank für die Info. Hab ich schon gesehen das Du mit curt mit dem Map Widget da was machst. War nur neugierig ob das auch mit chart funktioniert.
Ich bin auch schon auf eure Umsetzung gespannt vor allem mit der zoom Funktion.

Viele grüße

Stephan
Titel: Antw:FTUI Widget Chart mit logProxy logProxy_xyFile2Plot
Beitrag von: Stelaku am 25 Januar 2021, 17:35:26
Hallo OdfFhem

Ich habe es jetzt hinbekommen dank Deiner Hilfestellung und hier ist das erste Ergebnis zwar noch nicht perfekt aber das kann ja noch werden.


            <li data-row="1" data-col="1" data-sizey="1" data-sizex="1">
              <div data-type="chart"
              data-device="Mi_Vacuum"
                 data-logdevice='[
              "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp"
                          ]'
              data-columnspec='[
                                "Func:logProxy_xyFile2Plot(\\x22/opt/fhem/log/position.log\\x22,2,\\x22position\\x22)",
                                "Func:logProxy_xyFile2Plot(\\x22/opt/fhem/log/Karte.log\\x22,4,\\x22pos_x_y:\\x22)",
                                "Func:logProxy_xy2Plot([[10,9],[-10,9],[-10,-9],[8,-9],[8,9]])",
                                "Func:logProxy_xy2Plot([[-6.5,1],[-9,1],[-9,-4],[-5.5,-4],[-5.5,-7],[-0.5,-7],[-0.5,-1.2],[-1.5,-1.2],[1,-1.2]])",
                                "Func:logProxy_xy2Plot([[-9,1],[-9,5],[-5,5],[-5,0.6],[-5,1],[-5.4,1]])",
                                "Func:logProxy_xy2Plot([[-5,3.5],[-3,3.5],[-3,0.6],[-3,3.5],[6.7,3.5],[6.7,-6],[-0.5,-6]])",
                                "Func:logProxy_xy2Plot([[-3,-1.2],[-5,-1.2],[-5,-0.2],[-3,-0.2],[-3,-1.27]])",
                                "Func:logProxy_xy2Plot([[2,-6],[2,-1.2],[1.8,-1.2],[2.2,-1.2]])",
                                "Func:logProxy_xy2Plot([[3.2,-1.2],[6.7,-1.2]])",
                                "Func:logProxy_xy2Plot([[3.2,-0.3],[6.7,-0.3]])",
                                "Func:logProxy_xy2Plot([[3.4,3.5],[3.3,0.6],[3.3,0.8],[2.6,0.8]])",
                                "Func:logProxy_xy2Plot([[1.6,0.8],[-0.4,0.8],[-0.4,1.8],[-0.4,2.2],[-0.4,1.8],[-2.0,1.8],[1,1.8],[1,3.5]])",
                                "Func:logProxy_xy2Plot([[-0.4,2.9],[-0.4,3.5]])"
                                ]'

                  data-style='[
                              "ftui l2sym",
                              "ftui l1",
                              "ftui l4",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym"
                              ]'
                  data-ptype='[
                                "points",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines"
                              ]'
                  data-height="900"
                  data-width="1000"
              ...>
              </div>
            </li>


Was jetzt noch nicht so schön ist, das sich der rote Punkt für den Sauger zwar jetzt in Echtzeit auf der Karte bewegt, aber beim ansehen irgentwie statt der linie ein Spinnennetz gezeichnet wird.
siehe Karte_2.
Wenn der Sauger dann fertig ist und man dann auf die Karte schaut sieht alles normal aus.
Siehe Karte_1.
Cool wäre wenn ich es noch hinbekommen würde das es wie auf Karte_3 zu sehen ist.
Das habe ich nur hinbekommen durch drücken der F5 Taste.

Kann natürlich auch sein das das mit chart überhaupt nicht geht. Ich hab da ja bis gestern noch nichts mit FTUI tablet gemacht.

Viele Grüsse

Stephan
Titel: Antw:FTUI Widget Chart mit logProxy logProxy_xyFile2Plot
Beitrag von: OdfFhem am 26 Januar 2021, 05:57:54
@Stelaku

Zitat
Damit der Refresh des Charts funktioniert, muss auch ein Device angegeben werden, der das Refresh triggert. Das Diagramm wird immer dann aktualisiert, wenn sich der Inhalt von data-get ändert.

Das Device hast Du ja schon angegeben ... data-device="Mi_Vacuum"

*** Spekulation ein ***

Nach Deiner Grafik wird bei einer Wertänderung der Chart dann nicht gelöscht und komplett neu gezeichnet, sondern der neue Wert wird "nur" hinzugefügt ...

Was datenmäßig geliefert wird, kann man nur vermuten. Wahrscheinlich keine absolute Koordinate, sondern eine relative in Bezug auf die Ladestation und diese ist dann das Zentrum des Spinnennetzes.

*** Spekulation aus ***

@eki weiss da sicher mehr ...
Titel: Antw:FTUI Widget Chart mit logProxy logProxy_xyFile2Plot
Beitrag von: Stelaku am 26 Januar 2021, 22:56:57
Hallo OdfFhem

Ja es sieht genau so aus, der Wert z.B. für den roten Punkt ändert sich im log file und wird dann im chart hinzugefügt. Der alte Punkt wird nicht gelöscht. Erst bei einen kpl. refresh der Seite mit F5.
Die Positionsdaten werden aus einem Reading das z.B so aussieht gebildet. Es ist immer nur eine zeile in diesem log der Wert wird immer wieder überschrieben

-1.216533,1.182425

Die Positionsdaten für den weißen Strich der den Verlauf des Saugers anzeigen soll wird in einem zweiten log mit den selben Koordinaten fortlaufend beschrieben.
Mit dem Spinnen Netz hat es den anschein das das chart Widget immer versucht den Anfangspunkt aus dem log file mit dem letzten Punkt im logfile mit einer Linie zu Verbinden.
Das kann man auch schön bei den quer laufenden gelben Linien für die Wände sehen. Da wird auch die erste x,y Koordinate mit der letzten verbunden.
Für die Wände habe ich eine Lösung gefunden. Ich habe einfach weitere Punkte auf den bereits vorhanden Punkten bis zum anfang zurückgezeichnet.
Aber das Problem mit dem Spinnennetz und die immer neu hinzugefügten roten Punkte habe ich noch keine Lösung im Netz gefunden.
Klasse wäre ja ein befehl in dem der chart immer kpl neu gezeichnet wird. Ich befürchte nur dann hat man ein flackern was dann auch nicht schön wäre.
Vieleicht hat ja noch einer eine Idee.

Viele Grüße

Stephan

Titel: Antw:FTUI Widget Chart mit logProxy logProxy_xyFile2Plot
Beitrag von: eki am 27 Januar 2021, 08:43:29
Tja, das mit den XY-Plots ist so eine Sache. Ich habe das ins Chart eingebaut, indem ich mir die Logfile Get Ergebnisse im Browser angeschaut habe und dann mehr oder weniger "erraten" habe, was das bedeuten soll. Da kann schon was unterschiedlich sein zum Verhalten im SVG Plot. Um das weiter zu untersuchen, bräuchte ich mal ein paar Beispielzeilen aus den erwähnten Files.
Titel: Antw:FTUI Widget Chart mit logProxy logProxy_xyFile2Plot
Beitrag von: Stelaku am 27 Januar 2021, 08:57:11
Hallo eki 

Danke für Deine Antwort. Ich hoffe ich habe Dich richtig verstanden was Du noch benötigst. hier mein GPLOTFILE

# Created by FHEM/98_SVG.pm, 2021-01-14 19:24:23
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 'Karte vom Haus'
set ytics
set y2tics
set grid
set ylabel "Humidity"
set y2label "Temperature"
set xrange [-11:10]
set yrange [-11:10]

#lp Func:logProxy_xyFile2Plot("/opt/fhem/log/position.log",2,"position")
#lp Func:logProxy_xyFile2Plot("/opt/fhem/log/Karte.log",4,"pos_x_y:")
#lp Func:logProxy_xy2Plot([[10,9],[-10,9],[-10,-9],[8,-9],[8,9]])
#lp Func:logProxy_xy2Plot([[-6.5,1],[-9,1],[-9,-4],[-5.5,-4],[-5.5,-7],[-0.5,-7],[-0.5,-1.2],[-1.5,-1.2],[1,-1.2]])
#lp Func:logProxy_xy2Plot([[-9,1],[-9,5],[-5,5],[-5,0.6],[-5,1],[-5.4,1]])
#lp Func:logProxy_xy2Plot([[-5,3.5],[-3,3.5],[-3,0.6],[-3,3.5],[6.7,3.5],[6.7,-6],[-0.5,-6]])
#lp Func:logProxy_xy2Plot([[-3,-1.2],[-5,-1.2],[-5,-0.2],[-3,-0.2],[-3,-1.27]])
#lp Func:logProxy_xy2Plot([[2,-6],[2,-1.2],[1.8,-1.2],[2.2,-1.2]])
#lp Func:logProxy_xy2Plot([[3.2,-1.2],[6.7,-1.2]])
#lp Func:logProxy_xy2Plot([[3.2,-0.3],[6.7,-0.3]])
#lp Func:logProxy_xy2Plot([[3.4,3.5],[3.3,0.6],[3.3,0.8],[2.6,0.8]])
#lp Func:logProxy_xy2Plot([[1.6,0.8],[-0.4,0.8],[-0.4,1.8],[-0.4,2.2],[-0.4,1.8],[-2.0,1.8],[1,1.8],[1,3.5]])
#lp Func:logProxy_xy2Plot([[-0.4,2.9],[-0.4,3.5]])

plot "<IN>" using 1:2 axes x1y2 title 'Martha' ls l0 lw 2 with points,\
     "<IN>" using 1:2 axes x1y2 title 'Map' ls l2 lw 1 with lines,\
     "<IN>" using 1:2 axes x1y2 title 'Rahmen' ls l1fill lw 1 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines,\
     "<IN>" using 1:2 axes x1y2 title '&nbsp;' ls l0 lw 8 with lines


hier ist ein Auszug aus dem logfile Karte.log daraus wird die Spinnennetz linie


2021-01-27_07:27:21 Mi_Vacuum pos_x_y: -4.562562,-4.81163
2021-01-27_07:27:23 Mi_Vacuum pos_x_y: -4.487534,-4.595044
2021-01-27_07:27:25 Mi_Vacuum pos_x_y: -4.425129,-4.473045
2021-01-27_07:27:27 Mi_Vacuum pos_x_y: -4.423401,-4.482825
2021-01-27_07:27:29 Mi_Vacuum pos_x_y: -4.487114,-4.464986
2021-01-27_07:27:31 Mi_Vacuum pos_x_y: -4.58651,-4.435614
2021-01-27_07:27:33 Mi_Vacuum pos_x_y: -4.670028,-4.238929
2021-01-27_07:27:35 Mi_Vacuum pos_x_y: -4.57523,-4.043335
2021-01-27_07:27:37 Mi_Vacuum pos_x_y: -4.379522,-4.034451
2021-01-27_07:27:39 Mi_Vacuum pos_x_y: -4.334022,-4.056005
2021-01-27_07:27:41 Mi_Vacuum pos_x_y: -4.174684,-3.930795
2021-01-27_07:27:43 Mi_Vacuum pos_x_y: -4.005872,-3.97226
2021-01-27_07:27:45 Mi_Vacuum pos_x_y: -3.871243,-4.122009
2021-01-27_07:27:47 Mi_Vacuum pos_x_y: -3.915305,-4.327374
2021-01-27_07:27:49 Mi_Vacuum pos_x_y: -4.114278,-4.374519
2021-01-27_07:27:51 Mi_Vacuum pos_x_y: -4.257327,-4.328671
2021-01-27_07:27:53 Mi_Vacuum pos_x_y: -4.254982,-4.330043


hier der Inhalt von position.log daraus wird der rote Punkt


position -2.57328,0.61779


Und hier der quelltext


            <li data-row="1" data-col="1" data-sizey="10" data-sizex="10">
              <div data-type="chart"
              data-device="Mi_Vacuum"
                 data-logdevice='[
                     "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp"
                          ]'
              data-columnspec='[
                                "Func:logProxy_xyFile2Plot(\\x22/opt/fhem/log/position.log\\x22,2,\\x22position\\x22)",
                                "Func:logProxy_xyFile2Plot(\\x22/opt/fhem/log/Karte.log\\x22,4,\\x22pos_x_y:\\x22)",
                                "Func:logProxy_xy2Plot([[10,8],[-10,8],[-10,-9],[8,-9],[8,8]])",
                                "Func:logProxy_xy2Plot([[-6.5,1],[-9,1],[-9,-4],[-5.5,-4],[-5.5,-7],[-0.5,-7],[-0.5,-1.2],[-1.5,-1.2],[1,-1.2],[-0.5,-1.2],[-0.5,-7],[-5.5,-7],[-5.5,-4],[-9,-4],[-9,1]])",
                                "Func:logProxy_xy2Plot([[-9,1],[-9,5],[-5,5],[-5,0.6],[-5,1],[-5.4,1],[-5,1],[-5,5],[-9,5]])",
                                "Func:logProxy_xy2Plot([[-5,3.5],[-3,3.5],[-3,0.6],[-3,3.5],[6.7,3.5],[6.7,-6],[-0.5,-6],[6.7,-6],[6.7,3.5]])",
                                "Func:logProxy_xy2Plot([[-3,-1.2],[-5,-1.2],[-5,-0.2],[-3,-0.2],[-3,-1.27]])",
                                "Func:logProxy_xy2Plot([[2,-6],[2,-1.2],[1.8,-1.2],[2.2,-1.2],[2,-1.2]])",
                                "Func:logProxy_xy2Plot([[3.2,-1.2],[6.7,-1.2]])",
                                "Func:logProxy_xy2Plot([[3.2,-0.3],[6.7,-0.3]])",
                                "Func:logProxy_xy2Plot([[3.4,3.5],[3.3,0.6],[3.3,0.8],[2.6,0.8],[3.3,0.8]])",
                                "Func:logProxy_xy2Plot([[1.6,0.8],[-0.4,0.8],[-0.4,1.8],[-0.4,2.2],[-0.4,1.8],[-2.0,1.8],[1,1.8],[1,3.5],[1,1.8],[-0.4,1.8],[-0.4,0.8]])",
                                "Func:logProxy_xy2Plot([[-0.4,2.9],[-0.4,3.5]])"
                                ]'

                  data-style='[
                              "ftui l2sym",
                              "ftui l1",
                              "ftui l4",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym"
                              ]'
                  data-ptype='[
                                "points",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines"
                              ]'
                  data-uaxis='["primary","primary","primary"]'
                  data-height="900"
                  data-width="1000">
              </div>

Wenn Du noch mehr brauchst sag bescheid.
Vielen dank

Gruß

Stephan
Titel: Antw:FTUI Widget Chart mit logProxy logProxy_xyFile2Plot
Beitrag von: Stelaku am 28 Januar 2021, 15:44:01
Hallo eki

Ich habe da noch was gebastelt. Vieleicht kannst Du das dann besser bei Dir nachstellen.
Ich habe drei dummy´s geschrieben mit denen es möglich ist den Sauger manuell auf der Karte zu verschieben.
anbei aus der raw kopiert die drei dummy. Es werden durch das eine dummy Karte_loeschen zwei log file´s angelegt.
einmal Karte.log zeigt den verlauf des Saugers und einmal position.log das ist der rote Punkt.

defmod Karte_loeschen dummy
attr Karte_loeschen room Karte
attr Karte_loeschen setList hoch runter rechts links loeschen
attr Karte_loeschen userReadings Karte {\
\
my $iy = ReadingsVal("y","state","0");;\
my $ix = ReadingsVal("x","state","0");;\
if(ReadingsVal($name,"state","") eq "loeschen"){\
qx`echo 2021-01-27_07:27:21 Mi_Vacuum pos_x_y: -1.236239,1.175978 > /opt/fhem/log/Karte.log`;;\
fhem("set y 1.175978 ;; set x -1.236239")\
}\
\
\
if(ReadingsVal($name,"state","") eq "hoch"){\
my $y = $iy + 0.1;;\
my $x = $ix;;\
fhem("set y $y");;\
qx`echo 2021-01-27_07:27:21 Mi_Vacuum pos_x_y: $x,$y >> /opt/fhem/log/Karte.log`;;\
qx`echo position $x,$y > /opt/fhem/log/position.log`\
}\
\
if(ReadingsVal($name,"state","") eq "runter"){\
my $y = $iy -0.1;;\
my $x = $ix;;\
fhem("set y $y");;\
qx`echo 2021-01-27_07:27:21 Mi_Vacuum pos_x_y: $x,$y >> /opt/fhem/log/Karte.log`;;\
qx`echo position $x,$y > /opt/fhem/log/position.log`\
}\
\
\
if(ReadingsVal($name,"state","") eq "rechts"){\
my $x = $ix +0.1;;\
my $y = $iy;;\
fhem("set x $x");;\
qx`echo 2021-01-27_07:27:21 Mi_Vacuum pos_x_y: $x,$y >> /opt/fhem/log/Karte.log`;;\
qx`echo position $x,$y > /opt/fhem/log/position.log`\
}\
\
if(ReadingsVal($name,"state","") eq "links"){\
my $x = $ix -0.1;;\
my $y = $iy;;\
fhem("set x $x");;\
qx`echo 2021-01-27_07:27:21 Mi_Vacuum pos_x_y: $x,$y >> /opt/fhem/log/Karte.log`;;\
qx`echo position $x,$y > /opt/fhem/log/position.log`\
}\
}\

attr Karte_loeschen webCmd hoch:runter:rechts:links:loeschen

defmod x dummy
attr x room Karte

defmod y dummy
attr y room Karte


dann noch dazu den quelltext für das chart widget


            <li data-row="1" data-col="1" data-sizey="10" data-sizex="10">
              <div data-type="chart"
              data-device="Karte_loeschen"
                 data-logdevice='[
                     "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp",
                                 "lp"
                          ]'
              data-columnspec='[
                                "Func:logProxy_xyFile2Plot(\\x22/opt/fhem/log/position.log\\x22,2,\\x22position\\x22)",
                                "Func:logProxy_xyFile2Plot(\\x22/opt/fhem/log/Karte.log\\x22,4,\\x22pos_x_y:\\x22)",
                                "Func:logProxy_xy2Plot([[10,8],[-10,8],[-10,-9],[8,-9],[8,8]])",
                                "Func:logProxy_xy2Plot([[-6.5,1],[-9,1],[-9,-4],[-5.5,-4],[-5.5,-7],[-0.5,-7],[-0.5,-1.2],[-1.5,-1.2],[1,-1.2],[-0.5,-1.2],[-0.5,-7],[-5.5,-7],[-5.5,-4],[-9,-4],[-9,1]])",
                                "Func:logProxy_xy2Plot([[-9,1],[-9,5],[-5,5],[-5,0.6],[-5,1],[-5.4,1],[-5,1],[-5,5],[-9,5]])",
                                "Func:logProxy_xy2Plot([[-5,3.5],[-3,3.5],[-3,0.6],[-3,3.5],[6.7,3.5],[6.7,-6],[-0.5,-6],[6.7,-6],[6.7,3.5]])",
                                "Func:logProxy_xy2Plot([[-3,-1.2],[-5,-1.2],[-5,-0.2],[-3,-0.2],[-3,-1.27]])",
                                "Func:logProxy_xy2Plot([[2,-6],[2,-1.2],[1.8,-1.2],[2.2,-1.2],[2,-1.2]])",
                                "Func:logProxy_xy2Plot([[3.2,-1.2],[6.7,-1.2]])",
                                "Func:logProxy_xy2Plot([[3.2,-0.3],[6.7,-0.3]])",
                                "Func:logProxy_xy2Plot([[3.4,3.5],[3.3,0.6],[3.3,0.8],[2.6,0.8],[3.3,0.8]])",
                                "Func:logProxy_xy2Plot([[1.6,0.8],[-0.4,0.8],[-0.4,1.8],[-0.4,2.2],[-0.4,1.8],[-2.0,1.8],[1,1.8],[1,3.5],[1,1.8],[-0.4,1.8],[-0.4,0.8]])",
                                "Func:logProxy_xy2Plot([[-0.4,2.9],[-0.4,3.5]])"
                                ]'

                  data-style='[
                              "ftui l2sym",
                              "ftui l1",
                              "ftui l4",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym",
                              "ftui l3sym"
                              ]'
                  data-ptype='[
                                "points",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines",
                                "lines"
                              ]'
                  data-uaxis='["primary","primary","primary"]'
                  data-height="900"
                  data-width="1000">
                </div>



            </li>



eventuell hilft das auch beim map widget.

Viele Grüsse

Stephan