Autor Thema: SVG plots  (Gelesen 1420 mal)

Offline jacko

  • New Member
  • *
  • Beiträge: 18
SVG plots
« am: 03 März 2022, 18:35:51 »
I am trying to generate what I thought would be a really simple plot of a device's state over time, in this case a heating element that turns on and off depending on the temperature. The plot should look like a square wave.

I have configured the SVG element as in the attached image ("Plot Editor settings"), triggering off the state changes to the Heater Relay.

The closest I can get is to use "points" style and imagine the lines! ("Points plot" attachment).

The logfile contains the following entriesget fl_Air_temp CURRENT INT 2022-03-03_00:00:00 2022-03-03_23:59:59 "1":HeaterRelay.on:: "0.2":HeaterRelay.off::

2022-03-03_09:48:46 1
2022-03-03_12:59:04 1
2022-03-03_15:48:18 1
2022-03-03_17:02:14 1
#"1":HeaterRelay.on::
2022-03-03_09:47:58 0.2
2022-03-03_09:48:47 0.2
2022-03-03_13:14:15 0.2
2022-03-03_16:02:59 0.2
2022-03-03_17:18:45 0.2
#"0.2":HeaterRelay.off::

To compound things, I can't even find where the .gplot file is stored!?!?!

Any pointers would be appreciated.
« Letzte Änderung: 03 März 2022, 18:49:55 von jacko »

Offline rudolfkoenig

  • Administrator
  • Hero Member
  • *****
  • Beiträge: 25394
Antw:SVG plots
« Antwort #1 am: 03 März 2022, 19:49:16 »
Zitat
I am trying to generate what I thought would be a really simple plot of a device's state over time, in this case a heating element that turns on and off depending on the temperature. The plot should look like a square wave.
This question is coming up regularly, but finding the answer via a search engine is not really straightforward.
The solution is to generate numbers from the strings with a "Function", $fld[2]=~"on"?1:0.2 should work in your case.
Dont forget the correct Regexp, though.

Zitat
To compound things, I can't even find where the .gplot file is stored!?!?!
Looks like you're on the beginning end of unix-expertship :)
Try to search for it with:
find /opt/fhem -name \*.gplot
or
grep -rl HeaterRelay /opt/fhem

Offline jacko

  • New Member
  • *
  • Beiträge: 18
Antw:SVG plots
« Antwort #2 am: 05 März 2022, 11:42:16 »
Thanks for the pointer. I have now got the graph working (and learned a few more things about fhem on the way).
For the record, I had to select the wildcard state, in this case HeaterRelay.*, and the "steps" plot-type.

I also found the .gplot file. Perhaps as an enhancement request the actual name of the .gplot file could be displayed on the graph configuration page?

Cheers.

Offline Prof. Dr. Peter Henning

  • Developer
  • Hero Member
  • ****
  • Beiträge: 8472
Antw:SVG plots
« Antwort #3 am: 28 April 2022, 18:59:21 »
Zitat
Perhaps as an enhancement request the actual name of the .gplot file could be displayed on the graph configuration page?
Take a closer look and you'll see that this is already the case.

Regards

pah